diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index 45321d75c08..26d1d315d4f 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -838,6 +838,12 @@ resources might be created and handled quite differently. to a shader and can be used with load, store, and atomic instructions. * ``PIPE_BIND_SHADER_IMAGE``: A buffer or texture with a format that can be bound to a shader and can be used with load, store, and atomic instructions. +* ``PIPE_BIND_OPENCL``: Potentially higher precision requirements than gl/vk. + Float values need to be 1.5 (FULL_PROFILE) or 2.0 (EMBEDDED_PROFILE) ULPs + precise. For float to int conversion, the preferred rounding mode is "to + nearest" and if a different rounding mode is chosen, the absolute error + must be <= 0.6. Details can be found here: + https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#conversion-rules * ``PIPE_BIND_COMMAND_ARGS_BUFFER``: A buffer that may be sourced by the GPU command processor. It can contain, for example, the arguments to indirect draw calls. diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc b/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc index 3fc51774315..7e2362a7423 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc @@ -54,6 +54,7 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen, unsigned retval = 0; usage &= ~PIPE_BIND_SAMPLER_VIEW_SUBOPTIMAL; + usage &= ~PIPE_BIND_OPENCL; if ((target >= PIPE_MAX_TEXTURE_TYPES) || !valid_sample_count(sample_count, is_suboptimal)) { diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 0ff416cb27e..2f8c4691c68 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2186,6 +2186,8 @@ static bool si_is_format_supported(struct pipe_screen *screen, enum pipe_format struct si_screen *sscreen = (struct si_screen *)screen; unsigned retval = 0; + usage &= ~PIPE_BIND_OPENCL; + if (target >= PIPE_MAX_TEXTURE_TYPES) { PRINT_ERR("radeonsi: unsupported texture type %d\n", target); return false; diff --git a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs index d7c8d076863..a5fd731dc18 100644 --- a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs +++ b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs @@ -469,8 +469,9 @@ impl PipeScreen { &self, format: pipe_format, target: pipe_texture_target, - bindings: u32, + mut bindings: u32, ) -> bool { + bindings |= PIPE_BIND_OPENCL; unsafe { self.screen().is_format_supported.unwrap()(self.pipe(), format, target, 0, 0, bindings) } diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 7b0573899f1..70d24f27afb 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -470,7 +470,7 @@ enum pipe_flush_flags #define PIPE_BIND_GLOBAL (1 << 13) /* set_global_binding */ #define PIPE_BIND_SHADER_BUFFER (1 << 14) /* set_shader_buffers */ #define PIPE_BIND_SHADER_IMAGE (1 << 15) /* set_shader_images */ -/* gap */ +#define PIPE_BIND_OPENCL (1 << 16) /* potentially higher precision reqs */ #define PIPE_BIND_COMMAND_ARGS_BUFFER (1 << 17) /* pipe_draw_info.indirect */ #define PIPE_BIND_QUERY_BUFFER (1 << 18) /* get_query_result_resource */