Mesa (staging/21.0): mesa: fix incomplete GL_NV_half_float implementation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 27 16:37:52 UTC 2021
Module: Mesa
Branch: staging/21.0
Commit: 1368c405349de1b9819d6c0d14e1b528a31334a9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1368c405349de1b9819d6c0d14e1b528a31334a9
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Fri Apr 23 20:39:50 2021 +1000
mesa: fix incomplete GL_NV_half_float implementation
All of the VertexAttrib* functions were missing.
Fixes: ef66e02a408c ("src/mesa: add GL_NV_half_float extension support (v2)")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10431>
(cherry picked from commit a02a0df2a264c20fd6ac7f4faaddcea89e572da6)
---
.pick_status.json | 2 +-
src/mapi/glapi/gen/NV_half_float.xml | 70 +++++++++++++++++
src/mapi/glapi/gen/static_data.py | 12 +++
src/mesa/main/dd.h | 12 +++
src/mesa/main/tests/dispatch_sanity.cpp | 12 +++
src/mesa/main/vtxfmt.c | 12 +++
src/mesa/vbo/vbo_attrib_tmp.h | 135 ++++++++++++++++++++++++++++++++
src/mesa/vbo/vbo_init_tmp.h | 12 +++
8 files changed, 266 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index 9c2dec6c140..ea8dcb43790 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -868,7 +868,7 @@
"description": "mesa: fix incomplete GL_NV_half_float implementation",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "ef66e02a408c4b8d11a3b7122b0e8e05ffac8eb8"
},
diff --git a/src/mapi/glapi/gen/NV_half_float.xml b/src/mapi/glapi/gen/NV_half_float.xml
index b248e6d7b45..a5ed7e1b6d9 100644
--- a/src/mapi/glapi/gen/NV_half_float.xml
+++ b/src/mapi/glapi/gen/NV_half_float.xml
@@ -150,6 +150,76 @@
<param name="v" type="const GLhalfNV *"/>
</function>
+ <function name="VertexAttrib1hNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="x" type="GLhalfNV"/>
+ </function>
+
+ <function name="VertexAttrib1hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="v" type="const GLhalfNV *" count="1"/>
+ </function>
+
+ <function name="VertexAttrib2hNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="x" type="GLhalfNV"/>
+ <param name="y" type="GLhalfNV"/>
+ </function>
+
+ <function name="VertexAttrib2hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="v" type="const GLhalfNV *" count="2"/>
+ </function>
+
+ <function name="VertexAttrib3hNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="x" type="GLhalfNV"/>
+ <param name="y" type="GLhalfNV"/>
+ <param name="z" type="GLhalfNV"/>
+ </function>
+
+ <function name="VertexAttrib3hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="v" type="const GLhalfNV *" count="3"/>
+ </function>
+
+ <function name="VertexAttrib4hNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="x" type="GLhalfNV"/>
+ <param name="y" type="GLhalfNV"/>
+ <param name="z" type="GLhalfNV"/>
+ <param name="w" type="GLhalfNV"/>
+ </function>
+
+ <function name="VertexAttrib4hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="v" type="const GLhalfNV *" count="4"/>
+ </function>
+
+ <function name="VertexAttribs1hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="n" type="GLsizei"/>
+ <param name="v" type="const GLhalfNV *" count="n"/>
+ </function>
+
+ <function name="VertexAttribs2hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="n" type="GLsizei"/>
+ <param name="v" type="const GLhalfNV *" count="n" count_scale="2"/>
+ </function>
+
+ <function name="VertexAttribs3hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="n" type="GLsizei"/>
+ <param name="v" type="const GLhalfNV *" count="n" count_scale="3"/>
+ </function>
+
+ <function name="VertexAttribs4hvNV" exec="dynamic" deprecated="3.1">
+ <param name="index" type="GLuint"/>
+ <param name="n" type="GLsizei"/>
+ <param name="v" type="const GLhalfNV *" count="n" count_scale="4"/>
+ </function>
+
<function name="FogCoordhNV" exec="dynamic" deprecated="3.1">
<param name="x" type="GLhalfNV"/>
</function>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 5b51c222d79..6accff1b231 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1677,6 +1677,18 @@ offsets = {
"SecondaryColor3hNV": 1641,
"SecondaryColor3hvNV": 1642,
"InternalSetError": 1643,
+ "VertexAttrib1hNV": 1644,
+ "VertexAttrib1hvNV": 1645,
+ "VertexAttrib2hNV": 1646,
+ "VertexAttrib2hvNV": 1647,
+ "VertexAttrib3hNV": 1648,
+ "VertexAttrib3hvNV": 1649,
+ "VertexAttrib4hNV": 1650,
+ "VertexAttrib4hvNV": 1651,
+ "VertexAttribs1hvNV": 1652,
+ "VertexAttribs2hvNV": 1653,
+ "VertexAttribs3hvNV": 1654,
+ "VertexAttribs4hvNV": 1655,
}
functions = [
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 3eaf20f061d..94174683e95 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1589,6 +1589,18 @@ typedef struct {
void (GLAPIENTRYP MultiTexCoord3hvNV)( GLenum, const GLhalfNV * );
void (GLAPIENTRYP MultiTexCoord4hNV)( GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV );
void (GLAPIENTRYP MultiTexCoord4hvNV)( GLenum, const GLhalfNV * );
+ void (GLAPIENTRYP VertexAttrib1hNV)( GLuint index, GLhalfNV x );
+ void (GLAPIENTRYP VertexAttrib1hvNV)( GLuint index, const GLhalfNV *v );
+ void (GLAPIENTRYP VertexAttrib2hNV)( GLuint index, GLhalfNV x, GLhalfNV y );
+ void (GLAPIENTRYP VertexAttrib2hvNV)( GLuint index, const GLhalfNV *v );
+ void (GLAPIENTRYP VertexAttrib3hNV)( GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z );
+ void (GLAPIENTRYP VertexAttrib3hvNV)( GLuint index, const GLhalfNV *v );
+ void (GLAPIENTRYP VertexAttrib4hNV)( GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w );
+ void (GLAPIENTRYP VertexAttrib4hvNV)( GLuint index, const GLhalfNV *v );
+ void (GLAPIENTRYP VertexAttribs1hvNV)(GLuint index, GLsizei n, const GLhalfNV *v);
+ void (GLAPIENTRYP VertexAttribs2hvNV)(GLuint index, GLsizei n, const GLhalfNV *v);
+ void (GLAPIENTRYP VertexAttribs3hvNV)(GLuint index, GLsizei n, const GLhalfNV *v);
+ void (GLAPIENTRYP VertexAttribs4hvNV)(GLuint index, GLsizei n, const GLhalfNV *v);
void (GLAPIENTRYP FogCoordhNV)( GLhalfNV );
void (GLAPIENTRYP FogCoordhvNV)( const GLhalfNV * );
void (GLAPIENTRYP SecondaryColor3hNV)( GLhalfNV, GLhalfNV, GLhalfNV );
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index bbb3ee03791..01af3ac2245 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1978,6 +1978,18 @@ const struct function gl_compatibility_functions_possible[] = {
{ "glFogCoordhvNV", 13, -1 },
{ "glSecondaryColor3hNV", 13, -1 },
{ "glSecondaryColor3hvNV", 13, -1 },
+ { "glVertexAttrib1hNV", 13, -1 },
+ { "glVertexAttrib1hvNV", 13, -1 },
+ { "glVertexAttrib2hNV", 13, -1 },
+ { "glVertexAttrib2hvNV", 13, -1 },
+ { "glVertexAttrib3hNV", 13, -1 },
+ { "glVertexAttrib3hvNV", 13, -1 },
+ { "glVertexAttrib4hNV", 13, -1 },
+ { "glVertexAttrib4hvNV", 13, -1 },
+ { "glVertexAttribs1hvNV", 13, -1 },
+ { "glVertexAttribs2hvNV", 13, -1 },
+ { "glVertexAttribs3hvNV", 13, -1 },
+ { "glVertexAttribs4hvNV", 13, -1 },
{ NULL, 0, -1 }
};
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 007dd75b3b3..d2e75d2b0c2 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -223,6 +223,18 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_MultiTexCoord3hvNV(tab, vfmt->MultiTexCoord3hvNV);
SET_MultiTexCoord4hNV(tab, vfmt->MultiTexCoord4hNV);
SET_MultiTexCoord4hvNV(tab, vfmt->MultiTexCoord4hvNV);
+ SET_VertexAttrib1hNV(tab, vfmt->VertexAttrib1hNV);
+ SET_VertexAttrib2hNV(tab, vfmt->VertexAttrib2hNV);
+ SET_VertexAttrib3hNV(tab, vfmt->VertexAttrib3hNV);
+ SET_VertexAttrib4hNV(tab, vfmt->VertexAttrib4hNV);
+ SET_VertexAttrib1hvNV(tab, vfmt->VertexAttrib1hvNV);
+ SET_VertexAttrib2hvNV(tab, vfmt->VertexAttrib2hvNV);
+ SET_VertexAttrib3hvNV(tab, vfmt->VertexAttrib3hvNV);
+ SET_VertexAttrib4hvNV(tab, vfmt->VertexAttrib4hvNV);
+ SET_VertexAttribs1hvNV(tab, vfmt->VertexAttribs1hvNV);
+ SET_VertexAttribs2hvNV(tab, vfmt->VertexAttribs2hvNV);
+ SET_VertexAttribs3hvNV(tab, vfmt->VertexAttribs3hvNV);
+ SET_VertexAttribs4hvNV(tab, vfmt->VertexAttribs4hvNV);
SET_FogCoordhNV(tab, vfmt->FogCoordhNV);
SET_FogCoordhvNV(tab, vfmt->FogCoordhvNV);
SET_SecondaryColor3hNV(tab, vfmt->SecondaryColor3hNV);
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index 8d65bab7671..74174f757d9 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -1476,6 +1476,141 @@ TAG(MultiTexCoord4hvNV)(GLenum target, const GLhalfNV * v)
+static void GLAPIENTRY
+TAG(VertexAttrib1hNV)(GLuint index, GLhalfNV x)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR1H(0, x);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR1H(VBO_ATTRIB_GENERIC0 + index, x);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib2hNV)(GLuint index, GLhalfNV x, GLhalfNV y)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR2H(0, x, y);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR2H(VBO_ATTRIB_GENERIC0 + index, x, y);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib3hNV)(GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR3H(0, x, y, z);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR3H(VBO_ATTRIB_GENERIC0 + index, x, y, z);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib4hNV)(GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR4H(0, x, y, z, w);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR4H(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib1hvNV)(GLuint index, const GLhalfNV * v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR1HV(0, v);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR1HV(VBO_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib2hvNV)(GLuint index, const GLhalfNV * v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR2HV(0, v);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR2HV(VBO_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib3hvNV)(GLuint index, const GLhalfNV * v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR3HV(0, v);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR3HV(VBO_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttrib4hvNV)(GLuint index, const GLhalfNV * v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_vertex_position(ctx, index))
+ ATTR4HV(0, v);
+ else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+ ATTR4HV(VBO_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR(GL_INVALID_VALUE);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttribs1hvNV)(GLuint index, GLsizei n, const GLhalfNV *v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ n = MIN2(n, VBO_ATTRIB_MAX - index);
+ for (GLint i = n - 1; i >= 0; i--)
+ ATTR1H(index + i, v[i]);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttribs2hvNV)(GLuint index, GLsizei n, const GLhalfNV *v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ n = MIN2(n, VBO_ATTRIB_MAX - index);
+ for (GLint i = n - 1; i >= 0; i--)
+ ATTR2H(index + i, v[2 * i], v[2 * i + 1]);
+}
+
+static void GLAPIENTRY
+TAG(VertexAttribs3hvNV)(GLuint index, GLsizei n, const GLhalfNV *v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ n = MIN2(n, VBO_ATTRIB_MAX - index);
+ for (GLint i = n - 1; i >= 0; i--)
+ ATTR3H(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]);
+}
+
+
+static void GLAPIENTRY
+TAG(VertexAttribs4hvNV)(GLuint index, GLsizei n, const GLhalfNV *v)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ n = MIN2(n, VBO_ATTRIB_MAX - index);
+ for (GLint i = n - 1; i >= 0; i--)
+ ATTR4H(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]);
+}
+
+
+
static void GLAPIENTRY
TAG(FogCoordhNV)(GLhalf x)
{
diff --git a/src/mesa/vbo/vbo_init_tmp.h b/src/mesa/vbo/vbo_init_tmp.h
index 74c81d5dd16..55295238e73 100644
--- a/src/mesa/vbo/vbo_init_tmp.h
+++ b/src/mesa/vbo/vbo_init_tmp.h
@@ -123,6 +123,18 @@ vfmt->MultiTexCoord3hNV = NAME(MultiTexCoord3hNV);
vfmt->MultiTexCoord3hvNV = NAME(MultiTexCoord3hvNV);
vfmt->MultiTexCoord4hNV = NAME(MultiTexCoord4hNV);
vfmt->MultiTexCoord4hvNV = NAME(MultiTexCoord4hvNV);
+vfmt->VertexAttrib1hNV = NAME(VertexAttrib1hNV);
+vfmt->VertexAttrib2hNV = NAME(VertexAttrib2hNV);
+vfmt->VertexAttrib3hNV = NAME(VertexAttrib3hNV);
+vfmt->VertexAttrib4hNV = NAME(VertexAttrib4hNV);
+vfmt->VertexAttrib1hvNV = NAME(VertexAttrib1hvNV);
+vfmt->VertexAttrib2hvNV = NAME(VertexAttrib2hvNV);
+vfmt->VertexAttrib3hvNV = NAME(VertexAttrib3hvNV);
+vfmt->VertexAttrib4hvNV = NAME(VertexAttrib4hvNV);
+vfmt->VertexAttribs1hvNV = NAME(VertexAttribs1hvNV);
+vfmt->VertexAttribs2hvNV = NAME(VertexAttribs2hvNV);
+vfmt->VertexAttribs3hvNV = NAME(VertexAttribs3hvNV);
+vfmt->VertexAttribs4hvNV = NAME(VertexAttribs4hvNV);
vfmt->FogCoordhNV = NAME(FogCoordhNV);
vfmt->FogCoordhvNV = NAME(FogCoordhvNV);
vfmt->SecondaryColor3hNV = NAME(SecondaryColor3hNV);
More information about the mesa-commit
mailing list