[Mesa-dev] [PATCH] anv: move nir_lower_wpos_center to later

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Jan 13 15:37:08 UTC 2017


El 2017-01-13 16:05, Lionel Landwerlin escribió:
> Hi Samuel,
> 
> Maybe you missed Ken's patch? :
> 
> https://patchwork.freedesktop.org/series/17864/
> 

Oh yes, I didn't see it :-(

Thanks Lionel!

Sam

P.S: Please discard this patch.

> Thanks,
> 
> -
> Lionel
> 
> On 13/01/17 13:48, Samuel Iglesias Gonsálvez wrote:
>> We can have a crash produced because the tests is using the same shader
>> module for all stages (setting a different entry point per stage).
>> So when we fix world position center on the fragment's built-in input
>> position in fragment shader ("gl_Fragcoord" in GLSL), we might be
>> using one from previous shaders (geometry or tessellation shaders is
>> "gl_in" in GLSL) because the slot location would match.
>>
>> After moving this lowering to later, the rest of optimizations will
>> take care of removing unused inputs for each stage, so we don't
>> lower the wrong fragment shader's built-in position input.
>>
>> Fixes a crash in:
>>
>> dEQP-VK.spirv_assembly.instruction.graphics.module.same_mod
>>
>> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
>> ---
>>   src/intel/vulkan/anv_pipeline.c | 7 +++----
>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
>> index 6c939b071da..5a6e4f6256e 100644
>> --- a/src/intel/vulkan/anv_pipeline.c
>> +++ b/src/intel/vulkan/anv_pipeline.c
>> @@ -139,9 +139,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
>>        free(spec_entries);
>>   -   if (stage == MESA_SHADER_FRAGMENT)
>> -      NIR_PASS_V(nir, nir_lower_wpos_center);
>> -
>>      /* We have to lower away local constant initializers right before we
>>       * inline functions.  That way they get properly initialized at the top
>>       * of the function and not at the top of its caller.
>> @@ -177,8 +174,10 @@ anv_shader_compile_to_nir(struct anv_device *device,
>>        NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
>>   -   if (stage == MESA_SHADER_FRAGMENT)
>> +   if (stage == MESA_SHADER_FRAGMENT) {
>>         NIR_PASS_V(nir, anv_nir_lower_input_attachments);
>> +      NIR_PASS_V(nir, nir_lower_wpos_center);
>> +   }
>>        nir_shader_gather_info(nir, entry_point->impl);
>>



More information about the mesa-dev mailing list