On Tue, Apr 10, 2018 at 2:43 AM, Ilia Mirkin <imir...@alum.mit.edu> wrote:
> On Mon, Apr 9, 2018 at 8:39 PM, Karol Herbst <kher...@redhat.com> wrote:
>> unsigneds are needed by ARB_bindless_texture 64 bit vertex attribs, both for
>> NV_vertex_attrib_integer64.
>>
>> Fixes the new piglit sampler-vertex-attrib-input-output test I sent some days
>> ago for bindless_texture.
>>
>> The change inside vbo_attrtype_to_double_flag is what I am most concerned
>> about. Maybe I should add another flag for 64 bit ints. Or rework what 
>> Doubles
>> mean in gl_array_attributes. Or Rename that to is64Bit and rework all users 
>> of
>> Doubles.
>>
>> Any suggestions?
>>
>> Signed-off-by: Karol Herbst <kher...@redhat.com>
>> ---
>>  src/gallium/drivers/svga/svga_format.c |  8 ++++++++
>>  src/gallium/include/pipe/p_format.h    |  9 +++++++++
>>  src/mesa/main/glformats.c              |  3 +++
>>  src/mesa/state_tracker/st_atom_array.c | 30 +++++++++++++++++++++++++++---
>>  src/mesa/vbo/vbo_private.h             |  2 +-
>>  5 files changed, 48 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/gallium/drivers/svga/svga_format.c 
>> b/src/gallium/drivers/svga/svga_format.c
>> index 20a6e6b159f..f01a0e79c72 100644
>> --- a/src/gallium/drivers/svga/svga_format.c
>> +++ b/src/gallium/drivers/svga/svga_format.c
>> @@ -369,6 +369,14 @@ static const struct vgpu10_format_entry 
>> format_conversion_table[] =
>>     { PIPE_FORMAT_A1B5G5R5_UNORM,        SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>>     { PIPE_FORMAT_X1B5G5R5_UNORM,        SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>>     { PIPE_FORMAT_A4B4G4R4_UNORM,        SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64_UINT,              SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64G64_UINT,           SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64G64B64_UINT,        SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64G64B64A64_UINT,     SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64_SINT,              SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64G64_SINT,           SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64G64B64_SINT,        SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>> +   { PIPE_FORMAT_R64G64B64A64_SINT,     SVGA3D_FORMAT_INVALID,      
>> SVGA3D_FORMAT_INVALID,       0 },
>>  };
>>
>>
>> diff --git a/src/gallium/include/pipe/p_format.h 
>> b/src/gallium/include/pipe/p_format.h
>> index 57399800fa4..df698856b70 100644
>> --- a/src/gallium/include/pipe/p_format.h
>> +++ b/src/gallium/include/pipe/p_format.h
>> @@ -396,6 +396,15 @@ enum pipe_format {
>>     PIPE_FORMAT_X1B5G5R5_UNORM          = 310,
>>     PIPE_FORMAT_A4B4G4R4_UNORM          = 311,
>>
>> +   PIPE_FORMAT_R64_UINT                = 312,
>> +   PIPE_FORMAT_R64G64_UINT             = 313,
>> +   PIPE_FORMAT_R64G64B64_UINT          = 314,
>> +   PIPE_FORMAT_R64G64B64A64_UINT       = 315,
>> +   PIPE_FORMAT_R64_SINT                = 316,
>> +   PIPE_FORMAT_R64G64_SINT             = 317,
>> +   PIPE_FORMAT_R64G64B64_SINT          = 318,
>> +   PIPE_FORMAT_R64G64B64A64_SINT       = 319,
>> +
>>     PIPE_FORMAT_COUNT
>>  };
>>
>> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
>> index 1e797c24c2a..feafd97f5ee 100644
>> --- a/src/mesa/main/glformats.c
>> +++ b/src/mesa/main/glformats.c
>> @@ -543,6 +543,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
>>     case GL_INT:
>>     case GL_UNSIGNED_INT:
>>        return comps * sizeof(GLint);
>> +   /* ARB_bindless_texture */
>> +   case GL_UNSIGNED_INT64_ARB:
>> +      return comps * sizeof(GLuint64EXT);
>>     case GL_FLOAT:
>>        return comps * sizeof(GLfloat);
>>     case GL_HALF_FLOAT_ARB:
>> diff --git a/src/mesa/state_tracker/st_atom_array.c 
>> b/src/mesa/state_tracker/st_atom_array.c
>> index 2fd67e8d840..1c3f677d4bf 100644
>> --- a/src/mesa/state_tracker/st_atom_array.c
>> +++ b/src/mesa/state_tracker/st_atom_array.c
>> @@ -230,6 +230,27 @@ static const uint16_t vertex_formats[][4][4] = {
>>           PIPE_FORMAT_R32G32B32A32_FIXED
>>        },
>>     },
>> +   {{0}}, /* gap */
>> +   { /* GL_INT64_ARB */
>> +      {0},
>> +      {0},
>> +      {
>> +         PIPE_FORMAT_R64_SINT,
>> +         PIPE_FORMAT_R64G64_SINT,
>> +         PIPE_FORMAT_R64G64B64_SINT,
>> +         PIPE_FORMAT_R64G64B64A64_SINT
>> +      },
>> +   },
>> +   { /* GL_UNSIGNED_INT64_ARB */
>> +      {0},
>> +      {0},
>> +      {
>> +         PIPE_FORMAT_R64_UINT,
>> +         PIPE_FORMAT_R64G64_UINT,
>> +         PIPE_FORMAT_R64G64B64_UINT,
>> +         PIPE_FORMAT_R64G64B64A64_UINT
>> +      },
>> +   },
>
> Since these are never actually passed in via a single vertex attrib,
> is there any way to not add these at all, and just handle the
> conversion from 64-bit to 2x 32-bit entirely internally to st/mesa?
> (Note that R64_FLOAT *can* be actually passed to a driver, and it is
> *not* the ARB_attrib_fp64 case.)
>

I guess this might be possible somehow. Anyway, the current code
depends on vbo_attrtype_to_double_flag returning true for the 64 ->
2x32 split to happen.

init_velement_lowered is called with the double argument set to
attrib->Doubles. I guess we could just |= or the input with a check if
the format is UINT64 or SINT64? attrib->Type should get us this
information. Let me try that.

>>  };
>>
>>
>> @@ -244,7 +265,7 @@ st_pipe_vertex_format(const struct gl_array_attributes 
>> *attrib)
>>     const bool normalized = attrib->Normalized;
>>     const bool integer = attrib->Integer;
>>     GLenum16 type = attrib->Type;
>> -   unsigned index;
>> +   unsigned index = integer*2 + normalized;
>>
>>     assert(size >= 1 && size <= 4);
>>     assert(format == GL_RGBA || format == GL_BGRA);
>> @@ -298,11 +319,14 @@ st_pipe_vertex_format(const struct gl_array_attributes 
>> *attrib)
>>           return PIPE_FORMAT_B8G8R8A8_UNORM;
>>        }
>>        break;
>> +   case GL_UNSIGNED_INT64_ARB:
>> +   case GL_INT64_ARB:
>> +      assert(index == 2);
>> +      break;
>>     }
>>
>> -   index = integer*2 + normalized;
>>     assert(index <= 2);
>> -   assert(type >= GL_BYTE && type <= GL_FIXED);
>> +   assert(type >= GL_BYTE && type <= GL_UNSIGNED_INT64_ARB);
>>     return vertex_formats[type - GL_BYTE][index][size-1];
>>  }
>>
>> diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
>> index 7cc64ecdbcf..fcb65015999 100644
>> --- a/src/mesa/vbo/vbo_private.h
>> +++ b/src/mesa/vbo/vbo_private.h
>> @@ -98,8 +98,8 @@ vbo_attrtype_to_double_flag(GLenum format)
>>     case GL_FLOAT:
>>     case GL_INT:
>>     case GL_UNSIGNED_INT:
>> -   case GL_UNSIGNED_INT64_ARB:
>>        return GL_FALSE;
>> +   case GL_UNSIGNED_INT64_ARB:
>>     case GL_DOUBLE:
>>        return GL_TRUE;
>>     default:
>> --
>> 2.14.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to