mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
Mesa: Add support for HALF_FLOAT_OES type.
This patch adds needed support for accepting HALF_FLOAT_OES as valid type for TexImage*D and TexSubImage*D when Texture FLoat extensions are supported. Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com> Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
This commit is contained in:
parent
a63c8a524b
commit
2c2a92d5b8
4 changed files with 52 additions and 6 deletions
|
|
@ -291,6 +291,7 @@ _mesa_sizeof_type(GLenum type)
|
||||||
case GL_DOUBLE:
|
case GL_DOUBLE:
|
||||||
return sizeof(GLdouble);
|
return sizeof(GLdouble);
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
return sizeof(GLhalfARB);
|
return sizeof(GLhalfARB);
|
||||||
case GL_FIXED:
|
case GL_FIXED:
|
||||||
return sizeof(GLfixed);
|
return sizeof(GLfixed);
|
||||||
|
|
@ -323,6 +324,7 @@ _mesa_sizeof_packed_type(GLenum type)
|
||||||
case GL_INT:
|
case GL_INT:
|
||||||
return sizeof(GLint);
|
return sizeof(GLint);
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
return sizeof(GLhalfARB);
|
return sizeof(GLhalfARB);
|
||||||
case GL_FLOAT:
|
case GL_FLOAT:
|
||||||
return sizeof(GLfloat);
|
return sizeof(GLfloat);
|
||||||
|
|
@ -439,6 +441,7 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type)
|
||||||
case GL_FLOAT:
|
case GL_FLOAT:
|
||||||
return comps * sizeof(GLfloat);
|
return comps * sizeof(GLfloat);
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
return comps * sizeof(GLhalfARB);
|
return comps * sizeof(GLhalfARB);
|
||||||
case GL_UNSIGNED_BYTE_3_3_2:
|
case GL_UNSIGNED_BYTE_3_3_2:
|
||||||
case GL_UNSIGNED_BYTE_2_3_3_REV:
|
case GL_UNSIGNED_BYTE_2_3_3_REV:
|
||||||
|
|
@ -1667,6 +1670,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
||||||
}
|
}
|
||||||
return GL_NO_ERROR;
|
return GL_NO_ERROR;
|
||||||
|
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
|
switch (format) {
|
||||||
|
case GL_RGBA:
|
||||||
|
case GL_RGB:
|
||||||
|
case GL_LUMINANCE_ALPHA:
|
||||||
|
case GL_LUMINANCE:
|
||||||
|
case GL_ALPHA:
|
||||||
|
return GL_NO_ERROR;
|
||||||
|
default:
|
||||||
|
return GL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
; /* fall-through */
|
; /* fall-through */
|
||||||
}
|
}
|
||||||
|
|
@ -2019,7 +2034,8 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type,
|
||||||
* \return error code, or GL_NO_ERROR.
|
* \return error code, or GL_NO_ERROR.
|
||||||
*/
|
*/
|
||||||
GLenum
|
GLenum
|
||||||
_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
_mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
|
||||||
|
GLenum format, GLenum type,
|
||||||
GLenum internalFormat)
|
GLenum internalFormat)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
|
@ -2084,11 +2100,17 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
||||||
case GL_RGBA16F:
|
case GL_RGBA16F:
|
||||||
case GL_RGBA32F:
|
case GL_RGBA32F:
|
||||||
break;
|
break;
|
||||||
|
case GL_RGBA:
|
||||||
|
if (ctx->Extensions.OES_texture_float && internalFormat == format)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return GL_INVALID_OPERATION;
|
return GL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
|
if (ctx->Extensions.OES_texture_half_float && internalFormat == format)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return GL_INVALID_OPERATION;
|
return GL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
@ -2193,11 +2215,19 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
||||||
case GL_R11F_G11F_B10F:
|
case GL_R11F_G11F_B10F:
|
||||||
case GL_RGB9_E5:
|
case GL_RGB9_E5:
|
||||||
break;
|
break;
|
||||||
|
case GL_RGB:
|
||||||
|
if (ctx->Extensions.OES_texture_float && internalFormat == format)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return GL_INVALID_OPERATION;
|
return GL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
|
if (!ctx->Extensions.OES_texture_half_float || internalFormat != format)
|
||||||
|
return GL_INVALID_OPERATION;
|
||||||
|
break;
|
||||||
|
|
||||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
case GL_RGB: /* GL_EXT_texture_type_2_10_10_10_REV */
|
case GL_RGB: /* GL_EXT_texture_type_2_10_10_10_REV */
|
||||||
|
|
@ -2437,9 +2467,17 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
||||||
case GL_ALPHA:
|
case GL_ALPHA:
|
||||||
case GL_LUMINANCE:
|
case GL_LUMINANCE:
|
||||||
case GL_LUMINANCE_ALPHA:
|
case GL_LUMINANCE_ALPHA:
|
||||||
if (type != GL_UNSIGNED_BYTE || format != internalFormat)
|
switch (type) {
|
||||||
return GL_INVALID_OPERATION;
|
case GL_FLOAT:
|
||||||
break;
|
if (ctx->Extensions.OES_texture_float && internalFormat == format)
|
||||||
|
break;
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
|
if (ctx->Extensions.OES_texture_half_float && internalFormat == format)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (type != GL_UNSIGNED_BYTE || format != internalFormat)
|
||||||
|
return GL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GL_NO_ERROR;
|
return GL_NO_ERROR;
|
||||||
|
|
@ -2563,6 +2601,7 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
|
||||||
is_signed = true;
|
is_signed = true;
|
||||||
break;
|
break;
|
||||||
case GL_HALF_FLOAT:
|
case GL_HALF_FLOAT:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
type_size = 2;
|
type_size = 2;
|
||||||
is_signed = true;
|
is_signed = true;
|
||||||
is_float = true;
|
is_float = true;
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,8 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type,
|
||||||
unsigned dimensions);
|
unsigned dimensions);
|
||||||
|
|
||||||
extern GLenum
|
extern GLenum
|
||||||
_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
_mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
|
||||||
|
GLenum format, GLenum type,
|
||||||
GLenum internalFormat);
|
GLenum internalFormat);
|
||||||
|
|
||||||
extern uint32_t
|
extern uint32_t
|
||||||
|
|
|
||||||
|
|
@ -268,6 +268,7 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
|
||||||
srcType == GL_INT ||
|
srcType == GL_INT ||
|
||||||
srcType == GL_UNSIGNED_INT_24_8_EXT ||
|
srcType == GL_UNSIGNED_INT_24_8_EXT ||
|
||||||
srcType == GL_HALF_FLOAT_ARB ||
|
srcType == GL_HALF_FLOAT_ARB ||
|
||||||
|
srcType == GL_HALF_FLOAT_OES ||
|
||||||
srcType == GL_FLOAT ||
|
srcType == GL_FLOAT ||
|
||||||
srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
|
srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
|
||||||
|
|
||||||
|
|
@ -407,6 +408,7 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
{
|
{
|
||||||
GLuint i;
|
GLuint i;
|
||||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||||
|
|
@ -510,6 +512,7 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
|
||||||
srcType == GL_INT ||
|
srcType == GL_INT ||
|
||||||
srcType == GL_UNSIGNED_INT_24_8_EXT ||
|
srcType == GL_UNSIGNED_INT_24_8_EXT ||
|
||||||
srcType == GL_HALF_FLOAT_ARB ||
|
srcType == GL_HALF_FLOAT_ARB ||
|
||||||
|
srcType == GL_HALF_FLOAT_OES ||
|
||||||
srcType == GL_FLOAT ||
|
srcType == GL_FLOAT ||
|
||||||
srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
|
srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
|
||||||
|
|
||||||
|
|
@ -700,6 +703,7 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
{
|
{
|
||||||
GLhalfARB *dst = (GLhalfARB *) dest;
|
GLhalfARB *dst = (GLhalfARB *) dest;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
@ -917,6 +921,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
|
||||||
needClamp = GL_TRUE;
|
needClamp = GL_TRUE;
|
||||||
break;
|
break;
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
{
|
{
|
||||||
GLuint i;
|
GLuint i;
|
||||||
const GLhalfARB *src = (const GLhalfARB *) source;
|
const GLhalfARB *src = (const GLhalfARB *) source;
|
||||||
|
|
@ -1106,6 +1111,7 @@ _mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_HALF_FLOAT_ARB:
|
case GL_HALF_FLOAT_ARB:
|
||||||
|
case GL_HALF_FLOAT_OES:
|
||||||
{
|
{
|
||||||
GLhalfARB *dst = (GLhalfARB *) dest;
|
GLhalfARB *dst = (GLhalfARB *) dest;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
|
||||||
|
|
@ -2120,7 +2120,7 @@ texture_error_check( struct gl_context *ctx,
|
||||||
|
|
||||||
if (_mesa_is_gles(ctx)) {
|
if (_mesa_is_gles(ctx)) {
|
||||||
if (_mesa_is_gles3(ctx)) {
|
if (_mesa_is_gles3(ctx)) {
|
||||||
err = _mesa_es3_error_check_format_and_type(format, type,
|
err = _mesa_es3_error_check_format_and_type(ctx, format, type,
|
||||||
internalFormat);
|
internalFormat);
|
||||||
} else {
|
} else {
|
||||||
if (format != internalFormat) {
|
if (format != internalFormat) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue