mesa: add core support for ARB_half_float_vertex.
Adds the extension to the list + support to the APIs. also add t_draw.c support to convert for sw rast. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -56,6 +56,7 @@ static const struct {
|
|||||||
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
|
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
|
||||||
{ OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
|
{ OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
|
||||||
{ OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
|
{ OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
|
||||||
|
{ OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) },
|
||||||
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
|
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
|
||||||
{ OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) },
|
{ OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) },
|
||||||
{ ON, "GL_ARB_multisample", F(ARB_multisample) },
|
{ ON, "GL_ARB_multisample", F(ARB_multisample) },
|
||||||
@@ -220,6 +221,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
|
|||||||
ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
|
ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
|
||||||
#endif
|
#endif
|
||||||
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
|
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
|
||||||
|
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
|
||||||
ctx->Extensions.ARB_imaging = GL_TRUE;
|
ctx->Extensions.ARB_imaging = GL_TRUE;
|
||||||
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
|
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
|
||||||
ctx->Extensions.ARB_multitexture = GL_TRUE;
|
ctx->Extensions.ARB_multitexture = GL_TRUE;
|
||||||
|
@@ -2403,6 +2403,7 @@ struct gl_extensions
|
|||||||
GLboolean ARB_fragment_shader;
|
GLboolean ARB_fragment_shader;
|
||||||
GLboolean ARB_framebuffer_object;
|
GLboolean ARB_framebuffer_object;
|
||||||
GLboolean ARB_half_float_pixel;
|
GLboolean ARB_half_float_pixel;
|
||||||
|
GLboolean ARB_half_float_vertex;
|
||||||
GLboolean ARB_imaging;
|
GLboolean ARB_imaging;
|
||||||
GLboolean ARB_map_buffer_range;
|
GLboolean ARB_map_buffer_range;
|
||||||
GLboolean ARB_multisample;
|
GLboolean ARB_multisample;
|
||||||
|
@@ -121,6 +121,9 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = size * sizeof(GLdouble);
|
elementSize = size * sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = size * sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
#if FEATURE_fixedpt
|
#if FEATURE_fixedpt
|
||||||
case GL_FIXED:
|
case GL_FIXED:
|
||||||
elementSize = size * sizeof(GLfixed);
|
elementSize = size * sizeof(GLfixed);
|
||||||
@@ -174,6 +177,9 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = 3 * sizeof(GLdouble);
|
elementSize = 3 * sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = 3 * sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
#if FEATURE_fixedpt
|
#if FEATURE_fixedpt
|
||||||
case GL_FIXED:
|
case GL_FIXED:
|
||||||
elementSize = 3 * sizeof(GLfixed);
|
elementSize = 3 * sizeof(GLfixed);
|
||||||
@@ -250,6 +256,9 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = size * sizeof(GLdouble);
|
elementSize = size * sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = size * sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
#if FEATURE_fixedpt
|
#if FEATURE_fixedpt
|
||||||
case GL_FIXED:
|
case GL_FIXED:
|
||||||
elementSize = size * sizeof(GLfixed);
|
elementSize = size * sizeof(GLfixed);
|
||||||
@@ -285,6 +294,9 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = sizeof(GLdouble);
|
elementSize = sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" );
|
_mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" );
|
||||||
return;
|
return;
|
||||||
@@ -394,6 +406,9 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = size * sizeof(GLdouble);
|
elementSize = size * sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = size * sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type=%s)",
|
_mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type=%s)",
|
||||||
_mesa_lookup_enum_by_nr(type));
|
_mesa_lookup_enum_by_nr(type));
|
||||||
@@ -441,6 +456,9 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = size * sizeof(GLdouble);
|
elementSize = size * sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = size * sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
#if FEATURE_fixedpt
|
#if FEATURE_fixedpt
|
||||||
case GL_FIXED:
|
case GL_FIXED:
|
||||||
elementSize = size * sizeof(GLfixed);
|
elementSize = size * sizeof(GLfixed);
|
||||||
@@ -670,6 +688,9 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
elementSize = size * sizeof(GLdouble);
|
elementSize = size * sizeof(GLdouble);
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
elementSize = size * sizeof(GLhalfARB);
|
||||||
|
break;
|
||||||
#if FEATURE_fixedpt
|
#if FEATURE_fixedpt
|
||||||
case GL_FIXED:
|
case GL_FIXED:
|
||||||
elementSize = size * sizeof(GLfixed);
|
elementSize = size * sizeof(GLfixed);
|
||||||
|
@@ -108,6 +108,22 @@ convert_bgra_to_float(const struct gl_client_array *input,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_half_to_float(const struct gl_client_array *input,
|
||||||
|
const GLubyte *ptr, GLfloat *fptr,
|
||||||
|
GLuint count, GLuint sz)
|
||||||
|
{
|
||||||
|
GLuint i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
GLhalfARB *in = (GLhalfARB *)ptr;
|
||||||
|
|
||||||
|
for (j = 0; j < sz; j++) {
|
||||||
|
*fptr++ = _mesa_half_to_float(in[j]);
|
||||||
|
}
|
||||||
|
ptr += input->StrideB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Adjust pointer to point at first requested element, convert to
|
/* Adjust pointer to point at first requested element, convert to
|
||||||
* floating point, populate VB->AttribPtr[].
|
* floating point, populate VB->AttribPtr[].
|
||||||
@@ -155,6 +171,9 @@ static void _tnl_import_array( GLcontext *ctx,
|
|||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
CONVERT(GLdouble, (GLfloat));
|
CONVERT(GLdouble, (GLfloat));
|
||||||
break;
|
break;
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
|
convert_half_to_float(input, ptr, fptr, count, sz);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user