[Mesa-dev] [PATCH 10/14] i965/fs: Use gl_program* rather than fp->Base
Jordan Justen
jordan.l.justen at intel.com
Mon Sep 1 09:44:34 PDT 2014
Reduce brw_fs_precompile's dependence on gl_fragment_program.
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a6a03ea..5298059 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3471,6 +3471,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
struct gl_fragment_program *fp = (struct gl_fragment_program *)
prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
+ struct gl_program *glp = &fp->Base;
struct brw_fragment_program *bfp = brw_fragment_program(fp);
bool program_uses_dfdy = fp->UsesDFdy;
@@ -3480,7 +3481,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
if (fp->UsesKill)
key.iz_lookup |= IZ_PS_KILL_ALPHATEST_BIT;
- if (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
+ if (glp->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
key.iz_lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
/* Just assume depth testing. */
@@ -3488,13 +3489,13 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
key.iz_lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
}
- if (brw->gen < 6 || _mesa_bitcount_64(fp->Base.InputsRead &
+ if (brw->gen < 6 || _mesa_bitcount_64(glp->InputsRead &
BRW_FS_VARYING_INPUT_MASK) > 16)
- key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;
+ key.input_slots_valid = glp->InputsRead | VARYING_BIT_POS;
- unsigned sampler_count = _mesa_fls(fp->Base.SamplersUsed);
+ unsigned sampler_count = _mesa_fls(glp->SamplersUsed);
for (unsigned i = 0; i < sampler_count; i++) {
- if (fp->Base.ShadowSamplers & (1 << i)) {
+ if (glp->ShadowSamplers & (1 << i)) {
/* Assume DEPTH_TEXTURE_MODE is the default: X, X, X, 1 */
key.tex.swizzles[i] =
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_ONE);
@@ -3504,15 +3505,15 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
}
}
- if (fp->Base.InputsRead & VARYING_BIT_POS) {
+ if (glp->InputsRead & VARYING_BIT_POS) {
key.drawable_height = ctx->DrawBuffer->Height;
}
- key.nr_color_regions = _mesa_bitcount_64(fp->Base.OutputsWritten &
+ key.nr_color_regions = _mesa_bitcount_64(glp->OutputsWritten &
~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)));
- if ((fp->Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
+ if ((glp->InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer) ||
key.nr_color_regions > 1;
}
--
2.1.0
More information about the mesa-dev
mailing list