From c0cfb1581f9e5a32fb4b750ba65eab108467550e Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 8 Dec 2022 14:07:32 +0100 Subject: [PATCH] early-access version 3197 --- README.md | 2 +- src/video_core/engines/draw_manager.cpp | 20 ++++++++++--------- src/video_core/engines/draw_manager.h | 5 +++-- src/video_core/engines/maxwell_3d.h | 1 + .../renderer_opengl/gl_rasterizer.cpp | 2 +- .../renderer_vulkan/vk_rasterizer.cpp | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c26de4d12..c6b4df03f 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3196. +This is the source code for early-access 3197. ## Legal Notice diff --git a/src/video_core/engines/draw_manager.cpp b/src/video_core/engines/draw_manager.cpp index 6a3913f2d..c59524e58 100755 --- a/src/video_core/engines/draw_manager.cpp +++ b/src/video_core/engines/draw_manager.cpp @@ -27,7 +27,7 @@ void DrawManager::ProcessMethodCall(u32 method, u32 argument) { case MAXWELL3D_REG_INDEX(index_buffer32_subsequent): case MAXWELL3D_REG_INDEX(index_buffer16_subsequent): case MAXWELL3D_REG_INDEX(index_buffer8_subsequent): - LOG_WARNING(HW_GPU, "(STUBBED) called, Index_Buffer_Subsequent Draw"); + draw_state.instance_count++; [[fallthrough]]; case MAXWELL3D_REG_INDEX(index_buffer32_first): case MAXWELL3D_REG_INDEX(index_buffer16_first): @@ -70,7 +70,7 @@ void DrawManager::DrawArray(PrimitiveTopology topology, u32 vertex_first, u32 ve draw_state.topology = topology; draw_state.vertex_buffer.first = vertex_first; draw_state.vertex_buffer.count = vertex_count; - draw_state.base_insance = base_instance; + draw_state.base_instance = base_instance; ProcessDraw(false, num_instances); } @@ -82,7 +82,7 @@ void DrawManager::DrawIndex(PrimitiveTopology topology, u32 index_first, u32 ind draw_state.index_buffer.first = index_first; draw_state.index_buffer.count = index_count; draw_state.base_index = base_index; - draw_state.base_insance = base_instance; + draw_state.base_instance = base_instance; ProcessDraw(true, num_instances); } @@ -119,7 +119,7 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) { break; [[fallthrough]]; case DrawMode::General: - draw_state.base_insance = regs.global_base_instance_index; + draw_state.base_instance = regs.global_base_instance_index; draw_state.base_index = regs.global_base_vertex_index; if (draw_state.draw_indexed) { draw_state.index_buffer = regs.index_buffer; @@ -131,7 +131,7 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) { draw_state.draw_indexed = false; break; case DrawMode::InlineIndex: - draw_state.base_insance = regs.global_base_instance_index; + draw_state.base_instance = regs.global_base_instance_index; draw_state.base_index = regs.global_base_vertex_index; draw_state.index_buffer = regs.index_buffer; draw_state.index_buffer.count = @@ -143,13 +143,15 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) { } } -void DrawManager::DrawIndexSmall(int argument) { +void DrawManager::DrawIndexSmall(u32 argument) { const auto& regs{maxwell3d->regs}; - draw_state.base_insance = regs.global_base_instance_index; + IndexBufferSmall index_small_params{argument}; + draw_state.base_instance = regs.global_base_instance_index; draw_state.base_index = regs.global_base_vertex_index; draw_state.index_buffer = regs.index_buffer; - draw_state.index_buffer.first = argument & 0xffff; - draw_state.index_buffer.count = (argument >> 16) & 0xfff; + draw_state.index_buffer.first = index_small_params.first; + draw_state.index_buffer.count = index_small_params.count; + draw_state.topology = index_small_params.topology; maxwell3d->dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; ProcessDraw(true, 1); } diff --git a/src/video_core/engines/draw_manager.h b/src/video_core/engines/draw_manager.h index 246f0d7ad..4f67027ca 100755 --- a/src/video_core/engines/draw_manager.h +++ b/src/video_core/engines/draw_manager.h @@ -14,6 +14,7 @@ using PrimitiveTopology = Maxwell3D::Regs::PrimitiveTopology; using PrimitiveTopologyOverride = Maxwell3D::Regs::PrimitiveTopologyOverride; using IndexBuffer = Maxwell3D::Regs::IndexBuffer; using VertexBuffer = Maxwell3D::Regs::VertexBuffer; +using IndexBufferSmall = Maxwell3D::Regs::IndexBufferSmall; class DrawManager { public: @@ -25,7 +26,7 @@ public: u32 base_index{}; VertexBuffer vertex_buffer; IndexBuffer index_buffer; - u32 base_insance{}; + u32 base_instance{}; u32 instance_count{}; std::vector inline_index_draw_indexes; }; @@ -55,7 +56,7 @@ private: void DrawEnd(u32 instance_count = 1, bool force_draw = false); - void DrawIndexSmall(int argument); + void DrawIndexSmall(u32 argument); void ProcessTopologyOverride(); diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 53fdb5369..348234fd4 100755 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -2225,6 +2225,7 @@ public: struct IndexBufferSmall { union { + u32 raw; BitField<0, 16, u32> first; BitField<16, 12, u32> count; BitField<28, 4, PrimitiveTopology> topology; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 68f49867b..5b054d6fe 100755 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -229,7 +229,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, u32 instance_count) { const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(draw_state.topology); BeginTransformFeedback(pipeline, primitive_mode); - const GLuint base_instance = static_cast(draw_state.base_insance); + const GLuint base_instance = static_cast(draw_state.base_instance); const GLsizei num_instances = static_cast(instance_count); if (is_indexed) { const GLint base_vertex = static_cast(draw_state.base_index); diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index acaa5d652..1d352fac5 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -131,7 +131,7 @@ VkRect2D GetScissorState(const Maxwell& regs, size_t index, u32 up_scale = 1, u3 DrawParams MakeDrawParams(const MaxwellDrawState& draw_state, u32 num_instances, bool is_indexed) { DrawParams params{ - .base_instance = draw_state.base_insance, + .base_instance = draw_state.base_instance, .num_instances = num_instances, .base_vertex = is_indexed ? draw_state.base_index : draw_state.vertex_buffer.first, .num_vertices = is_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count,