mesa: make more use of the new _mesa_is_gles2() helper
Signed-off-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21343>
This commit is contained in:
committed by
Marge Bot
parent
7a7c1e6519
commit
b20a614e82
@@ -65,7 +65,7 @@ legal_src_factor(const struct gl_context *ctx, GLenum factor)
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
return _mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2;
|
||||
return _mesa_is_desktop_gl(ctx) || _mesa_is_gles2(ctx);
|
||||
case GL_SRC1_COLOR:
|
||||
case GL_SRC1_ALPHA:
|
||||
case GL_ONE_MINUS_SRC1_COLOR:
|
||||
@@ -101,7 +101,7 @@ legal_dst_factor(const struct gl_context *ctx, GLenum factor)
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
return _mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2;
|
||||
return _mesa_is_desktop_gl(ctx) || _mesa_is_gles2(ctx);
|
||||
case GL_SRC_ALPHA_SATURATE:
|
||||
return (ctx->API != API_OPENGLES
|
||||
&& ctx->Extensions.ARB_blend_func_extended)
|
||||
|
||||
@@ -459,7 +459,7 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n,
|
||||
* and the constant must be BACK or NONE."
|
||||
* (same restriction applies with GL_EXT_draw_buffers specification)
|
||||
*/
|
||||
if (ctx->API == API_OPENGLES2 && _mesa_is_winsys_fbo(fb) &&
|
||||
if (_mesa_is_gles2(ctx) && _mesa_is_winsys_fbo(fb) &&
|
||||
(n != 1 || (buffers[0] != GL_NONE && buffers[0] != GL_BACK))) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid buffers)", caller);
|
||||
return;
|
||||
@@ -588,7 +588,7 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n,
|
||||
* INVALID_OPERATION." (same restriction applies with
|
||||
* GL_EXT_draw_buffers specification)
|
||||
*/
|
||||
if (ctx->API == API_OPENGLES2 && _mesa_is_user_fbo(fb) &&
|
||||
if (_mesa_is_gles2(ctx) && _mesa_is_user_fbo(fb) &&
|
||||
buffers[output] != GL_NONE &&
|
||||
buffers[output] != GL_COLOR_ATTACHMENT0 + output) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
|
||||
@@ -1050,7 +1050,7 @@ _mesa_initialize_context(struct gl_context *ctx,
|
||||
}
|
||||
break;
|
||||
}
|
||||
ctx->VertexProgram.PointSizeEnabled = ctx->API == API_OPENGLES2;
|
||||
ctx->VertexProgram.PointSizeEnabled = _mesa_is_gles2(ctx);
|
||||
ctx->PointSizeIsSet = GL_TRUE;
|
||||
|
||||
ctx->FirstTimeCurrent = GL_TRUE;
|
||||
|
||||
@@ -3808,7 +3808,7 @@ check_textarget(struct gl_context *ctx, int dims, GLenum target,
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
err = dims != 3 ||
|
||||
(ctx->API == API_OPENGLES2 && !ctx->Extensions.OES_texture_3D);
|
||||
(_mesa_is_gles2(ctx) && !ctx->Extensions.OES_texture_3D);
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
@@ -4582,7 +4582,7 @@ get_framebuffer_attachment_parameter(struct gl_context *ctx,
|
||||
* FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero, and all other
|
||||
* queries will generate an INVALID_OPERATION error."
|
||||
*/
|
||||
err = ctx->API == API_OPENGLES2 && ctx->Version < 30 ?
|
||||
err = _mesa_is_gles2(ctx) && ctx->Version < 30 ?
|
||||
GL_INVALID_ENUM : GL_INVALID_OPERATION;
|
||||
|
||||
if (_mesa_is_winsys_fbo(buffer)) {
|
||||
|
||||
@@ -936,7 +936,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
* Since OpenGL ES 3.1 adds support for multisampled integer formats, we
|
||||
* have to check the version for 30 exactly.
|
||||
*/
|
||||
if (pname == GL_NUM_SAMPLE_COUNTS && ctx->API == API_OPENGLES2 &&
|
||||
if (pname == GL_NUM_SAMPLE_COUNTS && _mesa_is_gles2(ctx) &&
|
||||
ctx->Version == 30 && _mesa_is_enum_format_integer(internalformat)) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ generate_texture_mipmap(struct gl_context *ctx,
|
||||
*
|
||||
* and this text is gone from the GLES 3.0 spec.
|
||||
*/
|
||||
if (ctx->API == API_OPENGLES2 && ctx->Version < 30 &&
|
||||
if (_mesa_is_gles2(ctx) && ctx->Version < 30 &&
|
||||
_mesa_is_format_compressed(srcImage->TexFormat)) {
|
||||
_mesa_unlock_texture(ctx, texObj);
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "generate mipmaps on compressed texture");
|
||||
|
||||
@@ -1435,7 +1435,7 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
|
||||
break;
|
||||
case EXTRA_API_ES2:
|
||||
api_check = GL_TRUE;
|
||||
if (ctx->API == API_OPENGLES2)
|
||||
if (_mesa_is_gles2(ctx))
|
||||
api_found = GL_TRUE;
|
||||
break;
|
||||
case EXTRA_API_ES3:
|
||||
@@ -1614,7 +1614,7 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
|
||||
* end.
|
||||
*/
|
||||
STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 4);
|
||||
if (ctx->API == API_OPENGLES2) {
|
||||
if (_mesa_is_gles2(ctx)) {
|
||||
if (ctx->Version >= 32)
|
||||
api = API_OPENGL_LAST + 3;
|
||||
else if (ctx->Version >= 31)
|
||||
@@ -2482,7 +2482,7 @@ tex_binding_to_index(const struct gl_context *ctx, GLenum binding)
|
||||
return TEXTURE_2D_INDEX;
|
||||
case GL_TEXTURE_BINDING_3D:
|
||||
return (ctx->API != API_OPENGLES &&
|
||||
!(ctx->API == API_OPENGLES2 && !ctx->Extensions.OES_texture_3D))
|
||||
!(_mesa_is_gles2(ctx) && !ctx->Extensions.OES_texture_3D))
|
||||
? TEXTURE_3D_INDEX : -1;
|
||||
case GL_TEXTURE_BINDING_CUBE_MAP:
|
||||
return TEXTURE_CUBE_INDEX;
|
||||
@@ -2766,7 +2766,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
|
||||
return TYPE_INT;
|
||||
|
||||
case GL_VERTEX_BINDING_BUFFER:
|
||||
if (ctx->API == API_OPENGLES2 && ctx->Version < 31)
|
||||
if (_mesa_is_gles2(ctx) && ctx->Version < 31)
|
||||
goto invalid_enum;
|
||||
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
|
||||
goto invalid_value;
|
||||
|
||||
@@ -1805,14 +1805,14 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
||||
break; /* OK */
|
||||
}
|
||||
if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB &&
|
||||
ctx->API == API_OPENGLES2) {
|
||||
_mesa_is_gles2(ctx)) {
|
||||
break; /* OK by GL_EXT_texture_type_2_10_10_10_REV */
|
||||
}
|
||||
return GL_INVALID_OPERATION;
|
||||
|
||||
case GL_UNSIGNED_INT_24_8:
|
||||
/* Depth buffer OK to read in OpenGL ES (NV_read_depth). */
|
||||
if (ctx->API == API_OPENGLES2 && format == GL_DEPTH_COMPONENT)
|
||||
if (_mesa_is_gles2(ctx) && format == GL_DEPTH_COMPONENT)
|
||||
return GL_NO_ERROR;
|
||||
|
||||
if (format != GL_DEPTH_STENCIL) {
|
||||
@@ -1936,7 +1936,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
||||
return GL_NO_ERROR;
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
/* OK by GL_EXT_texture_type_2_10_10_10_REV */
|
||||
return (ctx->API == API_OPENGLES2)
|
||||
return _mesa_is_gles2(ctx)
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
case GL_UNSIGNED_INT_5_9_9_9_REV:
|
||||
return _mesa_has_texture_shared_exponent(ctx)
|
||||
@@ -2287,7 +2287,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
|
||||
|
||||
if (_mesa_has_ARB_ES2_compatibility(ctx) ||
|
||||
_mesa_has_OES_framebuffer_object(ctx) ||
|
||||
ctx->API == API_OPENGLES2) {
|
||||
_mesa_is_gles2(ctx)) {
|
||||
switch (internalFormat) {
|
||||
case GL_RGB565:
|
||||
return GL_RGB;
|
||||
|
||||
@@ -1087,7 +1087,7 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
|
||||
* combination is, and Mesa can handle anything valid. Just work instead.
|
||||
*/
|
||||
if (_mesa_is_gles(ctx)) {
|
||||
if (ctx->API == API_OPENGLES2 &&
|
||||
if (_mesa_is_gles2(ctx) &&
|
||||
_mesa_is_color_format(format) &&
|
||||
_mesa_get_color_read_format(ctx, NULL, "glReadPixels") == format &&
|
||||
_mesa_get_color_read_type(ctx, NULL, "glReadPixels") == type) {
|
||||
|
||||
@@ -402,7 +402,7 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
|
||||
* COMPRESSED_TEXTURE_FORMATS query returns the set of supported specific
|
||||
* compressed formats.
|
||||
*/
|
||||
if (ctx->API == API_OPENGLES2 &&
|
||||
if (_mesa_is_gles2(ctx) &&
|
||||
ctx->Extensions.KHR_texture_compression_astc_ldr) {
|
||||
formats[n++] = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
|
||||
formats[n++] = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
|
||||
|
||||
@@ -499,7 +499,7 @@ _mesa_max_texture_levels(const struct gl_context *ctx, GLenum target)
|
||||
return ffs(util_next_power_of_two(ctx->Const.MaxTextureSize));
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return !(ctx->API == API_OPENGLES2 && !ctx->Extensions.OES_texture_3D)
|
||||
return !(_mesa_is_gles2(ctx) && !ctx->Extensions.OES_texture_3D)
|
||||
? ctx->Const.Max3DTextureLevels : 0;
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||
@@ -1826,7 +1826,7 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
|
||||
target == GL_TEXTURE_CUBE_MAP ||
|
||||
target == GL_PROXY_TEXTURE_CUBE_MAP) &&
|
||||
(ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4
|
||||
|| (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) &&
|
||||
|| (_mesa_is_gles2(ctx) && ctx->Extensions.OES_depth_texture_cube_map))) &&
|
||||
!((target == GL_TEXTURE_CUBE_MAP_ARRAY ||
|
||||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) &&
|
||||
_mesa_has_texture_cube_map_array(ctx))) {
|
||||
|
||||
@@ -169,7 +169,7 @@ _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
|
||||
case GL_TEXTURE_3D:
|
||||
return texUnit->CurrentTex[TEXTURE_3D_INDEX];
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return !(ctx->API == API_OPENGLES2 && !ctx->Extensions.OES_texture_3D)
|
||||
return !(_mesa_is_gles2(ctx) && !ctx->Extensions.OES_texture_3D)
|
||||
? ctx->Texture.ProxyTex[TEXTURE_3D_INDEX] : NULL;
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||
@@ -1605,7 +1605,7 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target)
|
||||
return TEXTURE_2D_INDEX;
|
||||
case GL_TEXTURE_3D:
|
||||
return (ctx->API != API_OPENGLES &&
|
||||
!(ctx->API == API_OPENGLES2 && !ctx->Extensions.OES_texture_3D))
|
||||
!(_mesa_is_gles2(ctx) && !ctx->Extensions.OES_texture_3D))
|
||||
? TEXTURE_3D_INDEX : -1;
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
return TEXTURE_CUBE_INDEX;
|
||||
|
||||
@@ -1047,7 +1047,7 @@ _mesa_init_texture(struct gl_context *ctx)
|
||||
* for most implementations and drivers that don't support seamless
|
||||
* cubemaps for GLES2 can still disable it.
|
||||
*/
|
||||
ctx->Texture.CubeMapSeamless = ctx->API == API_OPENGLES2;
|
||||
ctx->Texture.CubeMapSeamless = _mesa_is_gles2(ctx);
|
||||
|
||||
for (u = 0; u < ARRAY_SIZE(ctx->Texture.Unit); u++) {
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
|
||||
|
||||
@@ -766,7 +766,7 @@ _mesa_get_shading_language_version(const struct gl_context *ctx,
|
||||
GLSL_VERSION("310 es");
|
||||
if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility)
|
||||
GLSL_VERSION("300 es");
|
||||
if (ctx->API == API_OPENGLES2 || ctx->Extensions.ARB_ES2_compatibility)
|
||||
if (_mesa_is_gles2(ctx) || ctx->Extensions.ARB_ES2_compatibility)
|
||||
GLSL_VERSION("100");
|
||||
|
||||
#undef GLSL_VERSION
|
||||
|
||||
Reference in New Issue
Block a user