update_gl_clamp() was ~12% of drawoverhead -test 40.. this turns it into
a no-op when no clamp lowering is needed.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23149>
/** GL_ARB_seamless_cubemap */
GLboolean CubeMapSeamless;
+ GLshort NumSamplersWithClamp;
+
struct gl_texture_unit Unit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
struct gl_fixedfunc_texture_unit FixedFuncUnit[MAX_TEXTURE_COORD_UNITS];
};
if (cur_state == new_state)
return;
ctx->NewDriverState |= ctx->DriverFlags.NewSamplersWithClamp;
+ uint8_t old_mask = samp->glclamp_mask;
if (new_state)
samp->glclamp_mask |= wrap;
else
samp->glclamp_mask &= ~wrap;
+
+ if (old_mask && !samp->glclamp_mask)
+ ctx->Texture.NumSamplersWithClamp--;
+ else if (samp->glclamp_mask && !old_mask)
+ ctx->Texture.NumSamplersWithClamp++;
}
#ifdef __cplusplus
}
if (!st->emulate_gl_clamp)
return;
+ if (!st->ctx->Texture.NumSamplersWithClamp)
+ return;
+
gl_clamp[0] = gl_clamp[1] = gl_clamp[2] = 0;
GLbitfield samplers_used = prog->SamplersUsed;
unsigned unit;