summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorGustaw Smolarczyk <[email protected]>2017-03-30 20:09:28 +0200
committerMarek Olšák <[email protected]>2017-04-08 20:29:58 +0200
commitc9b2938aeccfe131329b25e378264cc1d0080be2 (patch)
treed33b1b8e9e2f28b956776845b01a8eb59f87f561 /src/mesa/main
parent885012aab26ab293fe71f242d4379758a72c5ce0 (diff)
mesa/main/ff_frag: Don't retrieve format if not necessary.
Signed-off-by: Gustaw Smolarczyk <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 2b4d99c8791..e1fe9b58c02 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -402,24 +402,21 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
const struct gl_texture_object *texObj = texUnit->_Current;
const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine;
- const struct gl_sampler_object *samp;
- GLenum format;
if (!texObj)
continue;
- samp = _mesa_get_samplerobj(ctx, i);
- format = _mesa_texture_base_format(texObj);
-
key->unit[i].enabled = 1;
inputs_referenced |= VARYING_BIT_TEX(i);
key->unit[i].source_index = texObj->TargetIndex;
- key->unit[i].shadow =
- ((samp->CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
- ((format == GL_DEPTH_COMPONENT) ||
- (format == GL_DEPTH_STENCIL_EXT)));
+ const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, i);
+ if (samp->CompareMode == GL_COMPARE_R_TO_TEXTURE) {
+ const GLenum format = _mesa_texture_base_format(texObj);
+ key->unit[i].shadow = (format == GL_DEPTH_COMPONENT ||
+ format == GL_DEPTH_STENCIL_EXT);
+ }
key->unit[i].NumArgsRGB = comb->_NumArgsRGB;
key->unit[i].NumArgsA = comb->_NumArgsA;