[Mesa-dev] [PATCH 1/2] mesa: use more descriptive error messages for glUniform errors
Brian Paul
brianp at vmware.com
Thu Mar 19 11:55:48 PDT 2015
On 03/19/2015 12:03 PM, Ian Romanick wrote:
> On 03/19/2015 07:56 AM, Brian Paul wrote:
>> On 03/19/2015 08:53 AM, Brian Paul wrote:
>>> Different errors for type mismatches, size mismatches and matrix/
>>> non-matrix mismatches. Use a common format of "uniformName"@location
>>> in the messags.
>>> ---
>>> src/mesa/main/uniform_query.cpp | 69
>>> ++++++++++++++++++++++++++++++++++++++---
>>> 1 file changed, 65 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/mesa/main/uniform_query.cpp
>>> b/src/mesa/main/uniform_query.cpp
>>> index 9f82de9..2ab5528 100644
>>> --- a/src/mesa/main/uniform_query.cpp
>>> +++ b/src/mesa/main/uniform_query.cpp
>>> @@ -260,8 +260,8 @@ validate_uniform_parameters(struct gl_context *ctx,
>>> if (uni->array_elements == 0) {
>>> if (count > 1) {
>>> _mesa_error(ctx, GL_INVALID_OPERATION,
>>> - "%s(count > 1 for non-array, location=%d)",
>>> - caller, location);
>>> + "%s(count = %u for non-array \"%s\"@%d)",
>>> + caller, count, uni->name, location);
>>> return NULL;
>>> }
>>>
>>> @@ -601,6 +601,46 @@ _mesa_propagate_uniforms_to_driver_storage(struct
>>> gl_uniform_storage *uni,
>>> }
>>> }
>>>
>>> +
>>> +/**
>>> + * Return printable string for a given GLSL_TYPE_x
>>> + */
>>> +static const char *
>>> +glsl_type_name(enum glsl_base_type type)
>>> +{
>>> + switch (type) {
>>> + case GLSL_TYPE_UINT:
>>> + return "uint";
>>> + case GLSL_TYPE_INT:
>>> + return "int";
>>> + case GLSL_TYPE_FLOAT:
>>> + return "float";
>>> + case GLSL_TYPE_DOUBLE:
>>> + return "double";
>>> + case GLSL_TYPE_BOOL:
>>> + return "bool";
>>> + case GLSL_TYPE_SAMPLER:
>>> + return "sampler";
>>> + case GLSL_TYPE_IMAGE:
>>> + return "image";
>>> + case GLSL_TYPE_ATOMIC_UINT:
>>> + return "atomic_uint";
>>> + case GLSL_TYPE_STRUCT:
>>> + return "struct";
>>> + case GLSL_TYPE_INTERFACE:
>>> + return "interface";
>>> + case GLSL_TYPE_ARRAY:
>>> + return "array";
>>> + case GLSL_TYPE_VOID:
>>> + return "void";
>>> + case GLSL_TYPE_ERROR:
>>> + return "error";
>>> + default:
>>> + return "other";
>>> + }
>>> +}
>>
>> BTW, I looked around a bit, but I didn't see a glsl_base_type->string
>> function like this in src/glsl/, but I certainly could have missed it.
>
> Right... most places just use glsl_type::name. That can't be used here
> because you only have the glsl_base_type enum, or is there some other
> reason?
No, that's it.
BTW, if we someday need this function elsewhere, it should probably be
moved to somewhere under src/glsl/
-Brian
>
> I have a patch series somewhere that re-works a lot of this code to be a
> little faster on Atom CPUs. I guess I should finish that. I don't
> think your patches will cause me any undue rebase woes.
>
>> -Brian
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwICaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=P4CxpDun3YM15pEyfg8h8KXWTJwxfISUoqhGWNXPW4A&s=pdK4MzXh70DufMpq0jeYQ57rMIdtji2Av7sQ66EdIvI&e=
>
More information about the mesa-dev
mailing list