[Mesa-dev] [PATCH 02/24] mesa: add gl_shader::SpirVBinary and getter

Eduardo Lima Mitev elima at igalia.com
Mon Nov 20 08:11:35 UTC 2017


On 11/16/2017 12:39 AM, Timothy Arceri wrote:
> On 16/11/17 00:22, Eduardo Lima Mitev wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> ---
>>   src/mesa/main/mtypes.h    | 1 +
>>   src/mesa/main/shaderapi.c | 3 +++
>>   2 files changed, 4 insertions(+)
>>
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index 1c953b83155..cfc763f043e 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -2579,6 +2579,7 @@ struct gl_shader
>>      GLchar *Label;   /**< GL_KHR_debug */
>>      unsigned char sha1[20]; /**< SHA1 hash of pre-processed source */
>>      GLboolean DeletePending;
>> +   GLboolean SpirVBinary;
>
> As with my other comment about a special spirv bool. I think you 
> should move this patch to later in the series drop the bool and 
> instead query whether spirv_data is NULL or not to decide if this is a 
> spriv shader.
>
>

I agree with you that it is probably enough to use spirv_data nullness 
to tell if this is a spirv shader.

In this case, the flag and the spirv_data member are both in the same 
context, so they are redundant. This is different though to the case of 
the spirv flag in gl_shader_program_data that you commended below.

I will fix the patches involved to follow your advice.

Thanks,
Eduardo

>>      bool IsES;              /**< True if this shader uses GLSL ES */
>>        enum gl_compile_status CompileStatus;
>> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
>> index 72824355838..5db335b695b 100644
>> --- a/src/mesa/main/shaderapi.c
>> +++ b/src/mesa/main/shaderapi.c
>> @@ -960,6 +960,9 @@ get_shaderiv(struct gl_context *ctx, GLuint name, 
>> GLenum pname, GLint *params)
>>      case GL_SHADER_SOURCE_LENGTH:
>>         *params = shader->Source ? strlen((char *) shader->Source) + 
>> 1 : 0;
>>         break;
>> +   case GL_SPIR_V_BINARY_ARB:
>> +      *params = shader->SpirVBinary;
>> +      break;
>>      default:
>>         _mesa_error(ctx, GL_INVALID_ENUM, "glGetShaderiv(pname)");
>>         return;
>>
>



More information about the mesa-dev mailing list