mesa: plumb errors through to texture allocation

the spec allows this and tests like spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch
expect it

cc: mesa-stable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25931>
(cherry picked from commit fab5c706fe)
This commit is contained in:
Mike Blumenkrantz
2023-10-26 20:41:08 -04:00
committed by Eric Engestrom
parent bd63d1e626
commit f5ab22d0c0
8 changed files with 86 additions and 33 deletions

View File

@@ -2424,7 +2424,7 @@
"description": "mesa: plumb errors through to texture allocation", "description": "mesa: plumb errors through to texture allocation",
"nominated": true, "nominated": true,
"nomination_type": 0, "nomination_type": 0,
"resolution": 0, "resolution": 1,
"main_sha": null, "main_sha": null,
"because_sha": null, "because_sha": null,
"notes": null "notes": null

View File

@@ -1,3 +1,20 @@
# should be fixed with kernel 6.8
spec@ext_external_objects@vk-depth-display@D32S8,Fail
spec@ext_external_objects@vk-image-overwrite@RGB 10 A2 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGB 10 A2 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGB 5 A1 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 16 INT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 16 SFLOAT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 16 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 32 INT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 32 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 4 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 INT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 SRGB optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-stencil-display@D32S8,Fail
KHR-GL46.gpu_shader_fp64.fp64.max_uniform_components,Fail KHR-GL46.gpu_shader_fp64.fp64.max_uniform_components,Fail
KHR-GL46.shader_image_load_store.basic-allFormats-store,Fail KHR-GL46.shader_image_load_store.basic-allFormats-store,Fail
KHR-GL46.shader_image_load_store.basic-allTargets-store,Fail KHR-GL46.shader_image_load_store.basic-allTargets-store,Fail

View File

@@ -1,3 +1,20 @@
# should be fixed with kernel 6.8
spec@ext_external_objects@vk-depth-display@D32S8,Fail
spec@ext_external_objects@vk-image-overwrite@RGB 10 A2 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGB 10 A2 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGB 5 A1 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 16 INT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 16 SFLOAT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 16 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 32 INT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 32 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 4 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 INT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 SRGB optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 UINT optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-image-overwrite@RGBA 8 UNORM optimal: Failed to create texture from GL memory object.,Fail
spec@ext_external_objects@vk-stencil-display@D32S8,Fail
KHR-GL46.gpu_shader_fp64.fp64.max_uniform_components,Fail KHR-GL46.gpu_shader_fp64.fp64.max_uniform_components,Fail
KHR-GL46.shader_image_load_store.basic-allFormats-store,Fail KHR-GL46.shader_image_load_store.basic-allFormats-store,Fail

View File

@@ -1,3 +1,13 @@
# from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25931
spec@arb_internalformat_query2@image_format_compatibility_type pname checks,Fail
spec@arb_internalformat_query2@image_format_compatibility_type pname checks@GL_IMAGE_FORMAT_COMPATIBILITY_TYPE,Fail
spec@arb_internalformat_query2@max dimensions related pname checks,Fail
spec@arb_internalformat_query2@max dimensions related pname checks@GL_MAX_COMBINED_DIMENSIONS,Fail
spec@arb_internalformat_query2@max dimensions related pname checks@GL_MAX_DEPTH,Fail
spec@arb_internalformat_query2@max dimensions related pname checks@GL_MAX_HEIGHT,Fail
spec@arb_internalformat_query2@max dimensions related pname checks@GL_MAX_LAYERS,Fail
spec@arb_internalformat_query2@max dimensions related pname checks@GL_MAX_WIDTH,Fail
spec@!opengl 1.0@gl-1.0-beginend-coverage,Fail spec@!opengl 1.0@gl-1.0-beginend-coverage,Fail
spec@!opengl 1.0@gl-1.0-beginend-coverage@glFlush,Fail spec@!opengl 1.0@gl-1.0-beginend-coverage@glFlush,Fail
spec@!opengl 1.0@gl-1.0-blend-func,Fail spec@!opengl 1.0@gl-1.0-blend-func,Fail
@@ -46,8 +56,6 @@ spec@arb_seamless_cube_map@arb_seamless_cubemap,Fail
spec@arb_shader_atomic_counters@semantics,Fail spec@arb_shader_atomic_counters@semantics,Fail
spec@arb_shader_atomic_counters@semantics@Tessellation control shader atomic built-in semantics,Fail spec@arb_shader_atomic_counters@semantics@Tessellation control shader atomic built-in semantics,Fail
spec@arb_texture_cube_map_array@arb_texture_cube_map_array-sampler-cube-array-shadow,Fail spec@arb_texture_cube_map_array@arb_texture_cube_map_array-sampler-cube-array-shadow,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_RGB9_E5,Fail
spec@arb_texture_rg@texwrap formats-int,Fail spec@arb_texture_rg@texwrap formats-int,Fail
spec@arb_texture_rg@texwrap formats-int offset,Fail spec@arb_texture_rg@texwrap formats-int offset,Fail
spec@arb_texture_rg@texwrap formats-int offset@GL_R16I,Fail spec@arb_texture_rg@texwrap formats-int offset@GL_R16I,Fail

