Module: Mesa
Branch: main
Commit: 398fadf1cf33b9714924a372709623631c1064a3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=398fadf1cf33b9714924a372709623631c1064a3

Author: Karol Herbst <kher...@redhat.com>
Date:   Sat Oct 21 10:24:25 2023 +0200

rusticl/device: restrict const max size to 1 << 26 bytes

Signed-off-by: Karol Herbst <kher...@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25937>

---

 src/gallium/frontends/rusticl/core/device.rs | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/frontends/rusticl/core/device.rs 
b/src/gallium/frontends/rusticl/core/device.rs
index 0a5e07ffb5a..a0bb0652ee1 100644
--- a/src/gallium/frontends/rusticl/core/device.rs
+++ b/src/gallium/frontends/rusticl/core/device.rs
@@ -634,9 +634,17 @@ impl Device {
 
     pub fn const_max_size(&self) -> cl_ulong {
         min(
-            self.max_mem_alloc(),
-            self.screen
-                .param(pipe_cap::PIPE_CAP_MAX_SHADER_BUFFER_SIZE_UINT) as u64,
+            // Needed to fix the `api min_max_constant_buffer_size` CL CTS 
test as it can't really
+            // handle arbitrary values here. We might want to reconsider later 
and figure out how to
+            // advertize higher values without tripping of the test.
+            // should be at least 1 << 16 (native UBO size on NVidia)
+            // advertising more just in case it benefits other hardware
+            1 << 26,
+            min(
+                self.max_mem_alloc(),
+                self.screen
+                    .param(pipe_cap::PIPE_CAP_MAX_SHADER_BUFFER_SIZE_UINT) as 
u64,
+            ),
         )
     }
 

Reply via email to