Explorar o código

gl_rasterizer: Workaround for when exceeding max UBO size.

bunnei %!s(int64=8) %!d(string=hai) anos
pai
achega
10422f3c18

+ 6 - 0
src/video_core/renderer_opengl/gl_rasterizer.cpp

@@ -613,6 +613,12 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
         if (used_buffer.IsIndirect()) {
         if (used_buffer.IsIndirect()) {
             // Buffer is accessed indirectly, so upload the entire thing
             // Buffer is accessed indirectly, so upload the entire thing
             size = buffer.size * sizeof(float);
             size = buffer.size * sizeof(float);
+
+            if (size > MaxConstbufferSize) {
+                NGLOG_ERROR(HW_GPU, "indirect constbuffer size {} exceeds maximum {}", size,
+                            MaxConstbufferSize);
+                size = MaxConstbufferSize;
+            }
         } else {
         } else {
             // Buffer is accessed directly, upload just what we use
             // Buffer is accessed directly, upload just what we use
             size = used_buffer.GetSize() * sizeof(float);
             size = used_buffer.GetSize() * sizeof(float);

+ 1 - 1
src/video_core/renderer_opengl/gl_rasterizer.h

@@ -55,7 +55,7 @@ public:
     };
     };
 
 
     /// Maximum supported size that a constbuffer can have in bytes.
     /// Maximum supported size that a constbuffer can have in bytes.
-    static constexpr size_t MaxConstbufferSize = 0x1000;
+    static constexpr size_t MaxConstbufferSize = 0x10000;
     static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0,
     static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0,
                   "The maximum size of a constbuffer must be a multiple of the size of GLvec4");
                   "The maximum size of a constbuffer must be a multiple of the size of GLvec4");