View File

@@ -7095,14 +7095,14 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
if (!st_SetTextureStorageForMemoryObject(ctx, texObj, if (!st_SetTextureStorageForMemoryObject(ctx, texObj,
memObj, 1, width, memObj, 1, width,
height, depth, height, depth,
offset)) { offset, func)) {
_mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0, _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0,
internalformat, texFormat); internalformat, texFormat);
} }
} else { } else {
if (!st_AllocTextureStorage(ctx, texObj, 1, if (!st_AllocTextureStorage(ctx, texObj, 1,
width, height, depth)) { width, height, depth, func)) {
/* tidy up the texture image state. strictly speaking, /* tidy up the texture image state. strictly speaking,
* we're allowed to just leave this in whatever state we * we're allowed to just leave this in whatever state we
* like, but being tidy is good. * like, but being tidy is good.

View File

@@ -439,7 +439,7 @@ texture_storage(struct gl_context *ctx, GLuint dims,
struct gl_memory_object *memObj, GLenum target, struct gl_memory_object *memObj, GLenum target,
GLsizei levels, GLenum internalformat, GLsizei width, GLsizei levels, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, GLuint64 offset, bool dsa, GLsizei height, GLsizei depth, GLuint64 offset, bool dsa,
bool no_error) bool no_error, const char *func)
{ {
GLboolean sizeOK = GL_TRUE, dimensionsOK = GL_TRUE; GLboolean sizeOK = GL_TRUE, dimensionsOK = GL_TRUE;
mesa_format texFormat; mesa_format texFormat;
@@ -517,7 +517,7 @@ texture_storage(struct gl_context *ctx, GLuint dims,
if (!st_SetTextureStorageForMemoryObject(ctx, texObj, memObj, if (!st_SetTextureStorageForMemoryObject(ctx, texObj, memObj,
levels, levels,
width, height, depth, width, height, depth,
offset)) { offset, func)) {
clear_texture_fields(ctx, texObj); clear_texture_fields(ctx, texObj);
return; return;
@@ -525,7 +525,7 @@ texture_storage(struct gl_context *ctx, GLuint dims,
} }
else { else {
if (!st_AllocTextureStorage(ctx, texObj, levels, if (!st_AllocTextureStorage(ctx, texObj, levels,
width, height, depth)) { width, height, depth, func)) {
/* Reset the texture images' info to zeros. /* Reset the texture images' info to zeros.
* Strictly speaking, we probably don't have to do this since * Strictly speaking, we probably don't have to do this since
* generating GL_OUT_OF_MEMORY can leave things in an undefined * generating GL_OUT_OF_MEMORY can leave things in an undefined
@@ -550,10 +550,10 @@ texture_storage_error(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
GLenum target, GLsizei levels, GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, bool dsa) GLsizei height, GLsizei depth, bool dsa, const char *func)
{ {
texture_storage(ctx, dims, texObj, NULL, target, levels, internalformat, texture_storage(ctx, dims, texObj, NULL, target, levels, internalformat,
width, height, depth, dsa, 0, false); width, height, depth, dsa, 0, false, func);
} }
@@ -562,10 +562,10 @@ texture_storage_no_error(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
GLenum target, GLsizei levels, GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, bool dsa) GLsizei height, GLsizei depth, bool dsa, const char *func)
{ {
texture_storage(ctx, dims, texObj, NULL, target, levels, internalformat, texture_storage(ctx, dims, texObj, NULL, target, levels, internalformat,
width, height, depth, dsa, 0, true); width, height, depth, dsa, 0, true, func);
} }
@@ -609,20 +609,20 @@ texstorage_error(GLuint dims, GLenum target, GLsizei levels,
return; return;
texture_storage_error(ctx, dims, texObj, target, levels, texture_storage_error(ctx, dims, texObj, target, levels,
internalformat, width, height, depth, false); internalformat, width, height, depth, false, caller);
} }
static void static void
texstorage_no_error(GLuint dims, GLenum target, GLsizei levels, texstorage_no_error(GLuint dims, GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height, GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth) GLsizei depth, const char *caller)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
struct gl_texture_object *texObj = _mesa_get_current_tex_object(ctx, target); struct gl_texture_object *texObj = _mesa_get_current_tex_object(ctx, target);
texture_storage_no_error(ctx, dims, texObj, target, levels, texture_storage_no_error(ctx, dims, texObj, target, levels,
internalformat, width, height, depth, false); internalformat, width, height, depth, false, caller);
} }
@@ -666,20 +666,20 @@ texturestorage_error(GLuint dims, GLuint texture, GLsizei levels,
} }
texture_storage_error(ctx, dims, texObj, texObj->Target, texture_storage_error(ctx, dims, texObj, texObj->Target,
levels, internalformat, width, height, depth, true); levels, internalformat, width, height, depth, true, caller);
} }
static void static void
texturestorage_no_error(GLuint dims, GLuint texture, GLsizei levels, texturestorage_no_error(GLuint dims, GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height, GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth) GLsizei depth, const char *caller)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture);
texture_storage_no_error(ctx, dims, texObj, texObj->Target, texture_storage_no_error(ctx, dims, texObj, texObj->Target,
levels, internalformat, width, height, depth, true); levels, internalformat, width, height, depth, true, caller);
} }
@@ -687,7 +687,8 @@ void GLAPIENTRY
_mesa_TexStorage1D_no_error(GLenum target, GLsizei levels, _mesa_TexStorage1D_no_error(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width) GLenum internalformat, GLsizei width)
{ {
texstorage_no_error(1, target, levels, internalformat, width, 1, 1); texstorage_no_error(1, target, levels, internalformat, width, 1, 1,
"glTexStorage1D");
} }
@@ -705,7 +706,8 @@ _mesa_TexStorage2D_no_error(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLenum internalformat, GLsizei width,
GLsizei height) GLsizei height)
{ {
texstorage_no_error(2, target, levels, internalformat, width, height, 1); texstorage_no_error(2, target, levels, internalformat, width, height, 1,
"glTexStorage2D");
} }
@@ -723,7 +725,8 @@ _mesa_TexStorage3D_no_error(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth) GLsizei height, GLsizei depth)
{ {
texstorage_no_error(3, target, levels, internalformat, width, height, depth); texstorage_no_error(3, target, levels, internalformat, width, height, depth,
"glTexStorage3D");
} }
@@ -740,7 +743,8 @@ void GLAPIENTRY
_mesa_TextureStorage1D_no_error(GLuint texture, GLsizei levels, _mesa_TextureStorage1D_no_error(GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width) GLenum internalformat, GLsizei width)
{ {
texturestorage_no_error(1, texture, levels, internalformat, width, 1, 1); texturestorage_no_error(1, texture, levels, internalformat, width, 1, 1,
"glTextureStorage1D");
} }
@@ -758,7 +762,8 @@ _mesa_TextureStorage2D_no_error(GLuint texture, GLsizei levels,
GLenum internalformat, GLenum internalformat,
GLsizei width, GLsizei height) GLsizei width, GLsizei height)
{ {
texturestorage_no_error(2, texture, levels, internalformat, width, height, 1); texturestorage_no_error(2, texture, levels, internalformat, width, height, 1,
"glTextureStorage2D");
} }
@@ -778,7 +783,7 @@ _mesa_TextureStorage3D_no_error(GLuint texture, GLsizei levels,
GLsizei height, GLsizei depth) GLsizei height, GLsizei depth)
{ {
texturestorage_no_error(3, texture, levels, internalformat, width, height, texturestorage_no_error(3, texture, levels, internalformat, width, height,
depth); depth, "glTextureStorage3D");
} }
@@ -854,5 +859,5 @@ _mesa_texture_storage_memory(struct gl_context *ctx, GLuint dims,
assert(memObj); assert(memObj);
texture_storage(ctx, dims, texObj, memObj, target, levels, internalformat, texture_storage(ctx, dims, texObj, memObj, target, levels, internalformat,
width, height, depth, offset, dsa, false); width, height, depth, offset, dsa, false, "");
} }

View File

@@ -3373,7 +3373,7 @@ st_texture_storage(struct gl_context *ctx,
GLsizei levels, GLsizei width, GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth, GLsizei height, GLsizei depth,
struct gl_memory_object *memObj, struct gl_memory_object *memObj,
GLuint64 offset) GLuint64 offset, const char *func)
{ {
const GLuint numFaces = _mesa_num_tex_faces(texObj->Target); const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
struct gl_texture_image *texImage = texObj->Image[0][0]; struct gl_texture_image *texImage = texObj->Image[0][0];
@@ -3423,6 +3423,7 @@ st_texture_storage(struct gl_context *ctx,
} }
if (!found) { if (!found) {
_mesa_error(st->ctx, GL_INVALID_OPERATION, "%s(format/samplecount not supported)", func);
return GL_FALSE; return GL_FALSE;
} }
} }
@@ -3459,8 +3460,10 @@ st_texture_storage(struct gl_context *ctx,
texObj->IsSparse); texObj->IsSparse);
} }
if (!texObj->pt) if (!texObj->pt) {
_mesa_error(st->ctx, GL_OUT_OF_MEMORY, "%s", func);
return GL_FALSE; return GL_FALSE;
}
/* Set image resource pointers */ /* Set image resource pointers */
for (level = 0; level < levels; level++) { for (level = 0; level < levels; level++) {
@@ -3493,11 +3496,12 @@ GLboolean
st_AllocTextureStorage(struct gl_context *ctx, st_AllocTextureStorage(struct gl_context *ctx,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
GLsizei levels, GLsizei width, GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth) GLsizei height, GLsizei depth,
const char *func)
{ {
return st_texture_storage(ctx, texObj, levels, return st_texture_storage(ctx, texObj, levels,
width, height, depth, width, height, depth,
NULL, 0); NULL, 0, func);
} }
@@ -3715,11 +3719,11 @@ st_SetTextureStorageForMemoryObject(struct gl_context *ctx,
struct gl_memory_object *memObj, struct gl_memory_object *memObj,
GLsizei levels, GLsizei width, GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth, GLsizei height, GLsizei depth,
GLuint64 offset) GLuint64 offset, const char *func)
{ {
return st_texture_storage(ctx, texObj, levels, return st_texture_storage(ctx, texObj, levels,
width, height, depth, width, height, depth,
memObj, offset); memObj, offset, func);
} }
GLboolean GLboolean

View File

@@ -98,7 +98,8 @@ void st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
GLboolean st_AllocTextureStorage(struct gl_context *ctx, GLboolean st_AllocTextureStorage(struct gl_context *ctx,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
GLsizei levels, GLsizei width, GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth); GLsizei height, GLsizei depth,
const char *func);
GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target, GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
GLuint numLevels, GLint level, GLuint numLevels, GLint level,
mesa_format format, GLuint numSamples, mesa_format format, GLuint numSamples,
@@ -116,7 +117,8 @@ GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx,
struct gl_memory_object *memObj, struct gl_memory_object *memObj,
GLsizei levels, GLsizei width, GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth, GLsizei height, GLsizei depth,
GLuint64 offset); GLuint64 offset,
const char *func);
GLboolean st_GetSparseTextureVirtualPageSize(struct gl_context *ctx, GLboolean st_GetSparseTextureVirtualPageSize(struct gl_context *ctx,
GLenum target, mesa_format format, GLenum target, mesa_format format,