summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2018-11-15 17:02:32 +0100
committerErik Faye-Lund <[email protected]>2018-12-03 18:16:44 +0100
commit83db9d3e3a6db6ea21a8c09637a133baf9b4ecac (patch)
treee07af470510941ce14ca45438ec88a668bcff32c /src
parent3bbd543b6ef1a59e5edb940915d822514a43e467 (diff)
mesa/main: do not allow ARB_depth_buffer_float enums before gles3
Floating-point depth buffers are only supported on OpenGL 3.0, OpenGL ES 3.0, or if ARB_depth_buffer_float is supported. Because we checked a driver capability rather than using an extension-check helper, we ended up incorrectly allowing this on OpenGL ES 1.x and 2.x. Since this logic is repeated, let's make a helper for it. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/context.h6
-rw-r--r--src/mesa/main/glformats.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index c51b3c17c0d..14f9a6b8987 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -349,6 +349,12 @@ _mesa_has_texture_rgb10_a2ui(const struct gl_context *ctx)
return _mesa_has_ARB_texture_rgb10_a2ui(ctx) || _mesa_is_gles3(ctx);
}
+static inline bool
+_mesa_has_float_depth_buffer(const struct gl_context *ctx)
+{
+ return _mesa_has_ARB_depth_buffer_float(ctx) || _mesa_is_gles3(ctx);
+}
+
/**
* Checks if the context supports geometry shaders.
*/
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 76f1f9a28b7..a4b17a85b09 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1849,7 +1849,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
return GL_NO_ERROR;
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
- if (!ctx->Extensions.ARB_depth_buffer_float) {
+ if (!_mesa_has_float_depth_buffer(ctx)) {
return GL_INVALID_ENUM;
}
if (format != GL_DEPTH_STENCIL) {
@@ -2048,7 +2048,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_DEPTH_STENCIL:
if (type == GL_UNSIGNED_INT_24_8)
return GL_NO_ERROR;
- else if (ctx->Extensions.ARB_depth_buffer_float &&
+ else if (_mesa_has_float_depth_buffer(ctx) &&
type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV)
return GL_NO_ERROR;
else
@@ -2607,7 +2607,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
}
}
- if (ctx->Extensions.ARB_depth_buffer_float) {
+ if (_mesa_has_float_depth_buffer(ctx)) {
switch (internalFormat) {
case GL_DEPTH_COMPONENT32F:
return GL_DEPTH_COMPONENT;