[Mesa-dev] [PATCH] RFC gallium: add 64 bit integer formats
Marek Olšák
maraeo at gmail.com
Tue Apr 10 18:15:49 UTC 2018
On Mon, Apr 9, 2018 at 9:14 PM, Karol Herbst <kherbst at redhat.com> wrote:
> On Tue, Apr 10, 2018 at 2:43 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> > On Mon, Apr 9, 2018 at 8:39 PM, Karol Herbst <kherbst at 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 <kherbst at 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.
>
R64.._FLOAT formats are special, because they are converted to 32 bits by
vertex fetches.
Real 64-bit double vertex formats are not representable in Gallium. st/mesa
uses 2x and 4x 32_UINT for double and dvec2, respectively.
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180410/4be275f3/attachment.html>
More information about the mesa-dev
mailing list