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 33ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/macros.h" 34064ae479a770bf434958d673baf6f7530f642697Brian#include "brw_context.h" 359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_vs.h" 369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* Component is active if it may diverge from [0,0,0,1]. Undef values 389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * are promoted to [0,0,0,1] for the purposes of this analysis. 399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct tracker { 412e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool twoside; 426b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul GLubyte active[PROGRAM_OUTPUT+1][MAX_PROGRAM_TEMPS]; 436b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul GLbitfield size_masks[4]; /**< one bit per fragment program input attrib */ 449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 469f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic void set_active_component( struct tracker *t, 489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint file, 499f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint index, 509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLubyte active ) 519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt switch (file) { 539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case PROGRAM_TEMPORARY: 549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case PROGRAM_INPUT: 559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case PROGRAM_OUTPUT: 566b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul assert(file < PROGRAM_OUTPUT + 1); 576b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul assert(index < Elements(t->active[0])); 589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt t->active[file][index] |= active; 596b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul break; 609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt default: 619f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt break; 629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic void set_active( struct tracker *t, 669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct prog_dst_register dst, 679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint active ) 689f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 699f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt set_active_component( t, dst.File, dst.Index, active & dst.WriteMask ); 709f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 729f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic GLubyte get_active_component( struct tracker *t, 749f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint file, 759f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint index, 769f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint component, 779f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLubyte swz ) 789f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 799f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt switch (swz) { 809f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case SWIZZLE_ZERO: 819f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return component < 3 ? 0 : (1<<component); 829f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case SWIZZLE_ONE: 839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return component == 3 ? 0 : (1<<component); 849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt default: 859f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt switch (file) { 869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case PROGRAM_TEMPORARY: 879f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case PROGRAM_INPUT: 889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case PROGRAM_OUTPUT: 899f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return t->active[file][index] & (1<<component); 909f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt default: 919f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return 1 << component; 929f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 959f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 969f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 979f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic GLubyte get_active( struct tracker *t, 989f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct prog_src_register src ) 999f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 1009f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint i; 1017db7ff878d3e5a6b345228e6eaee4797bb68b360Brian Paul GLubyte active = src.Negate; /* NOTE! */ 1029f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1039f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (src.RelAddr) 1049f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return 0xf; 1059f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1069f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt for (i = 0; i < 4; i++) 1079f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt active |= get_active_component(t, src.File, src.Index, i, 1089f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GET_SWZ(src.Swizzle, i)); 1099f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return active; 1119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 1129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1136b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul/** 1146b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul * Return the size (1,2,3 or 4) of the output/result for VERT_RESULT_idx. 1156b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul */ 1169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic GLubyte get_output_size( struct tracker *t, 1179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint idx ) 1189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 1196b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul GLubyte active; 1206b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul assert(idx < VERT_RESULT_MAX); 1216b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul active = t->active[PROGRAM_OUTPUT][idx]; 1229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (active & (1<<3)) return 4; 1239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (active & (1<<2)) return 3; 1249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (active & (1<<1)) return 2; 1259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (active & (1<<0)) return 1; 1269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return 0; 1279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 1289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* Note the potential copying that occurs in the setup program: 1309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 1319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic void calc_sizes( struct tracker *t ) 1329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 1336b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul GLint vertRes; 1349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (t->twoside) { 1369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt t->active[PROGRAM_OUTPUT][VERT_RESULT_COL0] |= 1379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt t->active[PROGRAM_OUTPUT][VERT_RESULT_BFC0]; 1389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt t->active[PROGRAM_OUTPUT][VERT_RESULT_COL1] |= 1409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt t->active[PROGRAM_OUTPUT][VERT_RESULT_BFC1]; 1419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 1429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1436b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul /* Examine vertex program output sizes to set the size_masks[] info 1446b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul * which describes the fragment program input sizes. 1456b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul */ 146d707e337f5f9a7b6ed465ade1b0b7c06606dde22Eric Anholt for (vertRes = 0; vertRes < VERT_RESULT_MAX; vertRes++) { 1476b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul 1486b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul /* map vertex program output index to fragment program input index */ 14951e7b058750cc480c296d45f773d7a5a662457f5Brian Paul GLint fragAttrib = _mesa_vert_result_to_frag_attrib(vertRes); 1506489a1d5bab75589569658d374257bf23cb67a23Paul Berry if (fragAttrib < 0) 1516b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul continue; 1526b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul 1536b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul switch (get_output_size(t, vertRes)) { 1546b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul case 4: t->size_masks[4-1] |= 1 << fragAttrib; 1556b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul case 3: t->size_masks[3-1] |= 1 << fragAttrib; 1566b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul case 2: t->size_masks[2-1] |= 1 << fragAttrib; 1576b917d0b1787280f976c2f0d1ead0e5d7587a3e9Brian Paul case 1: t->size_masks[1-1] |= 1 << fragAttrib; 1589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt break; 1599f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 1609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 1619f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 1629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic GLubyte szflag[4+1] = { 1649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 0, 1659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 0x1, 1669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 0x3, 1679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 0x7, 1689f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 0xf 1699f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 1709f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* Pull a size out of the packed array: 1729f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 1739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstatic GLuint get_input_size(struct brw_context *brw, 1749f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint attr) 1759f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 1769f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint sizes_dword = brw->vb.info.sizes[attr/16]; 1779f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint sizes_bits = (sizes_dword>>((attr%16)*2)) & 0x3; 1789f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt return sizes_bits + 1; 179f2eb6434ab1cf72e938956c82d2f530368a6be4aKeith Whitwell/* return brw->vb.inputs[attr].glarray->Size; */ 1809f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 1819f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1829f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* Calculate sizes of vertex program outputs. Size is the largest 1839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * component index which might vary from [0,0,0,1] 1849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 185f75843a517bd188639e6866db2a7b04de3524e16Dave Airliestatic void calc_wm_input_sizes( struct brw_context *brw ) 1869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 187f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg struct gl_context *ctx = &brw->intel.ctx; 1889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /* BRW_NEW_VERTEX_PROGRAM */ 1899c781de015f32b2caadd5a6d999cc6885188a4a4Brian Paul const struct brw_vertex_program *vp = 1909c781de015f32b2caadd5a6d999cc6885188a4a4Brian Paul brw_vertex_program_const(brw->vertex_program); 1919f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /* BRW_NEW_INPUT_DIMENSIONS */ 1929f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct tracker t; 1939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint insn; 1949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt GLuint i; 1959f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 196efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick /* Mesa IR is not generated for GLSL vertex shaders. If there's no Mesa 197efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick * IR, the code below cannot determine which output components are 198efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick * written. So, skip it and assume everything is written. This 199efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick * circumvents some optimizations in the fragment shader, but it guarantees 200efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick * that correct code is generated. 201efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick */ 202efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick if (vp->program.Base.NumInstructions == 0) { 203efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick brw->wm.input_size_masks[0] = ~0; 204efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick brw->wm.input_size_masks[1] = ~0; 205efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick brw->wm.input_size_masks[2] = ~0; 206efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick brw->wm.input_size_masks[3] = ~0; 207efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick return; 208efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick } 209efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick 210efdc8bf1894790a85c118881395a998cbae34c1aIan Romanick 2119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt memset(&t, 0, sizeof(t)); 2129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 213447c488d77ea9710e0ffc238953917189d3000c7Eric Anholt /* _NEW_LIGHT | _NEW_PROGRAM */ 214447c488d77ea9710e0ffc238953917189d3000c7Eric Anholt if (ctx->VertexProgram._TwoSideEnabled) 2159f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt t.twoside = 1; 2169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 217f2eb6434ab1cf72e938956c82d2f530368a6be4aKeith Whitwell for (i = 0; i < VERT_ATTRIB_MAX; i++) 218dca6a28a14f22d77273d79d44f57b0d853c0242dMathias Fröhlich if (vp->program.Base.InputsRead & BITFIELD64_BIT(i)) 2199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt set_active_component(&t, PROGRAM_INPUT, i, 2209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt szflag[get_input_size(brw, i)]); 2219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt for (insn = 0; insn < vp->program.Base.NumInstructions; insn++) { 2239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt struct prog_instruction *inst = &vp->program.Base.Instructions[insn]; 2249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt switch (inst->Opcode) { 2269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case OPCODE_ARL: 2279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt break; 2289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt case OPCODE_MOV: 2309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt set_active(&t, inst->DstReg, get_active(&t, inst->SrcReg[0])); 2319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt break; 2329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2339f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt default: 2349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt set_active(&t, inst->DstReg, 0xf); 2359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt break; 2369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 2379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 2389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt calc_sizes(&t); 2409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (memcmp(brw->wm.input_size_masks, t.size_masks, sizeof(t.size_masks)) != 0) { 2429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt memcpy(brw->wm.input_size_masks, t.size_masks, sizeof(t.size_masks)); 2439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt brw->state.dirty.brw |= BRW_NEW_WM_INPUT_DIMENSIONS; 2449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 2459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 2469f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 2479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtconst struct brw_tracked_state brw_wm_input_sizes = { 2489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt .dirty = { 249447c488d77ea9710e0ffc238953917189d3000c7Eric Anholt .mesa = _NEW_LIGHT | _NEW_PROGRAM, 250652ef8569c923cf8e1e254dddc160c7995d258aaEric Anholt .brw = BRW_NEW_VERTEX_PROGRAM | BRW_NEW_INPUT_DIMENSIONS, 2519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt .cache = 0 2529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt }, 253bf11c9e4c1be307add4bb9355e6c0b5f4c44629fEric Anholt .emit = calc_wm_input_sizes 2549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt}; 2559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 256