[Mesa-dev] [PATCH 12/15] nir/types: Add a wrapper to access gl_type

Alejandro Piñeiro apinheiro at igalia.com
Mon Jul 23 12:48:15 UTC 2018


On 21/07/18 05:15, Timothy Arceri wrote:
> On 21/07/18 13:09, Timothy Arceri wrote:
>> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
> Actually I take that back. This introduces a dependency on GL in NIR, 

Hmm, but that dependency is already there. nir.h includes GL/gl.h, and
in fact, there is a comment pointing that is there for GLenum.
nir_variable includes a "Glenum format" as part of
ARB_shader_image_load_store.

Just in case you want to see it on code:
https://cgit.freedesktop.org/mesa/mesa/tree/src/compiler/nir/nir.h#n33
https://cgit.freedesktop.org/mesa/mesa/tree/src/compiler/nir/nir.h#n338

> maybe better to put this one in gl_nir_linker.h? 

I can't move it directly there, as gl_nir_linker is C-code. After all,
that was the reason we placed it at nir_types.[h/cpp], because we need a
C-wrapper for gl_nir_link* stuff. Perhaps I could put it at
link_util.cpp, but sounds weird. And as I mentioned before, NIR already
have a dependency on GL.

> If you agree that change would be:
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
>>
>> On 21/07/18 01:08, Alejandro Piñeiro wrote:
>>> From: Neil Roberts <nroberts at igalia.com>
>>>
>>> ---
>>>   src/compiler/nir_types.cpp | 6 ++++++
>>>   src/compiler/nir_types.h   | 2 ++
>>>   2 files changed, 8 insertions(+)
>>>
>>> diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
>>> index 6f1182b742c..2085138c407 100644
>>> --- a/src/compiler/nir_types.cpp
>>> +++ b/src/compiler/nir_types.cpp
>>> @@ -81,6 +81,12 @@ glsl_get_column_type(const struct glsl_type *type)
>>>      return type->column_type();
>>>   }
>>> +GLenum
>>> +glsl_get_gl_type(const struct glsl_type *type)
>>> +{
>>> +   return type->gl_type;
>>> +}
>>> +
>>>   enum glsl_base_type
>>>   glsl_get_base_type(const struct glsl_type *type)
>>>   {
>>> diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
>>> index c128250c7d3..ec5bf2cbc76 100644
>>> --- a/src/compiler/nir_types.h
>>> +++ b/src/compiler/nir_types.h
>>> @@ -59,6 +59,8 @@ glsl_get_function_return_type(const struct
>>> glsl_type *type);
>>>   const struct glsl_function_param *
>>>   glsl_get_function_param(const struct glsl_type *type, unsigned
>>> index);
>>> +GLenum glsl_get_gl_type(const struct glsl_type *type);
>>> +
>>>   enum glsl_base_type glsl_get_base_type(const struct glsl_type *type);
>>>   unsigned glsl_get_vector_elements(const struct glsl_type *type);
>>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>




More information about the mesa-dev mailing list