diff options
author | Timothy Arceri <[email protected]> | 2016-10-19 13:23:37 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-10-26 14:29:36 +1100 |
commit | 3423488d55b9c483fcdb3996eb89b424c1031d24 (patch) | |
tree | 270d90fe3fd4c090f2c8e59a3b20d0afe7d98e72 /src/mesa/state_tracker/st_program.c | |
parent | 17e28a1571b6141368fefc84cc8b0a3b4e52f8ee (diff) |
st/mesa/r200/i915/i965: eliminate gl_fragment_program
Here we move OriginUpperLeft and PixelCenterInteger into gl_program
all other fields have been replace by shader_info.
V2: Don't use anonymous union/structs to hold vertex/fragment fields
suggested by Ian.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 31cfbca9eac..09e8d43479d 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -586,9 +586,9 @@ st_translate_fragment_program(struct st_context *st, /* Non-GLSL programs: */ if (!stfp->glsl_to_tgsi && !stfp->shader_program) { - _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT); + _mesa_remove_output_reads(&stfp->Base, PROGRAM_OUTPUT); if (st->ctx->Const.GLSLFragCoordIsSysVal) - _mesa_program_fragment_position_to_sysval(&stfp->Base.Base); + _mesa_program_fragment_position_to_sysval(&stfp->Base); /* This determines which states will be updated when the assembly * shader is bound. @@ -605,7 +605,7 @@ st_translate_fragment_program(struct st_context *st, ST_NEW_RENDER_SAMPLERS; } else { /* ARB_fp */ - if (stfp->Base.Base.SamplersUsed) + if (stfp->Base.SamplersUsed) stfp->affected_states |= ST_NEW_FS_SAMPLER_VIEWS | ST_NEW_RENDER_SAMPLERS; } @@ -614,7 +614,7 @@ st_translate_fragment_program(struct st_context *st, /* * Convert Mesa program inputs to TGSI input register semantics. */ - inputsRead = stfp->Base.Base.InputsRead; + inputsRead = stfp->Base.InputsRead; for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if ((inputsRead & BITFIELD64_BIT(attr)) != 0) { const GLuint slot = fs_num_inputs++; @@ -753,7 +753,7 @@ st_translate_fragment_program(struct st_context *st, * Semantics and mapping for outputs */ { - GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten; + GLbitfield64 outputsWritten = stfp->Base.OutputsWritten; /* if z is written, emit that first */ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { @@ -783,7 +783,7 @@ st_translate_fragment_program(struct st_context *st, /* handle remaining outputs (color) */ for (attr = 0; attr < ARRAY_SIZE(outputMapping); attr++) { const GLbitfield64 written = attr < FRAG_RESULT_MAX ? outputsWritten : - stfp->Base.Base.SecondaryOutputsWritten; + stfp->Base.SecondaryOutputsWritten; const unsigned loc = attr % FRAG_RESULT_MAX; if (written & BITFIELD64_BIT(loc)) { @@ -822,8 +822,7 @@ st_translate_fragment_program(struct st_context *st, } if (stfp->shader_program) { - nir_shader *nir = st_glsl_to_nir(st, &stfp->Base.Base, - stfp->shader_program, + nir_shader *nir = st_glsl_to_nir(st, &stfp->Base, stfp->shader_program, MESA_SHADER_FRAGMENT); stfp->tgsi.type = PIPE_SHADER_IR_NIR; @@ -837,15 +836,15 @@ st_translate_fragment_program(struct st_context *st, return false; if (ST_DEBUG & DEBUG_MESA) { - _mesa_print_program(&stfp->Base.Base); - _mesa_print_program_parameters(st->ctx, &stfp->Base.Base); + _mesa_print_program(&stfp->Base); + _mesa_print_program_parameters(st->ctx, &stfp->Base); debug_printf("\n"); } if (write_all == GL_TRUE) ureg_property(ureg, TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, 1); - if (stfp->Base.Base.info.fs.depth_layout != FRAG_DEPTH_LAYOUT_NONE) { - switch (stfp->Base.Base.info.fs.depth_layout) { + if (stfp->Base.info.fs.depth_layout != FRAG_DEPTH_LAYOUT_NONE) { + switch (stfp->Base.info.fs.depth_layout) { case FRAG_DEPTH_LAYOUT_ANY: ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, TGSI_FS_DEPTH_LAYOUT_ANY); @@ -872,7 +871,7 @@ st_translate_fragment_program(struct st_context *st, PIPE_SHADER_FRAGMENT, ureg, stfp->glsl_to_tgsi, - &stfp->Base.Base, + &stfp->Base, /* inputs */ fs_num_inputs, inputMapping, @@ -892,7 +891,7 @@ st_translate_fragment_program(struct st_context *st, } else if (stfp->ati_fs) st_translate_atifs_program(ureg, stfp->ati_fs, - &stfp->Base.Base, + &stfp->Base, /* inputs */ fs_num_inputs, inputMapping, @@ -908,7 +907,7 @@ st_translate_fragment_program(struct st_context *st, st_translate_mesa_program(st->ctx, PIPE_SHADER_FRAGMENT, ureg, - &stfp->Base.Base, + &stfp->Base, /* inputs */ fs_num_inputs, inputMapping, @@ -934,7 +933,7 @@ st_create_fp_variant(struct st_context *st, struct pipe_context *pipe = st->pipe; struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant); struct pipe_shader_state tgsi = {0}; - struct gl_program_parameter_list *params = stfp->Base.Base.Parameters; + struct gl_program_parameter_list *params = stfp->Base.Parameters; static const gl_state_index texcoord_state[STATE_LENGTH] = { STATE_INTERNAL, STATE_CURRENT_ATTRIB, VERT_ATTRIB_TEX0 }; static const gl_state_index scale_state[STATE_LENGTH] = @@ -964,7 +963,7 @@ st_create_fp_variant(struct st_context *st, if (key->bitmap) { nir_lower_bitmap_options options = {0}; - variant->bitmap_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1; + variant->bitmap_sampler = ffs(~stfp->Base.SamplersUsed) - 1; options.sampler = variant->bitmap_sampler; options.swizzle_xxxx = (st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM); @@ -974,7 +973,7 @@ st_create_fp_variant(struct st_context *st, /* glDrawPixels (color only) */ if (key->drawpixels) { nir_lower_drawpixels_options options = {{0}}; - unsigned samplers_used = stfp->Base.Base.SamplersUsed; + unsigned samplers_used = stfp->Base.SamplersUsed; /* Find the first unused slot. */ variant->drawpix_sampler = ffs(~samplers_used) - 1; @@ -1011,12 +1010,12 @@ st_create_fp_variant(struct st_context *st, NIR_PASS_V(tgsi.ir.nir, nir_lower_tex, &options); } - st_finalize_nir(st, &stfp->Base.Base, tgsi.ir.nir); + st_finalize_nir(st, &stfp->Base, tgsi.ir.nir); if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) { /* This pass needs to happen *after* nir_lower_sampler */ NIR_PASS_V(tgsi.ir.nir, st_nir_lower_tex_src_plane, - ~stfp->Base.Base.SamplersUsed, + ~stfp->Base.SamplersUsed, key->external.lower_nv12, key->external.lower_iyuv); } @@ -1062,7 +1061,7 @@ st_create_fp_variant(struct st_context *st, if (key->bitmap) { const struct tgsi_token *tokens; - variant->bitmap_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1; + variant->bitmap_sampler = ffs(~stfp->Base.SamplersUsed) - 1; tokens = st_get_bitmap_shader(tgsi.tokens, st->internal_target, @@ -1085,10 +1084,10 @@ st_create_fp_variant(struct st_context *st, unsigned scale_const = 0, bias_const = 0, texcoord_const = 0; /* Find the first unused slot. */ - variant->drawpix_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1; + variant->drawpix_sampler = ffs(~stfp->Base.SamplersUsed) - 1; if (key->pixelMaps) { - unsigned samplers_used = stfp->Base.Base.SamplersUsed | + unsigned samplers_used = stfp->Base.SamplersUsed | (1 << variant->drawpix_sampler); variant->pixelmap_sampler = ffs(~samplers_used) - 1; @@ -1124,7 +1123,7 @@ st_create_fp_variant(struct st_context *st, assert(!(key->bitmap || key->drawpixels)); tokens = st_tgsi_lower_yuv(tgsi.tokens, - ~stfp->Base.Base.SamplersUsed, + ~stfp->Base.SamplersUsed, key->external.lower_nv12, key->external.lower_iyuv); if (tokens) { |