diff options
author | Emma Anholt <emma@anholt.net> | 2022-02-02 21:08:13 -0800 |
---|---|---|
committer | Emma Anholt <emma@anholt.net> | 2022-02-03 14:28:44 -0800 |
commit | 17cea74b8cd3b1a56d923edeb40772b3e8b18ab2 (patch) | |
tree | 8e2b677411e3434a16c5f36e7a412bb9bae07937 /src/gallium/drivers/r300/r300_state.c | |
parent | 5f55e7b845f7d81bf864af1fced3260bf9d7b190 (diff) |
r300: Set up shadow sampler lowering in precompiles.
Otherwise you end up lowering all shadow samples to a MOV dst
temp[0].0000, which is pretty silly.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14847>
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 25b69c427bb..e3f482b6ca8 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1053,12 +1053,19 @@ static void* r300_create_fs_state(struct pipe_context* pipe, /* Precompile the fragment shader at creation time to avoid jank at runtime. * In most cases we won't have anything in the key at draw time. - * - * TODO: precompile state for shadow samplers (but this needs a decision for - * the default shadow compare and texture swizzle values). */ struct r300_fragment_program_external_state precompile_state; memset(&precompile_state, 0, sizeof(precompile_state)); + + struct tgsi_shader_info info; + tgsi_scan_shader(fs->state.tokens, &info); + for (int i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) { + if (info.sampler_targets[i] == TGSI_TEXTURE_SHADOW1D || + info.sampler_targets[i] == TGSI_TEXTURE_SHADOW2D) { + precompile_state.unit[i].compare_mode_enabled = true; + precompile_state.unit[i].texture_compare_func = PIPE_FUNC_LESS; + } + } r300_pick_fragment_shader(r300, fs, &precompile_state); return (void *)fs; |