mesa/main: add gles-compatible check helpers
We need to perform these checks fairly often; let's create helpers for them. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31039>
This commit is contained in:
committed by
Marge Bot
parent
dfc13fcf9f
commit
97b8febf3d
@@ -238,26 +238,25 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_mesa_is_gles2(ctx) || ctx->Extensions.ARB_ES2_compatibility) {
|
||||
if (_mesa_is_gles2_compatible(ctx)) {
|
||||
this->supported_versions[this->num_supported_versions].ver = 100;
|
||||
this->supported_versions[this->num_supported_versions].gl_ver = 20;
|
||||
this->supported_versions[this->num_supported_versions].es = true;
|
||||
this->num_supported_versions++;
|
||||
}
|
||||
if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility) {
|
||||
if (_mesa_is_gles3_compatible(ctx)) {
|
||||
this->supported_versions[this->num_supported_versions].ver = 300;
|
||||
this->supported_versions[this->num_supported_versions].gl_ver = 30;
|
||||
this->supported_versions[this->num_supported_versions].es = true;
|
||||
this->num_supported_versions++;
|
||||
}
|
||||
if (_mesa_is_gles31(ctx) || ctx->Extensions.ARB_ES3_1_compatibility) {
|
||||
if (_mesa_is_gles31_compatible(ctx)) {
|
||||
this->supported_versions[this->num_supported_versions].ver = 310;
|
||||
this->supported_versions[this->num_supported_versions].gl_ver = 31;
|
||||
this->supported_versions[this->num_supported_versions].es = true;
|
||||
this->num_supported_versions++;
|
||||
}
|
||||
if (_mesa_is_gles32(ctx) ||
|
||||
ctx->Extensions.ARB_ES3_2_compatibility) {
|
||||
if (_mesa_is_gles32_compatible(ctx)) {
|
||||
this->supported_versions[this->num_supported_versions].ver = 320;
|
||||
this->supported_versions[this->num_supported_versions].gl_ver = 32;
|
||||
this->supported_versions[this->num_supported_versions].es = true;
|
||||
|
||||
@@ -345,6 +345,34 @@ _mesa_is_gles32(const struct gl_context *ctx)
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
_mesa_is_gles2_compatible(const struct gl_context *ctx)
|
||||
{
|
||||
return _mesa_is_gles2(ctx) || _mesa_has_ARB_ES2_compatibility(ctx);
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
_mesa_is_gles3_compatible(const struct gl_context *ctx)
|
||||
{
|
||||
return _mesa_is_gles3(ctx) || _mesa_has_ARB_ES3_compatibility(ctx);
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
_mesa_is_gles31_compatible(const struct gl_context *ctx)
|
||||
{
|
||||
return _mesa_is_gles31(ctx) || _mesa_has_ARB_ES3_1_compatibility(ctx);
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
_mesa_is_gles32_compatible(const struct gl_context *ctx)
|
||||
{
|
||||
return _mesa_is_gles32(ctx) || _mesa_has_ARB_ES3_2_compatibility(ctx);
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
_mesa_is_no_error_enabled(const struct gl_context *ctx)
|
||||
{
|
||||
|
||||
@@ -1267,7 +1267,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
break;
|
||||
|
||||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
if (!_mesa_is_gles3(ctx) && !_mesa_has_ARB_ES3_compatibility(ctx))
|
||||
if (!_mesa_is_gles3_compatible(ctx))
|
||||
goto invalid_enum_error;
|
||||
if (ctx->Array.PrimitiveRestartFixedIndex != state) {
|
||||
ctx->Array.PrimitiveRestartFixedIndex = state;
|
||||
@@ -1939,7 +1939,7 @@ _mesa_IsEnabled( GLenum cap )
|
||||
return ctx->Array.PrimitiveRestart;
|
||||
|
||||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
if (!_mesa_is_gles3(ctx) && !_mesa_has_ARB_ES3_compatibility(ctx))
|
||||
if (!_mesa_is_gles3_compatible(ctx))
|
||||
goto invalid_enum_error;
|
||||
return ctx->Array.PrimitiveRestartFixedIndex;
|
||||
|
||||
|
||||
@@ -1352,7 +1352,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
|
||||
case MESA_FORMAT_LAYOUT_ETC1:
|
||||
return _mesa_has_OES_compressed_ETC1_RGB8_texture(ctx);
|
||||
case MESA_FORMAT_LAYOUT_ETC2:
|
||||
return _mesa_is_gles3(ctx) || _mesa_has_ARB_ES3_compatibility(ctx);
|
||||
return _mesa_is_gles3_compatible(ctx);
|
||||
case MESA_FORMAT_LAYOUT_BPTC:
|
||||
return _mesa_has_ARB_texture_compression_bptc(ctx) ||
|
||||
_mesa_has_EXT_texture_compression_bptc(ctx);
|
||||
@@ -2419,9 +2419,8 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
|
||||
; /* fallthrough */
|
||||
}
|
||||
|
||||
if (_mesa_has_ARB_ES2_compatibility(ctx) ||
|
||||
_mesa_has_OES_framebuffer_object(ctx) ||
|
||||
_mesa_is_gles2(ctx)) {
|
||||
if (_mesa_has_OES_framebuffer_object(ctx) ||
|
||||
_mesa_is_gles2_compatible(ctx)) {
|
||||
switch (internalFormat) {
|
||||
case GL_RGB565:
|
||||
return GL_RGB;
|
||||
|
||||
Reference in New Issue
Block a user