[Mesa-dev] [PATCH 09/14] mesa/main/ff_frag: Don't retrieve format if not necessary.
Gustaw Smolarczyk
wielkiegie at gmail.com
Thu Mar 30 18:09:28 UTC 2017
Signed-off-by: Gustaw Smolarczyk <wielkiegie at gmail.com>
---
src/mesa/main/ff_fragment_shader.cpp | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 2b4d99c879..e1fe9b58c0 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;
--
2.12.1
More information about the mesa-dev
mailing list