Browse Source

i965: Change fragment input related bitfields to 64-bit.

This patch updates the bitfields brw_context::wm.input_size_masks,
tracker::size_masks, and brw_wm_prog_key::proj_attrib_mask, all of
which are indexed by gl_frag_attrib, from 32-bit to 64-bit.

This paves the way for supporting geometry shaders, and for merging
the gl_frag_attrib and gl_vert_result enums.  The combination of these
two will require at least 55 bits in the bitfields.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
tags/mesa-9.2-rc1
Paul Berry 12 years ago
parent
commit
6bec74bfd9

+ 1
- 1
src/mesa/drivers/dri/i965/brw_context.h View File

@@ -986,7 +986,7 @@ struct brw_context
/** Input sizes, calculated from active vertex program.
* One bit per fragment program input attribute.
*/
GLbitfield input_size_masks[4];
GLbitfield64 input_size_masks[4];

/** offsets in the batch to sampler default colors (texture border color)
*/

+ 4
- 3
src/mesa/drivers/dri/i965/brw_fs.cpp View File

@@ -1044,7 +1044,8 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
*/
if (location >= FRAG_ATTRIB_TEX0 &&
location <= FRAG_ATTRIB_TEX7 &&
k == 3 && !(c->key.proj_attrib_mask & (1 << location))) {
k == 3 && !(c->key.proj_attrib_mask
& BITFIELD64_BIT(location))) {
emit(BRW_OPCODE_MOV, attr, fs_reg(1.0f));
} else {
struct brw_reg interp = interp_reg(location, k);
@@ -2987,7 +2988,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
}

if (prog->Name != 0)
key.proj_attrib_mask = 0xffffffff;
key.proj_attrib_mask = ~(GLbitfield64) 0;

if (intel->gen < 6)
key.vp_outputs_written |= BITFIELD64_BIT(FRAG_ATTRIB_WPOS);
@@ -2997,7 +2998,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
continue;

if (prog->Name == 0)
key.proj_attrib_mask |= 1 << i;
key.proj_attrib_mask |= BITFIELD64_BIT(i);

if (intel->gen < 6) {
int vp_index = _mesa_vert_result_to_frag_attrib((gl_vert_result) i);

+ 9
- 9
src/mesa/drivers/dri/i965/brw_vs_constval.c View File

@@ -40,7 +40,7 @@
struct tracker {
bool twoside;
GLubyte active[PROGRAM_OUTPUT+1][MAX_PROGRAM_TEMPS];
GLbitfield size_masks[4]; /**< one bit per fragment program input attrib */
GLbitfield64 size_masks[4]; /**< one bit per fragment program input attrib */
};


@@ -151,10 +151,10 @@ static void calc_sizes( struct tracker *t )
continue;

switch (get_output_size(t, vertRes)) {
case 4: t->size_masks[4-1] |= 1 << fragAttrib;
case 3: t->size_masks[3-1] |= 1 << fragAttrib;
case 2: t->size_masks[2-1] |= 1 << fragAttrib;
case 1: t->size_masks[1-1] |= 1 << fragAttrib;
case 4: t->size_masks[4-1] |= BITFIELD64_BIT(fragAttrib);
case 3: t->size_masks[3-1] |= BITFIELD64_BIT(fragAttrib);
case 2: t->size_masks[2-1] |= BITFIELD64_BIT(fragAttrib);
case 1: t->size_masks[1-1] |= BITFIELD64_BIT(fragAttrib);
break;
}
}
@@ -200,10 +200,10 @@ static void calc_wm_input_sizes( struct brw_context *brw )
* that correct code is generated.
*/
if (vp->program.Base.NumInstructions == 0) {
brw->wm.input_size_masks[0] = ~0;
brw->wm.input_size_masks[1] = ~0;
brw->wm.input_size_masks[2] = ~0;
brw->wm.input_size_masks[3] = ~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;
}


+ 1
- 1
src/mesa/drivers/dri/i965/brw_wm.c View File

@@ -428,7 +428,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
* useful for programs using shaders.
*/
if (ctx->Shader.CurrentFragmentProgram)
key->proj_attrib_mask = 0xffffffff;
key->proj_attrib_mask = ~(GLbitfield64) 0;
else
key->proj_attrib_mask = brw->wm.input_size_masks[4-1];


+ 1
- 1
src/mesa/drivers/dri/i965/brw_wm.h View File

@@ -67,7 +67,7 @@ struct brw_wm_prog_key {
GLuint clamp_fragment_color:1;
GLuint line_aa:2;

GLbitfield proj_attrib_mask; /**< one bit per fragment program attribute */
GLbitfield64 proj_attrib_mask; /**< one bit per fragment program attribute */

GLushort drawable_height;
GLbitfield64 vp_outputs_written;

Loading…
Cancel
Save