mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
zink: clear null image surfaces to 0
GL Spec says that imageLoad from incomplete images must return 0. This is not really spec compliant as for proper behavior nullDescriptor and robustImageAccess2 is needed. A workaround for lack of either of these requires a shader variant. Clearing the null surface and hoping the app doesn't write to the image is closer to spec, while avoiding a shader recompile. KHR-GL46.shader_image_load_store.incomplete_textures tests this. cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21135>
This commit is contained in:
parent
2fe3cef367
commit
22e91af1a7
1 changed files with 8 additions and 1 deletions
|
|
@ -4879,6 +4879,13 @@ zink_get_dummy_pipe_surface(struct zink_context *ctx, int samples_index)
|
|||
{
|
||||
if (!ctx->dummy_surface[samples_index]) {
|
||||
ctx->dummy_surface[samples_index] = zink_surface_create_null(ctx, PIPE_TEXTURE_2D, 1024, 1024, BITFIELD_BIT(samples_index));
|
||||
/* This is possibly used with imageLoad which according to GL spec must return 0 */
|
||||
if (!samples_index) {
|
||||
union pipe_color_union color = {0};
|
||||
struct pipe_box box;
|
||||
u_box_2d(0, 0, 1024, 1024, &box);
|
||||
ctx->base.clear_texture(&ctx->base, ctx->dummy_surface[samples_index]->texture, 0, &box, &color);
|
||||
}
|
||||
}
|
||||
return ctx->dummy_surface[samples_index];
|
||||
}
|
||||
|
|
@ -5318,4 +5325,4 @@ zink_update_barriers(struct zink_context *ctx, bool is_compute,
|
|||
if (!need_barriers->entries)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue