[Mesa-dev] [PATCH 1/8] glsl: optionally declare gl_FragCoord & gl_FrontFacing as system values

Marek Olšák maraeo at gmail.com
Fri Jan 8 15:32:47 PST 2016


On Fri, Jan 8, 2016 at 11:20 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 01/07/2016 05:29 PM, Marek Olšák wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>  src/glsl/ast_to_hir.cpp                    |  2 +-
>>  src/glsl/builtin_variables.cpp             | 12 ++++++++++--
>>  src/glsl/nir/shader_enums.h                |  3 ++-
>>  src/mesa/main/mtypes.h                     |  4 ++++
>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  1 +
>>  5 files changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
>> index e6aec36..f3966d7 100644
>> --- a/src/glsl/ast_to_hir.cpp
>> +++ b/src/glsl/ast_to_hir.cpp
>> @@ -3517,7 +3517,7 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
>>                state->is_version(150, 0))
>>                && strcmp(var->name, "gl_FragCoord") == 0
>>                && earlier->type == var->type
>> -              && earlier->data.mode == var->data.mode) {
>> +              && var->data.mode == ir_var_shader_in) {
>
> I traced this code all the way back to 4a962170d (July 2010!).  I'm not
> 100% sure why Eric did it this way.  Since earlier->data.mode will
> always (before this patch) be ir_var_shader_in, I wonder if this filters
> cases like redeclaring gl_FragCoord as an out or a uniform.

Sorry, I pushed this and forgot you guys would want to review the core
and glsl patches.

>
> Do we have any tests for that?

No, we don't. I've just tried to declare gl_FragCoord as an out and it prints:
error: `gl_FragCoord' redeclared

Marek


More information about the mesa-dev mailing list