summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/engines/maxwell_3d.h3
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp12
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp6
3 files changed, 13 insertions, 8 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 59d5752d2..7bbc6600b 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1259,7 +1259,8 @@ public:
1259 1259
1260 GPUVAddr LimitAddress() const { 1260 GPUVAddr LimitAddress() const {
1261 return static_cast<GPUVAddr>((static_cast<GPUVAddr>(limit_high) << 32) | 1261 return static_cast<GPUVAddr>((static_cast<GPUVAddr>(limit_high) << 32) |
1262 limit_low); 1262 limit_low) +
1263 1;
1263 } 1264 }
1264 } vertex_array_limit[NumVertexArrays]; 1265 } vertex_array_limit[NumVertexArrays];
1265 1266
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 175374f0d..1c3b3b644 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -185,8 +185,12 @@ void RasterizerOpenGL::SetupVertexBuffer() {
185 const GPUVAddr start = vertex_array.StartAddress(); 185 const GPUVAddr start = vertex_array.StartAddress();
186 const GPUVAddr end = regs.vertex_array_limit[index].LimitAddress(); 186 const GPUVAddr end = regs.vertex_array_limit[index].LimitAddress();
187 187
188 ASSERT(end > start); 188 ASSERT(end >= start);
189 const u64 size = end - start + 1; 189 const u64 size = end - start;
190 if (size == 0) {
191 glBindVertexBuffer(static_cast<GLuint>(index), 0, 0, vertex_array.stride);
192 continue;
193 }
190 const auto [vertex_buffer, vertex_buffer_offset] = buffer_cache.UploadMemory(start, size); 194 const auto [vertex_buffer, vertex_buffer_offset] = buffer_cache.UploadMemory(start, size);
191 glBindVertexBuffer(static_cast<GLuint>(index), vertex_buffer, vertex_buffer_offset, 195 glBindVertexBuffer(static_cast<GLuint>(index), vertex_buffer, vertex_buffer_offset,
192 vertex_array.stride); 196 vertex_array.stride);
@@ -310,8 +314,8 @@ std::size_t RasterizerOpenGL::CalculateVertexArraysSize() const {
310 const GPUVAddr start = regs.vertex_array[index].StartAddress(); 314 const GPUVAddr start = regs.vertex_array[index].StartAddress();
311 const GPUVAddr end = regs.vertex_array_limit[index].LimitAddress(); 315 const GPUVAddr end = regs.vertex_array_limit[index].LimitAddress();
312 316
313 ASSERT(end > start); 317 size += end - start;
314 size += end - start + 1; 318 ASSERT(end >= start);
315 } 319 }
316 320
317 return size; 321 return size;
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 71007bbe8..2ebf34fc4 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -834,8 +834,8 @@ void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex
834 const GPUVAddr start{vertex_array.StartAddress()}; 834 const GPUVAddr start{vertex_array.StartAddress()};
835 const GPUVAddr end{regs.vertex_array_limit[index].LimitAddress()}; 835 const GPUVAddr end{regs.vertex_array_limit[index].LimitAddress()};
836 836
837 ASSERT(end > start); 837 ASSERT(end >= start);
838 const std::size_t size{end - start + 1}; 838 const std::size_t size{end - start};
839 const auto [buffer, offset] = buffer_cache.UploadMemory(start, size); 839 const auto [buffer, offset] = buffer_cache.UploadMemory(start, size);
840 buffer_bindings.AddVertexBinding(buffer, offset); 840 buffer_bindings.AddVertexBinding(buffer, offset);
841 } 841 }
@@ -1179,7 +1179,7 @@ std::size_t RasterizerVulkan::CalculateVertexArraysSize() const {
1179 const GPUVAddr end{regs.vertex_array_limit[index].LimitAddress()}; 1179 const GPUVAddr end{regs.vertex_array_limit[index].LimitAddress()};
1180 DEBUG_ASSERT(end >= start); 1180 DEBUG_ASSERT(end >= start);
1181 1181
1182 size += (end - start + 1) * regs.vertex_array[index].enable; 1182 size += (end - start) * regs.vertex_array[index].enable;
1183 } 1183 }
1184 return size; 1184 return size;
1185} 1185}