From 0fa4eaf6f61546367c0b55b645b5b353cde4c127 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 16 Feb 2024 12:16:13 +0100 Subject: [PATCH] gallium: add PIPE_CAP_TEXTURE_SAMPLER_INDEPENDENT Reviewed-by: Iago Toral Quiroga Part-of: --- docs/gallium/screen.rst | 1 + src/gallium/auxiliary/util/u_screen.c | 4 ++++ src/gallium/drivers/v3d/v3d_screen.c | 3 +++ src/gallium/include/pipe/p_defines.h | 1 + 4 files changed, 9 insertions(+) diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index 80cdea33f54..0bb9dceca5d 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -650,6 +650,7 @@ The integer capabilities: * ``PIPE_CAP_VALIDATE_ALL_DIRTY_STATES`` : Whether state validation must also validate the state changes for resources types used in the previous shader but not in the current shader. * ``PIPE_CAP_HAS_CONST_BW``: Whether the driver only supports non-data-dependent layouts (ie. not bandwidth compressed formats like AFBC, UBWC, etc), or supports ``PIPE_BIND_CONST_BW`` to disable data-dependent layouts on requested resources. * ``PIPE_CAP_PERFORMANCE_MONITOR``: Whether GL_AMD_performance_monitor should be exposed. +* ``PIPE_CAP_TEXTURE_SAMPLER_INDEPENDENT``: Whether sampler views and sampler states are independent objects, meaning both can be freely mixed and matched by the frontend. This isn't required for OpenGL where on the shader level those are the same object. However for proper gallium nine and OpenCL support this is required. .. _pipe_capf: diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 0abe02eebbd..aee5d426224 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -553,6 +553,10 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_HAS_CONST_BW: return 0; + case PIPE_CAP_TEXTURE_SAMPLER_INDEPENDENT: + /* this is expected of gallium drivers, but some just don't support it */ + return 1; + case PIPE_CAP_PERFORMANCE_MONITOR: return pscreen->get_driver_query_info && pscreen->get_driver_query_group_info && pscreen->get_driver_query_group_info(pscreen, 0, NULL) != 0; diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 9ad64a988b0..5b5c160e72f 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -159,6 +159,9 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_QUERY_LOD: return 1; + case PIPE_CAP_TEXTURE_SAMPLER_INDEPENDENT: + return 0; + case PIPE_CAP_PACKED_UNIFORMS: /* We can't enable this flag, because it results in load_ubo * intrinsics across a 16b boundary, but v3d's TMU general diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index b417c06e785..fc8c763bfbb 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -953,6 +953,7 @@ enum pipe_cap PIPE_CAP_VALIDATE_ALL_DIRTY_STATES, PIPE_CAP_HAS_CONST_BW, PIPE_CAP_PERFORMANCE_MONITOR, + PIPE_CAP_TEXTURE_SAMPLER_INDEPENDENT, PIPE_CAP_LAST, /* XXX do not add caps after PIPE_CAP_LAST! */ };