[Mesa-dev] [PATCH 07/11] glsl_to_tgsi: enable copy propagation for tessellation shaders

Marek Olšák maraeo at gmail.com
Tue Oct 3 15:46:36 UTC 2017


On Mon, Oct 2, 2017 at 12:55 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 29.09.2017 14:25, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> just don't propagate output reads
>> ---
>>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> index 50a71e4..2d62213 100644
>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> @@ -4940,20 +4940,21 @@ glsl_to_tgsi_visitor::copy_propagate(void)
>>           /* If this is a copy, add it to the ACP. */
>>         if (inst->op == TGSI_OPCODE_MOV &&
>>             inst->dst[0].file == PROGRAM_TEMPORARY &&
>>             !(inst->dst[0].file == inst->src[0].file &&
>>                inst->dst[0].index == inst->src[0].index) &&
>>             !inst->dst[0].reladdr &&
>>             !inst->dst[0].reladdr2 &&
>>             !inst->saturate &&
>>             inst->src[0].file != PROGRAM_ARRAY &&
>> +          inst->src[0].file != PROGRAM_OUTPUT &&
>
>
> Did you check shader-db effects of this? We only really need this
> restriction on TCS. Though I guess radeonsi is actually one of the least
> affected drivers thanks to LLVM.

No shader-db change, but I can add this:

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 9ddfb1e..1253f88 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4970,7 +4970,8 @@ glsl_to_tgsi_visitor::copy_propagate(void)
           !inst->dst[0].reladdr2 &&
           !inst->saturate &&
           inst->src[0].file != PROGRAM_ARRAY &&
-          inst->src[0].file != PROGRAM_OUTPUT &&
+          (this->shader->Stage != MESA_SHADER_TESS_CTRL ||
+           inst->src[0].file != PROGRAM_OUTPUT) &&
           !inst->src[0].reladdr &&
           !inst->src[0].reladdr2 &&
           !inst->src[0].negate &&


Marek


More information about the mesa-dev mailing list