[Mesa-dev] [PATCH 1/2] i965: Make the precompile ignore DEPTH_TEXTURE_MODE on Gen7.5+.
Ian Romanick
idr at freedesktop.org
Thu Jan 1 22:21:43 PST 2015
On 12/31/2014 08:04 PM, Kenneth Graunke wrote:
> Gen7.5+ platforms that support the "Shader Channel Select" feature leave
> key->tex.swizzles[i] as SWIZZLE_NOOP except when GL_DEPTH_TEXTURE_MODE
> is GL_ALPHA (which is really uncommon). So, the precompile should leave
> them as SWIZZLE_NOOP (aka SWIZZLE_XYZW) as well.
>
> We didn't notice this because prog->ShadowSamplers is not set correctly.
> The next patch will fix that problem.
I had some patches related to this a long time ago, but I'm not sure
what happened to them. My recollection is that, basically, nothing
should use prog->ShadowSamplers. That was only used by the
ARB_fragment_program assembler, and other paths (including ff fragment
programs) don't set these fields. I just pushed the (ancient!) branch
to my fd.o repo as r300-shadow-samplers. The two patches are from 2011. :(
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87886
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 3 ++-
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 4 +++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 78c068f..fa1ca8c 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3912,9 +3912,10 @@ brw_fs_precompile(struct gl_context *ctx,
> BRW_FS_VARYING_INPUT_MASK) > 16)
> key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;
>
> + const bool has_shader_channel_select = brw->is_haswell || brw->gen >= 8;
> unsigned sampler_count = _mesa_fls(fp->Base.SamplersUsed);
> for (unsigned i = 0; i < sampler_count; i++) {
> - if (fp->Base.ShadowSamplers & (1 << i)) {
> + if (!has_shader_channel_select && (fp->Base.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);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index f389392..b1a2a53 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -1945,11 +1945,13 @@ brw_vue_setup_prog_key_for_precompile(struct gl_context *ctx,
> struct brw_vue_prog_key *key,
> GLuint id, struct gl_program *prog)
> {
> + struct brw_context *brw = brw_context(ctx);
> key->program_string_id = id;
>
> + const bool has_shader_channel_select = brw->is_haswell || brw->gen >= 8;
> unsigned sampler_count = _mesa_fls(prog->SamplersUsed);
> for (unsigned i = 0; i < sampler_count; i++) {
> - if (prog->ShadowSamplers & (1 << i)) {
> + if (!has_shader_channel_select && (prog->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);
>
More information about the mesa-dev
mailing list