From f5ab22d0c090b331565e34dc5983791dcaa538e8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 26 Oct 2023 20:41:08 -0400 Subject: [PATCH] mesa: plumb errors through to texture allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: (cherry picked from commit fab5c706fe453f440d3c85013d24dbe8230e36cc) --- .pick_status.json | 2 +- src/freedreno/ci/freedreno-a618-fails.txt | 17 +++++++ src/freedreno/ci/freedreno-a630-fails.txt | 17 +++++++ .../drivers/d3d12/ci/d3d12-quick_gl.txt | 12 ++++- src/mesa/main/teximage.c | 4 +- src/mesa/main/texstorage.c | 45 ++++++++++--------- src/mesa/state_tracker/st_cb_texture.c | 16 ++++--- src/mesa/state_tracker/st_cb_texture.h | 6 ++- 8 files changed, 86 insertions(+), 33 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 68518f06bd4..bd8cd127cd8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2424,7 +2424,7 @@ "description": "mesa: plumb errors through to texture allocation", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/freedreno/ci/freedreno-a618-fails.txt b/src/freedreno/ci/freedreno-a618-fails.txt index 29f0ad12c57..f3e15fcce9e 100644 --- a/src/freedreno/ci/freedreno-a618-fails.txt +++ b/src/freedreno/ci/freedreno-a618-fails.txt @@ -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.shader_image_load_store.basic-allFormats-store,Fail KHR-GL46.shader_image_load_store.basic-allTargets-store,Fail diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt index 1ea5c072d95..111630d206f 100644 --- a/src/freedreno/ci/freedreno-a630-fails.txt +++ b/src/freedreno/ci/freedreno-a630-fails.txt @@ -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.shader_image_load_store.basic-allFormats-store,Fail diff --git a/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt b/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt index fe9b49e482c..8ef86b78bfd 100644 --- a/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt +++ b/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt @@ -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@glFlush,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@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_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 offset,Fail spec@arb_texture_rg@texwrap formats-int offset@GL_R16I,Fail diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 412fce4d8c7..c77259e877e 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -7095,14 +7095,14 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, if (!st_SetTextureStorageForMemoryObject(ctx, texObj, memObj, 1, width, height, depth, - offset)) { + offset, func)) { _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0, internalformat, texFormat); } } else { if (!st_AllocTextureStorage(ctx, texObj, 1, - width, height, depth)) { + width, height, depth, func)) { /* tidy up the texture image state. strictly speaking, * we're allowed to just leave this in whatever state we * like, but being tidy is good. diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index b1f8de70c41..53428c34d2d 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -439,7 +439,7 @@ texture_storage(struct gl_context *ctx, GLuint dims, struct gl_memory_object *memObj, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLuint64 offset, bool dsa, - bool no_error) + bool no_error, const char *func) { GLboolean sizeOK = GL_TRUE, dimensionsOK = GL_TRUE; mesa_format texFormat; @@ -517,7 +517,7 @@ texture_storage(struct gl_context *ctx, GLuint dims, if (!st_SetTextureStorageForMemoryObject(ctx, texObj, memObj, levels, width, height, depth, - offset)) { + offset, func)) { clear_texture_fields(ctx, texObj); return; @@ -525,7 +525,7 @@ texture_storage(struct gl_context *ctx, GLuint dims, } else { if (!st_AllocTextureStorage(ctx, texObj, levels, - width, height, depth)) { + width, height, depth, func)) { /* Reset the texture images' info to zeros. * Strictly speaking, we probably don't have to do this since * 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, GLenum target, GLsizei levels, 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, - 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, GLenum target, GLsizei levels, 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, - 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; texture_storage_error(ctx, dims, texObj, target, levels, - internalformat, width, height, depth, false); + internalformat, width, height, depth, false, caller); } static void texstorage_no_error(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, - GLsizei depth) + GLsizei depth, const char *caller) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_object *texObj = _mesa_get_current_tex_object(ctx, target); 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, - levels, internalformat, width, height, depth, true); + levels, internalformat, width, height, depth, true, caller); } static void texturestorage_no_error(GLuint dims, GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, - GLsizei depth) + GLsizei depth, const char *caller) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); 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, 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, 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, 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, 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, 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) { 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); texture_storage(ctx, dims, texObj, memObj, target, levels, internalformat, - width, height, depth, offset, dsa, false); + width, height, depth, offset, dsa, false, ""); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3b75d012301..abc5fef2b5e 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -3373,7 +3373,7 @@ st_texture_storage(struct gl_context *ctx, GLsizei levels, GLsizei width, GLsizei height, GLsizei depth, struct gl_memory_object *memObj, - GLuint64 offset) + GLuint64 offset, const char *func) { const GLuint numFaces = _mesa_num_tex_faces(texObj->Target); struct gl_texture_image *texImage = texObj->Image[0][0]; @@ -3423,6 +3423,7 @@ st_texture_storage(struct gl_context *ctx, } if (!found) { + _mesa_error(st->ctx, GL_INVALID_OPERATION, "%s(format/samplecount not supported)", func); return GL_FALSE; } } @@ -3459,8 +3460,10 @@ st_texture_storage(struct gl_context *ctx, texObj->IsSparse); } - if (!texObj->pt) + if (!texObj->pt) { + _mesa_error(st->ctx, GL_OUT_OF_MEMORY, "%s", func); return GL_FALSE; + } /* Set image resource pointers */ for (level = 0; level < levels; level++) { @@ -3493,11 +3496,12 @@ GLboolean st_AllocTextureStorage(struct gl_context *ctx, struct gl_texture_object *texObj, GLsizei levels, GLsizei width, - GLsizei height, GLsizei depth) + GLsizei height, GLsizei depth, + const char *func) { return st_texture_storage(ctx, texObj, levels, width, height, depth, - NULL, 0); + NULL, 0, func); } @@ -3715,11 +3719,11 @@ st_SetTextureStorageForMemoryObject(struct gl_context *ctx, struct gl_memory_object *memObj, GLsizei levels, GLsizei width, GLsizei height, GLsizei depth, - GLuint64 offset) + GLuint64 offset, const char *func) { return st_texture_storage(ctx, texObj, levels, width, height, depth, - memObj, offset); + memObj, offset, func); } GLboolean diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h index cc496d2d2f4..6131954d988 100644 --- a/src/mesa/state_tracker/st_cb_texture.h +++ b/src/mesa/state_tracker/st_cb_texture.h @@ -98,7 +98,8 @@ void st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, GLboolean st_AllocTextureStorage(struct gl_context *ctx, struct gl_texture_object *texObj, GLsizei levels, GLsizei width, - GLsizei height, GLsizei depth); + GLsizei height, GLsizei depth, + const char *func); GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target, GLuint numLevels, GLint level, mesa_format format, GLuint numSamples, @@ -116,7 +117,8 @@ GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx, struct gl_memory_object *memObj, GLsizei levels, GLsizei width, GLsizei height, GLsizei depth, - GLuint64 offset); + GLuint64 offset, + const char *func); GLboolean st_GetSparseTextureVirtualPageSize(struct gl_context *ctx, GLenum target, mesa_format format,