From: Kenneth Graunke Date: Wed, 13 Mar 2013 04:12:08 +0000 (-0700) Subject: i965: Delete brw_vs_constval.c and the brw_wm_input_sizes atom. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d198546bac26256d92d6d4e1f2b0b12206416881;p=mesa.git i965: Delete brw_vs_constval.c and the brw_wm_input_sizes atom. This was only used to compute proj_attrib_mask, which was removed by the previous commit. That makes this dead code. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources index 59bf7b71abc..be8d630e85e 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -91,7 +91,6 @@ i965_FILES = \ brw_vec4_visitor.cpp \ brw_vec4_vp.cpp \ brw_vs.c \ - brw_vs_constval.c \ brw_vs_state.c \ brw_vs_surface_state.c \ brw_vtbl.c \ diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index ea5b62a2436..32ff30efe58 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1002,11 +1002,6 @@ struct brw_context struct { struct brw_wm_prog_data *prog_data; - /** Input sizes, calculated from active vertex program. - * One bit per fragment program input attribute. - */ - GLbitfield64 input_size_masks[4]; - /** offsets in the batch to sampler default colors (texture border color) */ uint32_t sdc_offset[BRW_MAX_TEX_UNIT]; diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 0914cdde7d0..9c956f85dc5 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -72,7 +72,6 @@ extern const struct brw_tracked_state brw_vertex_state; extern const struct brw_tracked_state brw_vs_prog; extern const struct brw_tracked_state brw_vs_ubo_surfaces; extern const struct brw_tracked_state brw_vs_unit; -extern const struct brw_tracked_state brw_wm_input_sizes; extern const struct brw_tracked_state brw_wm_prog; extern const struct brw_tracked_state brw_renderbuffer_surfaces; extern const struct brw_tracked_state brw_texture_surfaces; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 5c5c05e3efd..6488d407e1c 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -38,7 +38,6 @@ static const struct brw_tracked_state *gen4_atoms[] = { - &brw_wm_input_sizes, &brw_vs_prog, /* must do before GS prog, state base address. */ &brw_gs_prog, /* must do before state base address */ &brw_clip_prog, /* must do before state base address */ @@ -103,7 +102,6 @@ static const struct brw_tracked_state *gen4_atoms[] = static const struct brw_tracked_state *gen6_atoms[] = { - &brw_wm_input_sizes, &brw_vs_prog, /* must do before state base address */ &brw_gs_prog, /* must do before state base address */ &brw_wm_prog, /* must do before state base address */ @@ -175,7 +173,6 @@ static const struct brw_tracked_state *gen6_atoms[] = static const struct brw_tracked_state *gen7_atoms[] = { - &brw_wm_input_sizes, &brw_vs_prog, &brw_wm_prog, diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c deleted file mode 100644 index 13e8f70e381..00000000000 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - **********************************************************************/ - /* - * Authors: - * Keith Whitwell - */ - - -#include "main/macros.h" -#include "brw_context.h" -#include "brw_vs.h" - -/* Component is active if it may diverge from [0,0,0,1]. Undef values - * are promoted to [0,0,0,1] for the purposes of this analysis. - */ -struct tracker { - bool twoside; - GLubyte active[PROGRAM_OUTPUT+1][MAX_PROGRAM_TEMPS]; - GLbitfield64 size_masks[4]; /**< one bit per fragment program input attrib */ -}; - - -static void set_active_component( struct tracker *t, - GLuint file, - GLuint index, - GLubyte active ) -{ - switch (file) { - case PROGRAM_TEMPORARY: - case PROGRAM_INPUT: - case PROGRAM_OUTPUT: - assert(file < PROGRAM_OUTPUT + 1); - assert(index < Elements(t->active[0])); - t->active[file][index] |= active; - break; - default: - break; - } -} - -static void set_active( struct tracker *t, - struct prog_dst_register dst, - GLuint active ) -{ - set_active_component( t, dst.File, dst.Index, active & dst.WriteMask ); -} - - -static GLubyte get_active_component( struct tracker *t, - GLuint file, - GLuint index, - GLuint component, - GLubyte swz ) -{ - switch (swz) { - case SWIZZLE_ZERO: - return component < 3 ? 0 : (1<active[file][index] & (1<active[PROGRAM_OUTPUT][idx]; - if (active & (1<<3)) return 4; - if (active & (1<<2)) return 3; - if (active & (1<<1)) return 2; - if (active & (1<<0)) return 1; - return 0; -} - -/* Note the potential copying that occurs in the setup program: - */ -static void calc_sizes( struct tracker *t ) -{ - GLint vertRes; - - if (t->twoside) { - t->active[PROGRAM_OUTPUT][VARYING_SLOT_COL0] |= - t->active[PROGRAM_OUTPUT][VARYING_SLOT_BFC0]; - - t->active[PROGRAM_OUTPUT][VARYING_SLOT_COL1] |= - t->active[PROGRAM_OUTPUT][VARYING_SLOT_BFC1]; - } - - /* Examine vertex program output sizes to set the size_masks[] info - * which describes the fragment program input sizes. - */ - for (vertRes = 0; vertRes < VARYING_SLOT_MAX; vertRes++) { - if (!_mesa_varying_slot_in_fs(vertRes)) - continue; - - switch (get_output_size(t, vertRes)) { - case 4: t->size_masks[4-1] |= BITFIELD64_BIT(vertRes); - case 3: t->size_masks[3-1] |= BITFIELD64_BIT(vertRes); - case 2: t->size_masks[2-1] |= BITFIELD64_BIT(vertRes); - case 1: t->size_masks[1-1] |= BITFIELD64_BIT(vertRes); - break; - } - } -} - -static GLubyte szflag[4+1] = { - 0, - 0x1, - 0x3, - 0x7, - 0xf -}; - -/* Pull a size out of the packed array: - */ -static GLuint get_input_size(struct brw_context *brw, - GLuint attr) -{ - GLuint sizes_dword = brw->vb.info.sizes[attr/16]; - GLuint sizes_bits = (sizes_dword>>((attr%16)*2)) & 0x3; - return sizes_bits + 1; -/* return brw->vb.inputs[attr].glarray->Size; */ -} - -/* Calculate sizes of vertex program outputs. Size is the largest - * component index which might vary from [0,0,0,1] - */ -static void calc_wm_input_sizes( struct brw_context *brw ) -{ - struct gl_context *ctx = &brw->intel.ctx; - /* BRW_NEW_VERTEX_PROGRAM */ - const struct brw_vertex_program *vp = - brw_vertex_program_const(brw->vertex_program); - /* BRW_NEW_INPUT_DIMENSIONS */ - struct tracker t; - GLuint insn; - GLuint i; - - /* Mesa IR is not generated for GLSL vertex shaders. If there's no Mesa - * IR, the code below cannot determine which output components are - * written. So, skip it and assume everything is written. This - * circumvents some optimizations in the fragment shader, but it guarantees - * that correct code is generated. - */ - if (vp->program.Base.NumInstructions == 0) { - brw->wm.input_size_masks[0] = ~(GLbitfield64) 0; - brw->wm.input_size_masks[1] = ~(GLbitfield64) 0; - brw->wm.input_size_masks[2] = ~(GLbitfield64) 0; - brw->wm.input_size_masks[3] = ~(GLbitfield64) 0; - return; - } - - - memset(&t, 0, sizeof(t)); - - /* _NEW_LIGHT | _NEW_PROGRAM */ - if (ctx->VertexProgram._TwoSideEnabled) - t.twoside = 1; - - for (i = 0; i < VERT_ATTRIB_MAX; i++) - if (vp->program.Base.InputsRead & BITFIELD64_BIT(i)) - set_active_component(&t, PROGRAM_INPUT, i, - szflag[get_input_size(brw, i)]); - - for (insn = 0; insn < vp->program.Base.NumInstructions; insn++) { - struct prog_instruction *inst = &vp->program.Base.Instructions[insn]; - - switch (inst->Opcode) { - case OPCODE_ARL: - break; - - case OPCODE_MOV: - set_active(&t, inst->DstReg, get_active(&t, inst->SrcReg[0])); - break; - - default: - set_active(&t, inst->DstReg, 0xf); - break; - } - } - - calc_sizes(&t); - - /* _NEW_POINT - * - * If the SF will be replacing the vertex output with a reference to - * gl_PointCoord, then tell the fragment shader that the value actually - * does vary. - */ - if (ctx->Point.PointSprite) { - for (int i = 0; i < 8; i++) { - if (ctx->Point.CoordReplace[i]) { - t.size_masks[4-1] |= VARYING_BIT_TEX(i); - t.size_masks[3-1] |= VARYING_BIT_TEX(i); - t.size_masks[2-1] |= VARYING_BIT_TEX(i); - t.size_masks[1-1] |= VARYING_BIT_TEX(i); - } - } - } - - if (memcmp(brw->wm.input_size_masks, t.size_masks, sizeof(t.size_masks)) != 0) { - memcpy(brw->wm.input_size_masks, t.size_masks, sizeof(t.size_masks)); - brw->state.dirty.brw |= BRW_NEW_WM_INPUT_DIMENSIONS; - } -} - -const struct brw_tracked_state brw_wm_input_sizes = { - .dirty = { - .mesa = _NEW_LIGHT | _NEW_PROGRAM | _NEW_POINT, - .brw = BRW_NEW_VERTEX_PROGRAM | BRW_NEW_INPUT_DIMENSIONS, - .cache = 0 - }, - .emit = calc_wm_input_sizes -}; -