diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 57 | ||||
-rw-r--r-- | src/video_core/memory_manager.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 8 |
3 files changed, 30 insertions, 37 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index f9794dfe4..4a2f2c1fd 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -631,47 +631,40 @@ void Maxwell3D::ProcessDeferredDraw() { Instance, }; DrawMode draw_mode{DrawMode::Undefined}; - u32 instance_count = 1; - - u32 index = 0; - u32 method = 0; u32 method_count = static_cast<u32>(deferred_draw_method.size()); - for (; index < method_count && - (method = deferred_draw_method[index]) != MAXWELL3D_REG_INDEX(draw.begin); - ++index) - ; - - if (MAXWELL3D_REG_INDEX(draw.begin) != method) { - return; - } - - // The minimum number of methods for drawing must be greater than or equal to - // 3[draw.begin->vertex(index)count(first)->draw.end] to avoid errors in index mode drawing - if ((method_count - index) < 3) { + u32 method = deferred_draw_method[method_count - 1]; + if (MAXWELL3D_REG_INDEX(draw.end) != method) { return; } draw_mode = (regs.draw.instance_id == Maxwell3D::Regs::Draw::InstanceId::Subsequent) || (regs.draw.instance_id == Maxwell3D::Regs::Draw::InstanceId::Unchanged) ? DrawMode::Instance : DrawMode::General; - - // Drawing will only begin with draw.begin or index_buffer method, other methods directly - // clear - if (draw_mode == DrawMode::Undefined) { - deferred_draw_method.clear(); - return; - } - + u32 instance_count = 0; if (draw_mode == DrawMode::Instance) { - ASSERT_MSG(deferred_draw_method.size() % 4 == 0, "Instance mode method size error"); - instance_count = static_cast<u32>(method_count - index) / 4; + u32 vertex_buffer_count = 0; + u32 index_buffer_count = 0; + for (u32 index = 0; index < method_count; ++index) { + method = deferred_draw_method[index]; + if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count)) { + instance_count = ++vertex_buffer_count; + } else if (method == MAXWELL3D_REG_INDEX(index_buffer.count)) { + instance_count = ++index_buffer_count; + } + } + ASSERT_MSG(!(vertex_buffer_count && index_buffer_count), + "Instance both indexed and direct?"); } else { - method = deferred_draw_method[index + 1]; - if (MAXWELL3D_REG_INDEX(draw_inline_index) == method || - MAXWELL3D_REG_INDEX(inline_index_2x16.even) == method || - MAXWELL3D_REG_INDEX(inline_index_4x8.index0) == method) { - regs.index_buffer.count = static_cast<u32>(inline_index_draw_indexes.size() / 4); - regs.index_buffer.format = Regs::IndexFormat::UnsignedInt; + instance_count = 1; + for (u32 index = 0; index < method_count; ++index) { + method = deferred_draw_method[index]; + if (MAXWELL3D_REG_INDEX(draw_inline_index) == method || + MAXWELL3D_REG_INDEX(inline_index_2x16.even) == method || + MAXWELL3D_REG_INDEX(inline_index_4x8.index0) == method) { + regs.index_buffer.count = static_cast<u32>(inline_index_draw_indexes.size() / 4); + regs.index_buffer.format = Regs::IndexFormat::UnsignedInt; + break; + } } } diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 384350dbd..8c8dfcca6 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -45,7 +45,7 @@ MemoryManager::MemoryManager(Core::System& system_, u64 address_space_bits_, u64 kind_valus.fill(PTEKind::INVALID); big_kinds.resize(big_page_table_size / 32, kind_valus); entries.resize(page_table_size / 32, 0); - kinds.resize(big_page_table_size / 32, kind_valus); + kinds.resize(page_table_size / 32, kind_valus); } MemoryManager::~MemoryManager() = default; diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 81b6c372d..1aa116cea 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -467,7 +467,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { } void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling, - const RenderAreaPushConstant& render_are) { + const RenderAreaPushConstant& render_area) { texture_cache.UpdateRenderTargets(false); scheduler.RequestRenderpass(texture_cache.GetFramebuffer()); @@ -484,8 +484,8 @@ void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling, const void* const descriptor_data{update_descriptor_queue.UpdateData()}; scheduler.Record([this, descriptor_data, bind_pipeline, rescaling_data = rescaling.Data(), is_rescaling, update_rescaling, - uses_render_area = render_are.uses_render_area, - render_area_data = render_are.words](vk::CommandBuffer cmdbuf) { + uses_render_area = render_area.uses_render_area, + render_area_data = render_area.words](vk::CommandBuffer cmdbuf) { if (bind_pipeline) { cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline); } @@ -494,7 +494,7 @@ void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling, rescaling_data.data()); if (update_rescaling) { const f32 config_down_factor{Settings::values.resolution_info.down_factor}; - const f32 scale_down_factor{is_rescaling ? config_down_factor : 2.0f}; + const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f}; cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, RESCALING_LAYOUT_DOWN_FACTOR_OFFSET, sizeof(scale_down_factor), &scale_down_factor); |