rusticl: Add CL specific bind flag

In some cases CL has higher precision requirements for format support.
Add a PIPE_BIND_x flag so that drivers can expose formats in GL(ES) that
they cannot expose in CL.

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40028>
This commit is contained in:
Rob Clark 2026-02-21 06:25:46 -08:00 committed by Marge Bot
parent 57c90e86bf
commit d487358527
5 changed files with 12 additions and 2 deletions

View file

@ -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.

View file

@ -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)) {

View file

@ -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;

View file

@ -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)
}

View file

@ -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 */