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 <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
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.
*/
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) {
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
}
}
- if (ctx->Extensions.ARB_depth_buffer_float) {
+ if (_mesa_has_float_depth_buffer(ctx)) {
switch (internalFormat) {
case GL_DEPTH_COMPONENT32F:
return GL_DEPTH_COMPONENT;