[Mesa-dev] [PATCH v3 31/32] glsl: teach lower_ubo_reference about samplers inside structures
Samuel Pitoiset
samuel.pitoiset at gmail.com
Thu May 4 13:28:10 UTC 2017
On 05/04/2017 03:25 PM, Nicolai Hähnle wrote:
> On 04.05.2017 15:06, Samuel Pitoiset wrote:
>>
>>
>> On 05/04/2017 02:45 PM, Nicolai Hähnle wrote:
>>> On 02.05.2017 22:53, Samuel Pitoiset wrote:
>>>> In a situation like:
>>>>
>>>> (tex vec4 (record_ref (var_ref f) tex) (constant vec2 (0.000000
>>>> 0.000000)) 0 1 () )
>>>>
>>>> The sampler needs to be lowered, otherwise this ends up with
>>>> "ir_dereference_variable @ 0x229a100 specifies undeclared variable
>>>> `ubo_load_temp' @ 0x2290440"
>>>>
>>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>>
>>> I think this loses image format / memory qualifiers. That's
>>> unfortunately not very easy to test for, but can you make sure the
>>> qualifiers survive to the TGSI?
>>
>> This is for samplers, not images.
>
> Oops, sorry for the confusion. Feel free to add my R-b to this patch as
> well.
No worries, thanks a bunch for the review. :)
Samuel.
>
> Cheers,
> Nicolai
>
>
>>
>> About images, the qualifiers survive to the TGSI. I have two follow-up
>> patches that I will submit after this series (to avoid too much
>> confusion), but it's working fine.
>>
>>>
>>> Thanks,
>>> Nicolai
>>>
>>>
>>>> ---
>>>> src/compiler/glsl/lower_ubo_reference.cpp | 15 +++++++++++++++
>>>> 1 file changed, 15 insertions(+)
>>>>
>>>> diff --git a/src/compiler/glsl/lower_ubo_reference.cpp
>>>> b/src/compiler/glsl/lower_ubo_reference.cpp
>>>> index bfaddac3ad..72f0fcf432 100644
>>>> --- a/src/compiler/glsl/lower_ubo_reference.cpp
>>>> +++ b/src/compiler/glsl/lower_ubo_reference.cpp
>>>> @@ -104,6 +104,7 @@ public:
>>>> ir_call *lower_ssbo_atomic_intrinsic(ir_call *ir);
>>>> ir_call *check_for_ssbo_atomic_intrinsic(ir_call *ir);
>>>> ir_visitor_status visit_enter(ir_call *ir);
>>>> + ir_visitor_status visit_enter(ir_texture *ir);
>>>>
>>>> struct gl_linked_shader *shader;
>>>> bool clamp_block_indices;
>>>> @@ -1090,6 +1091,20 @@
>>>> lower_ubo_reference_visitor::visit_enter(ir_call *ir)
>>>> }
>>>>
>>>>
>>>> +ir_visitor_status
>>>> +lower_ubo_reference_visitor::visit_enter(ir_texture *ir)
>>>> +{
>>>> + ir_dereference *sampler = ir->sampler;
>>>> +
>>>> + if (sampler->ir_type == ir_type_dereference_record) {
>>>> + handle_rvalue((ir_rvalue **)&ir->sampler);
>>>> + return visit_continue_with_parent;
>>>> + }
>>>> +
>>>> + return rvalue_visit(ir);
>>>> +}
>>>> +
>>>> +
>>>> } /* unnamed namespace */
>>>>
>>>> void
>>>>
>>>
>>>
>
>
More information about the mesa-dev
mailing list