19f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* 29f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Copyright (C) Intel Corp. 2006. All Rights Reserved. 39f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to 49f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt develop this 3D driver. 59f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 69f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Permission is hereby granted, free of charge, to any person obtaining 79f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt a copy of this software and associated documentation files (the 89f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "Software"), to deal in the Software without restriction, including 99f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt without limitation the rights to use, copy, modify, merge, publish, 109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt distribute, sublicense, and/or sell copies of the Software, and to 119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt permit persons to whom the Software is furnished to do so, subject to 129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt the following conditions: 139f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt The above copyright notice and this permission notice (including the 159f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt next paragraph) shall be included in all copies or substantial 169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt portions of the Software. 179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt **********************************************************************/ 279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /* 289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * Authors: 299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * Keith Whitwell <keith@tungstengraphics.com> 309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 339f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#ifndef BRW_WM_H 349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_WM_H 359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 36f30de6964018619658439216cd8bf9371ee6256dEric Anholt#include <stdbool.h> 379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 38ec2b92f98c2e7f161521b447cc1d9a36bce3707cBrian Paul#include "program/prog_instruction.h" 399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_context.h" 409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_eu.h" 411b05fc7cdd0e5d77b50bc8ee2f2c851da5884d72Kenneth Graunke#include "brw_program.h" 429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 4357d16c4cc37689710f951cb13981e2efc160cd23Eric Anholt#define SATURATE (1<<5) 4457d16c4cc37689710f951cb13981e2efc160cd23Eric Anholt 459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* A big lookup table is used to figure out which and how many 469f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * additional regs will inserted before the main payload in the WM 479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * program execution. These mainly relate to depth and stencil 489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * processing and the early-depth-test optimization. 499f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define IZ_PS_KILL_ALPHATEST_BIT 0x1 519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define IZ_PS_COMPUTES_DEPTH_BIT 0x2 529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define IZ_DEPTH_WRITE_ENABLE_BIT 0x4 539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define IZ_DEPTH_TEST_ENABLE_BIT 0x8 549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define IZ_STENCIL_WRITE_ENABLE_BIT 0x10 559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define IZ_STENCIL_TEST_ENABLE_BIT 0x20 568e76ac070dfea5d151d31121af5c8ca1c99caeb0Eric Anholt#define IZ_BIT_MAX 0x40 579f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define AA_NEVER 0 599f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define AA_SOMETIMES 1 609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define AA_ALWAYS 2 619f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_prog_key { 63f7b3f40b70dc7dd602897d364011089047583c5dEric Anholt uint8_t iz_lookup; 6416f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholt GLuint stats_wm:1; 659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint flat_shade:1; 6608b42bc97d77ff1ea7eefe4ec57997b80fb9b458Eric Anholt GLuint nr_color_regions:5; 67f8a8f069ee2dae35470c6e2a681e5e110044e6feAnuj Phogat GLuint sample_alpha_to_coverage:1; 683b337f5cd94384d2d5918fb630aa8089e49b1d8dEric Anholt GLuint render_to_fbo:1; 69d22e2ebe35ef9d33ec5f7a67f903f36bcd9fbc91Eric Anholt GLuint clamp_fragment_color:1; 70f7b3f40b70dc7dd602897d364011089047583c5dEric Anholt GLuint line_aa:2; 713b337f5cd94384d2d5918fb630aa8089e49b1d8dEric Anholt 726b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul GLbitfield proj_attrib_mask; /**< one bit per fragment program attribute */ 739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 74035b21f365f563cba9bf9b8cb4fef613ceb9d3acBrian Paul GLushort drawable_height; 755606dfb572bf4b89b4882265924705bacc8c182bIan Romanick GLbitfield64 vp_outputs_written; 7692d35b91f132deda1fb27d2071a50e8187301fe5Eric Anholt GLuint program_string_id:32; 771b05fc7cdd0e5d77b50bc8ee2f2c851da5884d72Kenneth Graunke 781b05fc7cdd0e5d77b50bc8ee2f2c851da5884d72Kenneth Graunke struct brw_sampler_prog_key_data tex; 799f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 809f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 819f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 829f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* A bit of a glossary: 839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * 849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * brw_wm_value: A computed value or program input. Values are 859f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * constant, they are created once and are never modified. When a 869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * fragment program register is written or overwritten, new values are 879f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * created fresh, preserving the rule that values are constant. 889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * 899f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * brw_wm_ref: A reference to a value. Wherever a value used is by an 909f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * instruction or as a program output, that is tracked with an 919f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * instance of this struct. All references to a value occur after it 929f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * is created. After the last reference, a value is dead and can be 939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * discarded. 949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * 959f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * brw_wm_grf: Represents a physical hardware register. May be either 969f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * empty or hold a value. Register allocation is the process of 979f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * assigning values to grf registers. This occurs in pass2 and the 989f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * brw_wm_grf struct is not used before that. 999f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * 1009f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * Fragment program registers: These are time-varying constructs that 1019f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * are hard to reason about and which we translate away in pass0. A 1029f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * single fragment program register element (eg. temp[0].x) will be 1039f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * translated to one or more brw_wm_value structs, one for each time 1049f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * that temp[0].x is written to during the program. 1059f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 1069f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1079f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1089f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1099f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* Used in pass2 to track register allocation. 1109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 1119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_grf { 1129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value *value; 1139f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nextuse; 1149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 1159f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_value { 1179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_reg hw_reg; /* emitted to this reg, may not always be there */ 1189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_ref *lastuse; 1199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_grf *resident; 1209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint contributes_to_output:1; 1219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint spill_slot:16; /* if non-zero, spill immediately after calculation */ 1229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 1239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_ref { 1259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_reg hw_reg; /* nr filled in in pass2, everything else, pass0 */ 1269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value *value; 1279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_ref *prevuse; 1289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint unspill_reg:7; /* unspill to reg */ 1299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint emitted:1; 1309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint insn:24; 1319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 1329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1339f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_constref { 1349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt const struct brw_wm_ref *ref; 1359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLfloat constval; 1369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 1379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_instruction { 1409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value *dst[4]; 1419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_ref *src[3][4]; 1429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint opcode:8; 1439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint saturate:1; 1449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint writemask:4; 1459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint tex_unit:4; /* texture unit for TEX, TXD, TXP instructions */ 1461ab1b15e9d0da1c5215a20770735b5477f5313dfChia-I Wu GLuint tex_idx:4; /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */ 147e0d907308150b4863cc4f24543e70e14207e966aBrian Paul GLuint tex_shadow:1; /* do shadow comparison? */ 148fcb7cb9e72ecac7c165a3a6ed7a033e2e6793a26Zou Nan hai GLuint eot:1; /* End of thread indicator for FB_WRITE*/ 149fcb7cb9e72ecac7c165a3a6ed7a033e2e6793a26Zou Nan hai GLuint target:10; /* target binding table index for FB_WRITE*/ 1509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 1519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1532c30ee9bd69ed606b984c051748a7cdb34905eebEric Anholt#define BRW_WM_MAX_INSN (MAX_PROGRAM_INSTRUCTIONS*3 + FRAG_ATTRIB_MAX + 3) 1549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_WM_MAX_GRF 128 /* hardware limit */ 1559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_WM_MAX_VREG (BRW_WM_MAX_INSN * 4) 1569f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_WM_MAX_REF (BRW_WM_MAX_INSN * 12) 1579f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_WM_MAX_PARAM 256 1589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_WM_MAX_CONST 256 159ab3e9c481f7517ffc63770dbb9c81fe559884a35Gary Wong#define BRW_WM_MAX_SUBROUTINE 16 1609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1610f34cdf6210b748db77c5eba2993637f4af6faebEric Anholt/* used in masks next to WRITEMASK_*. */ 1620f34cdf6210b748db77c5eba2993637f4af6faebEric Anholt#define SATURATE (1<<5) 1639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* New opcodes to track internal operations required for WM unit. 1669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * These are added early so that the registers used can be tracked, 1679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * freed and reused like those of other instructions. 1689f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 1699f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_PIXELXY (MAX_OPCODE) 1709f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_DELTAXY (MAX_OPCODE + 1) 1719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_PIXELW (MAX_OPCODE + 2) 1729f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_LINTERP (MAX_OPCODE + 3) 1739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_PINTERP (MAX_OPCODE + 4) 1749f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_CINTERP (MAX_OPCODE + 5) 1759f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_WPOSXY (MAX_OPCODE + 6) 1769f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define WM_FB_WRITE (MAX_OPCODE + 7) 177699db6d842c52d0b3b98b320f8ef1104a65fa783Eric Anholt#define WM_FRONTFACING (MAX_OPCODE + 8) 178699db6d842c52d0b3b98b320f8ef1104a65fa783Eric Anholt#define MAX_WM_OPCODE (MAX_OPCODE + 9) 1799f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1809f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define PROGRAM_PAYLOAD (PROGRAM_FILE_MAX) 181ef8e002c75a5def2c400638336dcd55d411d87beEric Anholt#define NUM_FILES (PROGRAM_PAYLOAD + 1) 182ef8e002c75a5def2c400638336dcd55d411d87beEric Anholt 1839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define PAYLOAD_DEPTH (FRAG_ATTRIB_MAX) 184a66e9a4d86d227b65874c43fbf9e299c7a26389fEric Anholt#define PAYLOAD_W (FRAG_ATTRIB_MAX + 1) 185a66e9a4d86d227b65874c43fbf9e299c7a26389fEric Anholt#define PAYLOAD_FP_REG_MAX (FRAG_ATTRIB_MAX + 2) 1869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1879f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_wm_compile { 1889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_compile func; 1899f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_prog_key key; 1909f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_prog_data prog_data; 1919f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1929f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_fragment_program *fp; 1939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLfloat (*env_param)[4]; 1959f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1969f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt enum { 1979f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt START, 1989f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt PASS2_DONE 1999f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } state; 2009f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 20103b2e0fcdf92c76411a957c3ea898233fb4ce1beEric Anholt uint8_t source_depth_reg; 20203b2e0fcdf92c76411a957c3ea898233fb4ce1beEric Anholt uint8_t source_w_reg; 20303b2e0fcdf92c76411a957c3ea898233fb4ce1beEric Anholt uint8_t aa_dest_stencil_reg; 20403b2e0fcdf92c76411a957c3ea898233fb4ce1beEric Anholt uint8_t dest_depth_reg; 205e04bdeae82797dbdcf6f544a997a4626fdfd4aeePaul Berry uint8_t barycentric_coord_reg[BRW_WM_BARYCENTRIC_INTERP_MODE_COUNT]; 20603b2e0fcdf92c76411a957c3ea898233fb4ce1beEric Anholt uint8_t nr_payload_regs; 20716f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholt GLuint computes_depth:1; /* could be derived from program string */ 20816f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholt GLuint source_depth_to_render_target:1; 20916f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholt GLuint runtime_check_aads_emit:1; 21016f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholt 2119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /* Initial pass - translate fp instructions to fp instructions, 2129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * simplifying and adding instructions for interpolation and 2139f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * framebuffer writes. 2149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 215c5413839b3e99c7b162f1260142f3c175502b0ceEric Anholt struct prog_instruction *prog_instructions; 2169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nr_fp_insns; 2179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint fp_temp; 2189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint fp_interp_emitted; 2199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct prog_src_register pixel_xy; 2219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct prog_src_register delta_xy; 2229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct prog_src_register pixel_w; 2239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 225c5413839b3e99c7b162f1260142f3c175502b0ceEric Anholt struct brw_wm_value *vreg; 2269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nr_vreg; 2279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value creg[BRW_WM_MAX_PARAM]; 2299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nr_creg; 2309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct { 2329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value depth[4]; /* includes r0/r1 */ 2339f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value input_interp[FRAG_ATTRIB_MAX]; 2349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } payload; 2359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 237ef8e002c75a5def2c400638336dcd55d411d87beEric Anholt const struct brw_wm_ref *pass0_fp_reg[NUM_FILES][256][4]; 2389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_ref undef_ref; 2409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value undef_value; 2419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 242c5413839b3e99c7b162f1260142f3c175502b0ceEric Anholt struct brw_wm_ref *refs; 2439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nr_refs; 2449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 245c5413839b3e99c7b162f1260142f3c175502b0ceEric Anholt struct brw_wm_instruction *instruction; 2469f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nr_insns; 2479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_constref constref[BRW_WM_MAX_CONST]; 2499f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint nr_constrefs; 2509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_grf pass2_grf[BRW_WM_MAX_GRF/2]; 2529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint grf_limit; 2549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint max_wm_grf; 2559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint last_scratch; 256d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai 257b58b3a786aa38dcc9d72144c2cc691151e46e3d5Brian Paul GLuint cur_inst; /**< index of current instruction */ 258b58b3a786aa38dcc9d72144c2cc691151e46e3d5Brian Paul 2592e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool out_of_regs; /**< ran out of GRF registers? */ 260e2cf522de09bc4afa18ef8d98db69973ee489d58Brian Paul 261faae1994c97746a74f68abeeafd69b27f9651d19Brian Paul /** Mapping from Mesa registers to hardware registers */ 262d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai struct { 2632e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool inited; 264bf28b576cb6aa403b840d8254a1ff3f31d664b46Brian Paul struct brw_reg reg; 265ef8e002c75a5def2c400638336dcd55d411d87beEric Anholt } wm_regs[NUM_FILES][256][4]; 266faae1994c97746a74f68abeeafd69b27f9651d19Brian Paul 2672e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool used_grf[BRW_WM_MAX_GRF]; 268b58b3a786aa38dcc9d72144c2cc691151e46e3d5Brian Paul GLuint first_free_grf; 2694087c90effecdf2f466e2ddcf88ec2faf0db034fZou Nan hai struct brw_reg stack; 270575f3e918f00bdc0faa4a173820015b24175696fZou Nan hai struct brw_reg emit_mask_reg; 271e92a457ac0030e48f5260dc2ac00ca283be7d7adGary Wong GLuint tmp_regs[BRW_WM_MAX_GRF]; 272d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai GLuint tmp_index; 273e92a457ac0030e48f5260dc2ac00ca283be7d7adGary Wong GLuint tmp_max; 274ab3e9c481f7517ffc63770dbb9c81fe559884a35Gary Wong GLuint subroutines[BRW_WM_MAX_SUBROUTINE]; 2750eb819a2d175cab139f8c672b6d44148b2c99a4eEric Anholt GLuint dispatch_width; 2761e299ff828e808cbb1d92d9fedd528a3a8a3609eBrian Paul 2771e299ff828e808cbb1d92d9fedd528a3a8a3609eBrian Paul /** we may need up to 3 constants per instruction (if use_const_buffer) */ 2781e299ff828e808cbb1d92d9fedd528a3a8a3609eBrian Paul struct { 2791e299ff828e808cbb1d92d9fedd528a3a8a3609eBrian Paul GLint index; 2801e299ff828e808cbb1d92d9fedd528a3a8a3609eBrian Paul struct brw_reg reg; 2811e299ff828e808cbb1d92d9fedd528a3a8a3609eBrian Paul } current_const[3]; 2829f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 2839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 285a8d233e509a2c1aada7cd4e83b126ba06cb90565Brian Paul/** Bits for prog_instruction::Aux field */ 286a8d233e509a2c1aada7cd4e83b126ba06cb90565Brian Paul#define INST_AUX_EOT 0x1 287a8d233e509a2c1aada7cd4e83b126ba06cb90565Brian Paul#define INST_AUX_TARGET(T) (T << 1) 288a8d233e509a2c1aada7cd4e83b126ba06cb90565Brian Paul#define INST_AUX_GET_TARGET(AUX) ((AUX) >> 1) 289a8d233e509a2c1aada7cd4e83b126ba06cb90565Brian Paul 290a8d233e509a2c1aada7cd4e83b126ba06cb90565Brian Paul 2919f344b3e7d6e23674dd4747faec253f103563b36Eric AnholtGLuint brw_wm_nr_args( GLuint opcode ); 2929f344b3e7d6e23674dd4747faec253f103563b36Eric AnholtGLuint brw_wm_is_scalar_result( GLuint opcode ); 2939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_pass_fp( struct brw_wm_compile *c ); 2959f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_pass0( struct brw_wm_compile *c ); 2969f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_pass1( struct brw_wm_compile *c ); 2979f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_pass2( struct brw_wm_compile *c ); 2989f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_emit( struct brw_wm_compile *c ); 2992e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunkebool brw_wm_arg_can_be_immediate(enum prog_opcode, int arg); 3009f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_print_value( struct brw_wm_compile *c, 3019f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_value *value ); 3029f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 3039f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_print_ref( struct brw_wm_compile *c, 3049f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_ref *ref ); 3059f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 3069f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_print_insn( struct brw_wm_compile *c, 3079f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct brw_wm_instruction *inst ); 3089f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 3099f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_wm_print_program( struct brw_wm_compile *c, 3109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt const char *stage ); 3119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 31216f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholtvoid brw_wm_lookup_iz(struct intel_context *intel, 31316f8c823898fd71a3545457eacd2dc31ddeb3592Eric Anholt struct brw_wm_compile *c); 3149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 3158752764076e5b3f052a57e0134424a37bf2e9164Eric Anholtbool brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c, 3168752764076e5b3f052a57e0134424a37bf2e9164Eric Anholt struct gl_shader_program *prog); 317c51c822ee02cb47ddba46da668577d51b7c02831Brian Paul 31871af5080722afcbbb8a935138d95214ef7afe219Eric Anholt/* brw_wm_emit.c */ 31971af5080722afcbbb8a935138d95214ef7afe219Eric Anholtvoid emit_alu1(struct brw_compile *p, 32071af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_instruction *(*func)(struct brw_compile *, 32171af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_reg, 32271af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_reg), 32371af5080722afcbbb8a935138d95214ef7afe219Eric Anholt const struct brw_reg *dst, 32471af5080722afcbbb8a935138d95214ef7afe219Eric Anholt GLuint mask, 32571af5080722afcbbb8a935138d95214ef7afe219Eric Anholt const struct brw_reg *arg0); 32671af5080722afcbbb8a935138d95214ef7afe219Eric Anholtvoid emit_alu2(struct brw_compile *p, 32771af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_instruction *(*func)(struct brw_compile *, 32871af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_reg, 32971af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_reg, 33071af5080722afcbbb8a935138d95214ef7afe219Eric Anholt struct brw_reg), 33171af5080722afcbbb8a935138d95214ef7afe219Eric Anholt const struct brw_reg *dst, 33271af5080722afcbbb8a935138d95214ef7afe219Eric Anholt GLuint mask, 33371af5080722afcbbb8a935138d95214ef7afe219Eric Anholt const struct brw_reg *arg0, 33471af5080722afcbbb8a935138d95214ef7afe219Eric Anholt const struct brw_reg *arg1); 3352b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_cinterp(struct brw_compile *p, 3362b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 3372b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask, 3382b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *arg0); 33948dca99feb394febc3af44e14f23fb12a9cc9204Eric Anholtvoid emit_cmp(struct brw_compile *p, 34048dca99feb394febc3af44e14f23fb12a9cc9204Eric Anholt const struct brw_reg *dst, 34148dca99feb394febc3af44e14f23fb12a9cc9204Eric Anholt GLuint mask, 34248dca99feb394febc3af44e14f23fb12a9cc9204Eric Anholt const struct brw_reg *arg0, 34348dca99feb394febc3af44e14f23fb12a9cc9204Eric Anholt const struct brw_reg *arg1, 34448dca99feb394febc3af44e14f23fb12a9cc9204Eric Anholt const struct brw_reg *arg2); 34557d16c4cc37689710f951cb13981e2efc160cd23Eric Anholtvoid emit_ddxy(struct brw_compile *p, 34657d16c4cc37689710f951cb13981e2efc160cd23Eric Anholt const struct brw_reg *dst, 34757d16c4cc37689710f951cb13981e2efc160cd23Eric Anholt GLuint mask, 3482e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool is_ddx, 34982d25963a838cfebdeb9b080169979329ee850eaPaul Berry const struct brw_reg *arg0, 35082d25963a838cfebdeb9b080169979329ee850eaPaul Berry bool negate_value); 3512b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_delta_xy(struct brw_compile *p, 3522b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 3532b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask, 3542b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *arg0); 3554e7d5d0e74c26cac182cea1be0f6b79bb664ad8cEric Anholtvoid emit_dp2(struct brw_compile *p, 3564e7d5d0e74c26cac182cea1be0f6b79bb664ad8cEric Anholt const struct brw_reg *dst, 3574e7d5d0e74c26cac182cea1be0f6b79bb664ad8cEric Anholt GLuint mask, 3584e7d5d0e74c26cac182cea1be0f6b79bb664ad8cEric Anholt const struct brw_reg *arg0, 3594e7d5d0e74c26cac182cea1be0f6b79bb664ad8cEric Anholt const struct brw_reg *arg1); 360bad5b120be8de37cf8481d865790298fd9651381Eric Anholtvoid emit_dp3(struct brw_compile *p, 361bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *dst, 362bad5b120be8de37cf8481d865790298fd9651381Eric Anholt GLuint mask, 363bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *arg0, 364bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *arg1); 365bad5b120be8de37cf8481d865790298fd9651381Eric Anholtvoid emit_dp4(struct brw_compile *p, 366bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *dst, 367bad5b120be8de37cf8481d865790298fd9651381Eric Anholt GLuint mask, 368bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *arg0, 369bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *arg1); 370bad5b120be8de37cf8481d865790298fd9651381Eric Anholtvoid emit_dph(struct brw_compile *p, 371bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *dst, 372bad5b120be8de37cf8481d865790298fd9651381Eric Anholt GLuint mask, 373bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *arg0, 374bad5b120be8de37cf8481d865790298fd9651381Eric Anholt const struct brw_reg *arg1); 375cfa927766ab610a9a76730d337d77008d876ebbdEric Anholtvoid emit_fb_write(struct brw_wm_compile *c, 376cfa927766ab610a9a76730d337d77008d876ebbdEric Anholt struct brw_reg *arg0, 377cfa927766ab610a9a76730d337d77008d876ebbdEric Anholt struct brw_reg *arg1, 378cfa927766ab610a9a76730d337d77008d876ebbdEric Anholt struct brw_reg *arg2, 379cfa927766ab610a9a76730d337d77008d876ebbdEric Anholt GLuint target, 380cfa927766ab610a9a76730d337d77008d876ebbdEric Anholt GLuint eot); 3812b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_frontfacing(struct brw_compile *p, 3822b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 3832b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask); 3842b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_linterp(struct brw_compile *p, 3852b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 3862b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask, 3872b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *arg0, 3882b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *deltas); 38906c1bc8a2222f00e5a51fa977130a719bdcd8f0bEric Anholtvoid emit_lrp(struct brw_compile *p, 39006c1bc8a2222f00e5a51fa977130a719bdcd8f0bEric Anholt const struct brw_reg *dst, 39106c1bc8a2222f00e5a51fa977130a719bdcd8f0bEric Anholt GLuint mask, 39206c1bc8a2222f00e5a51fa977130a719bdcd8f0bEric Anholt const struct brw_reg *arg0, 39306c1bc8a2222f00e5a51fa977130a719bdcd8f0bEric Anholt const struct brw_reg *arg1, 39406c1bc8a2222f00e5a51fa977130a719bdcd8f0bEric Anholt const struct brw_reg *arg2); 395726ad1560660a1fc769c87e0ea16f8b3334df0d2Eric Anholtvoid emit_mad(struct brw_compile *p, 396726ad1560660a1fc769c87e0ea16f8b3334df0d2Eric Anholt const struct brw_reg *dst, 397726ad1560660a1fc769c87e0ea16f8b3334df0d2Eric Anholt GLuint mask, 398726ad1560660a1fc769c87e0ea16f8b3334df0d2Eric Anholt const struct brw_reg *arg0, 399726ad1560660a1fc769c87e0ea16f8b3334df0d2Eric Anholt const struct brw_reg *arg1, 400726ad1560660a1fc769c87e0ea16f8b3334df0d2Eric Anholt const struct brw_reg *arg2); 4011e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholtvoid emit_math1(struct brw_wm_compile *c, 4021e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt GLuint function, 4031e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *dst, 4041e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt GLuint mask, 4051e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *arg0); 4061e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholtvoid emit_math2(struct brw_wm_compile *c, 4071e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt GLuint function, 4081e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *dst, 4091e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt GLuint mask, 4101e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *arg0, 4111e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *arg1); 412ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholtvoid emit_min(struct brw_compile *p, 413ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt const struct brw_reg *dst, 414ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt GLuint mask, 415ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt const struct brw_reg *arg0, 416ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt const struct brw_reg *arg1); 417ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholtvoid emit_max(struct brw_compile *p, 418ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt const struct brw_reg *dst, 419ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt GLuint mask, 420ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt const struct brw_reg *arg0, 421ec66644ed0af976cacb069ca7c7f0d6731666359Eric Anholt const struct brw_reg *arg1); 4222b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_pinterp(struct brw_compile *p, 4232b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 4242b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask, 4252b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *arg0, 4262b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *deltas, 4272b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *w); 4282b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_pixel_xy(struct brw_wm_compile *c, 4292b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 4302b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask); 4312b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_pixel_w(struct brw_wm_compile *c, 4322b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 4332b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask, 4342b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *arg0, 4352b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *deltas); 4367059aa0eff9ff6ec361e584b413f63b25762a89cEric Anholtvoid emit_sop(struct brw_compile *p, 4377059aa0eff9ff6ec361e584b413f63b25762a89cEric Anholt const struct brw_reg *dst, 4387059aa0eff9ff6ec361e584b413f63b25762a89cEric Anholt GLuint mask, 4397059aa0eff9ff6ec361e584b413f63b25762a89cEric Anholt GLuint cond, 4407059aa0eff9ff6ec361e584b413f63b25762a89cEric Anholt const struct brw_reg *arg0, 4417059aa0eff9ff6ec361e584b413f63b25762a89cEric Anholt const struct brw_reg *arg1); 442e558786a3ed52222c07f916e213b63dcba1890a2Eric Anholtvoid emit_sign(struct brw_compile *p, 443e558786a3ed52222c07f916e213b63dcba1890a2Eric Anholt const struct brw_reg *dst, 444e558786a3ed52222c07f916e213b63dcba1890a2Eric Anholt GLuint mask, 445e558786a3ed52222c07f916e213b63dcba1890a2Eric Anholt const struct brw_reg *arg0); 4461be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholtvoid emit_tex(struct brw_wm_compile *c, 4471be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholt struct brw_reg *dst, 4481be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholt GLuint dst_flags, 4491be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholt struct brw_reg *arg, 4501be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholt struct brw_reg depth_payload, 4511be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholt GLuint tex_idx, 4521be0efcbdc74f9a84136c9d1f953755c1560e52eEric Anholt GLuint sampler, 4532e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool shadow); 45457f40b18377f87c434f17d5670a13838d58065c9Eric Anholtvoid emit_txb(struct brw_wm_compile *c, 45557f40b18377f87c434f17d5670a13838d58065c9Eric Anholt struct brw_reg *dst, 45657f40b18377f87c434f17d5670a13838d58065c9Eric Anholt GLuint dst_flags, 45757f40b18377f87c434f17d5670a13838d58065c9Eric Anholt struct brw_reg *arg, 45857f40b18377f87c434f17d5670a13838d58065c9Eric Anholt struct brw_reg depth_payload, 45957f40b18377f87c434f17d5670a13838d58065c9Eric Anholt GLuint tex_idx, 46057f40b18377f87c434f17d5670a13838d58065c9Eric Anholt GLuint sampler); 4612b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholtvoid emit_wpos_xy(struct brw_wm_compile *c, 4622b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *dst, 4632b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt GLuint mask, 4642b58c31257f8900067276b6d6537bb2ce54b1b10Eric Anholt const struct brw_reg *arg0); 4651e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholtvoid emit_xpd(struct brw_compile *p, 4661e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *dst, 4671e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt GLuint mask, 4681e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *arg0, 4691e5400c575b72fbde16ef0d55fd3ba577fc1b6a5Eric Anholt const struct brw_reg *arg1); 470c51c822ee02cb47ddba46da668577d51b7c02831Brian Paul 471f9995b30756140724f41daf963fa06167912be7fKristian HøgsbergGLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); 472f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergstruct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type); 473f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergstruct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name); 474a1bebf73dfdaf2cd23286aa74271b87166589901Eric Anholt 475f30de6964018619658439216cd8bf9371ee6256dEric Anholtbool brw_color_buffer_write_enabled(struct brw_context *brw); 476796f44d77906342e5912e7da6bdba1ba86bab9f0Eric Anholtbool brw_render_target_supported(struct intel_context *intel, 477796f44d77906342e5912e7da6bdba1ba86bab9f0Eric Anholt struct gl_renderbuffer *rb); 478662f1b48bd1a02907bb42ecda889a3aa52a5755dEric Anholtvoid brw_wm_payload_setup(struct brw_context *brw, 479662f1b48bd1a02907bb42ecda889a3aa52a5755dEric Anholt struct brw_wm_compile *c); 4808752764076e5b3f052a57e0134424a37bf2e9164Eric Anholtbool do_wm_prog(struct brw_context *brw, 4818752764076e5b3f052a57e0134424a37bf2e9164Eric Anholt struct gl_shader_program *prog, 4828752764076e5b3f052a57e0134424a37bf2e9164Eric Anholt struct brw_fragment_program *fp, 4838752764076e5b3f052a57e0134424a37bf2e9164Eric Anholt struct brw_wm_prog_key *key); 484fc3b7c9b56701f23b002543de33a8d8c43f9bdc2Eric Anholtvoid brw_wm_debug_recompile(struct brw_context *brw, 485fc3b7c9b56701f23b002543de33a8d8c43f9bdc2Eric Anholt struct gl_shader_program *prog, 486fc3b7c9b56701f23b002543de33a8d8c43f9bdc2Eric Anholt const struct brw_wm_prog_key *key); 487f30de6964018619658439216cd8bf9371ee6256dEric Anholt 4889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#endif 489