Module: Mesa
Branch: master
Commit: cac74a9bcc168f984d9a06d00b39c882fe5850b6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cac74a9bcc168f984d9a06d00b39c882fe5850b6

Author: Marek Olšák <[email protected]>
Date:   Tue Jan  3 20:12:28 2017 +0100

radeonsi: fix the Witcher 2 black transitions

v2: do it properly

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98238

Reviewed-by: Nicolai Hähnle <[email protected]>

---

 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 996a458..3e0f7c4 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -636,6 +636,15 @@ store_value_to_array(struct lp_build_tgsi_context 
*bld_base,
        }
 }
 
+/* If this is true, preload FS inputs at the beginning of shaders. Otherwise,
+ * reload them at each use. This must be true if the shader is using
+ * derivatives, because all inputs should be loaded in the WQM mode.
+ */
+static bool si_preload_fs_inputs(struct si_shader_context *ctx)
+{
+       return ctx->shader->selector->info.uses_derivatives;
+}
+
 LLVMValueRef si_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base,
                                const struct tgsi_full_src_register *reg,
                                enum tgsi_opcode_type type,
@@ -688,7 +697,8 @@ LLVMValueRef si_llvm_emit_fetch(struct 
lp_build_tgsi_context *bld_base,
                 * only once. Fragment shaders don't care much, because
                 * v_interp instructions are much cheaper than VMEM loads.
                 */
-               if (ctx->soa.bld_base.info->processor == PIPE_SHADER_FRAGMENT)
+               if (!si_preload_fs_inputs(ctx) &&
+                   ctx->soa.bld_base.info->processor == PIPE_SHADER_FRAGMENT)
                        ctx->load_input(ctx, index, &ctx->input_decls[index], 
input);
                else
                        memcpy(input, &ctx->inputs[index * 4], sizeof(input));
@@ -881,7 +891,8 @@ static void emit_declaration(struct lp_build_tgsi_context 
*bld_base,
                                ctx->input_decls[idx].Range.Last = idx;
                                ctx->input_decls[idx].Semantic.Index += idx - 
decl->Range.First;
 
-                               if (bld_base->info->processor != 
PIPE_SHADER_FRAGMENT)
+                               if (si_preload_fs_inputs(ctx) ||
+                                   bld_base->info->processor != 
PIPE_SHADER_FRAGMENT)
                                        ctx->load_input(ctx, idx, 
&ctx->input_decls[idx],
                                                        &ctx->inputs[idx * 4]);
                        }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to