summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glformats.c
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2018-04-06 10:57:57 +0300
committerTapani Pälli <[email protected]>2018-04-25 14:26:20 +0300
commit7f467d4f73828ba782a2db38c74d33b85646dc85 (patch)
treebef23cd7feb9528863e4ab8acf43d3129eb6224a /src/mesa/main/glformats.c
parentb0c57740278f6c05b9b514e0011bb3646acd97ef (diff)
mesa: GL_EXT_texture_norm16 extension plumbing
Patch enables use of short and unsigned short data for texture uploads, rendering and reading of framebuffers within the restrictions specified in GL_EXT_texture_norm16 spec. Patch also enables those 16bit format layout qualifiers listed in GL_NV_image_formats that depend on EXT_texture_norm16. v2: expose extension with dummy_true fix layout qualifier map changes (Ilia Mirkin) v3: use _mesa_has_EXT_texture_norm16, other fixes and cleanup (Ilia Mirkin) v4: fix rest of the issues found Signed-off-by: Tapani Pälli <[email protected]> Acked-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/glformats.c')
-rw-r--r--src/mesa/main/glformats.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 1e797c24c2a..cba5e670db0 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2857,6 +2857,17 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
return GL_INVALID_OPERATION;
break;
+ case GL_UNSIGNED_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) || internalFormat != GL_RGBA16)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) ||
+ internalFormat != GL_RGBA16_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
case GL_UNSIGNED_SHORT_4_4_4_4:
switch (internalFormat) {
case GL_RGBA:
@@ -2984,6 +2995,17 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
return GL_INVALID_OPERATION;
break;
+ case GL_UNSIGNED_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) || internalFormat != GL_RGB16)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) ||
+ internalFormat != GL_RGB16_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
case GL_UNSIGNED_SHORT_5_6_5:
switch (internalFormat) {
case GL_RGB:
@@ -3115,6 +3137,17 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
return GL_INVALID_OPERATION;
break;
+ case GL_UNSIGNED_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) || internalFormat != GL_RG16)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) ||
+ internalFormat != GL_RG16_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
case GL_HALF_FLOAT:
case GL_HALF_FLOAT_OES:
switch (internalFormat) {
@@ -3205,6 +3238,17 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
return GL_INVALID_OPERATION;
break;
+ case GL_UNSIGNED_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) || internalFormat != GL_R16)
+ return GL_INVALID_OPERATION;
+ break;
+
+ case GL_SHORT:
+ if (!_mesa_has_EXT_texture_norm16(ctx) ||
+ internalFormat != GL_R16_SNORM)
+ return GL_INVALID_OPERATION;
+ break;
+
case GL_HALF_FLOAT:
case GL_HALF_FLOAT_OES:
switch (internalFormat) {
@@ -3704,7 +3748,8 @@ _mesa_tex_format_from_format_and_type(const struct gl_context *ctx,
* is marked "Color Renderable" in Table 8.10 of the ES 3.2 specification.
*/
bool
-_mesa_is_es3_color_renderable(GLenum internal_format)
+_mesa_is_es3_color_renderable(const struct gl_context *ctx,
+ GLenum internal_format)
{
switch (internal_format) {
case GL_R8:
@@ -3743,6 +3788,10 @@ _mesa_is_es3_color_renderable(GLenum internal_format)
case GL_RGBA32I:
case GL_RGBA32UI:
return true;
+ case GL_R16:
+ case GL_RG16:
+ case GL_RGBA16:
+ return _mesa_has_EXT_texture_norm16(ctx);
default:
return false;
}
@@ -3778,6 +3827,15 @@ _mesa_is_es3_texture_filterable(const struct gl_context *ctx,
case GL_R11F_G11F_B10F:
case GL_RGB9_E5:
return true;
+ case GL_R16:
+ case GL_R16_SNORM:
+ case GL_RG16:
+ case GL_RG16_SNORM:
+ case GL_RGB16:
+ case GL_RGB16_SNORM:
+ case GL_RGBA16:
+ case GL_RGBA16_SNORM:
+ return _mesa_has_EXT_texture_norm16(ctx);
case GL_R32F:
case GL_RG32F:
case GL_RGB32F: