Просмотр исходного кода

vk_rasterizer: Skip index buffer setup when vertices are zero

Xenoblade 2 invokes a draw call with zero vertices.
This is likely due to indirect drawing (glDrawArraysIndirect).

This causes a crash in the staging buffer pool when trying to create a
buffer with a size of zero. To workaround this, skip index buffer setup
entirely when the number of indices is zero.
ReinUsesLisp 6 лет назад
Родитель
Сommit
d6a24b4a5b
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      src/video_core/renderer_vulkan/vk_rasterizer.cpp

+ 3 - 0
src/video_core/renderer_vulkan/vk_rasterizer.cpp

@@ -896,6 +896,9 @@ void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex
 
 
 void RasterizerVulkan::SetupIndexBuffer(BufferBindings& buffer_bindings, DrawParameters& params,
 void RasterizerVulkan::SetupIndexBuffer(BufferBindings& buffer_bindings, DrawParameters& params,
                                         bool is_indexed) {
                                         bool is_indexed) {
+    if (params.num_vertices == 0) {
+        return;
+    }
     const auto& regs = system.GPU().Maxwell3D().regs;
     const auto& regs = system.GPU().Maxwell3D().regs;
     switch (regs.draw.topology) {
     switch (regs.draw.topology) {
     case Maxwell::PrimitiveTopology::Quads: {
     case Maxwell::PrimitiveTopology::Quads: {