[Mesa-dev] [PATCH 05/27] mesa: add support for 64-bit integer uniforms.

Dave Airlie airlied at gmail.com
Sat Jul 2 07:08:14 UTC 2016


On 30 June 2016 at 08:29, Ian Romanick <idr at freedesktop.org> wrote:
> On 06/19/2016 10:06 PM, Dave Airlie wrote:
>> From: Dave Airlie <airlied at redhat.com>
>>
>> This hooks up the API to the internals for 64-bit integer uniforms.
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  src/mesa/main/uniform_query.cpp |  60 +++++++++++++-
>>  src/mesa/main/uniforms.c        | 170 +++++++++++++++++++++++++++++++++++++++-
>>  2 files changed, 225 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
>> index 127f097..08f2555 100644
>> --- a/src/mesa/main/uniform_query.cpp
>> +++ b/src/mesa/main/uniform_query.cpp
>> @@ -333,7 +333,8 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
>>        &uni->storage[offset * elements * dmul];
>>
>>        assert(returnType == GLSL_TYPE_FLOAT || returnType == GLSL_TYPE_INT ||
>> -             returnType == GLSL_TYPE_UINT || returnType == GLSL_TYPE_DOUBLE);
>> +             returnType == GLSL_TYPE_UINT || returnType == GLSL_TYPE_DOUBLE ||
>> +             returnType == GLSL_TYPE_UINT64 || returnType == GLSL_TYPE_INT64);
>>
>>        /* doubles have a different size than the other 3 types */
>>        unsigned bytes = sizeof(src[0]) * elements * rmul;
>> @@ -355,7 +356,11 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
>>             (uni->type->base_type == GLSL_TYPE_INT
>>              || uni->type->base_type == GLSL_TYPE_UINT
>>                 || uni->type->base_type == GLSL_TYPE_SAMPLER
>> -               || uni->type->base_type == GLSL_TYPE_IMAGE))) {
>> +               || uni->type->base_type == GLSL_TYPE_IMAGE))
>> +          || ((returnType == GLSL_TYPE_UINT64 ||
>> +               returnType == GLSL_TYPE_INT64 ) &&
>> +              (uni->type->base_type == GLSL_TYPE_UINT64 ||
>> +               uni->type->base_type == GLSL_TYPE_INT64))) {
>>        memcpy(paramsOut, src, bytes);
>>        } else {
>>        union gl_constant_value *const dst =
>> @@ -385,6 +390,12 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
>>              case GLSL_TYPE_DOUBLE:
>>                 dst[didx].f = *(double *)&src[sidx].f;
>>                 break;
>> +               case GLSL_TYPE_UINT64:
>> +                  dst[didx].f = *(uint64_t *)&src[sidx].u;
>> +                  break;
>> +               case GLSL_TYPE_INT64:
>> +                  dst[didx].f = *(int64_t *)&src[sidx].i;
>> +                  break;
>
> This hunk and a few below will conflict with Matt's "Enable
> -fstrict-aliasing" series.  I think his patch 2 provides a model to
> avoid the problem.

I've rebased my tree on top of Matt's 2 + 5 patches, and fixed it up.

My git tree has the result, I'll wait for Matt to push his patches or
I'll push them as precursor for my
branch next week if we work out the last patch I think you wanted to review.

Dave.


More information about the mesa-dev mailing list