early-access version 3197

This commit is contained in:
pineappleEA 2022-12-08 14:07:32 +01:00
parent b4cb38517b
commit c0cfb1581f
6 changed files with 18 additions and 14 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3196. This is the source code for early-access 3197.
## Legal Notice ## Legal Notice

View File

@ -27,7 +27,7 @@ void DrawManager::ProcessMethodCall(u32 method, u32 argument) {
case MAXWELL3D_REG_INDEX(index_buffer32_subsequent): case MAXWELL3D_REG_INDEX(index_buffer32_subsequent):
case MAXWELL3D_REG_INDEX(index_buffer16_subsequent): case MAXWELL3D_REG_INDEX(index_buffer16_subsequent):
case MAXWELL3D_REG_INDEX(index_buffer8_subsequent): case MAXWELL3D_REG_INDEX(index_buffer8_subsequent):
LOG_WARNING(HW_GPU, "(STUBBED) called, Index_Buffer_Subsequent Draw"); draw_state.instance_count++;
[[fallthrough]]; [[fallthrough]];
case MAXWELL3D_REG_INDEX(index_buffer32_first): case MAXWELL3D_REG_INDEX(index_buffer32_first):
case MAXWELL3D_REG_INDEX(index_buffer16_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.topology = topology;
draw_state.vertex_buffer.first = vertex_first; draw_state.vertex_buffer.first = vertex_first;
draw_state.vertex_buffer.count = vertex_count; draw_state.vertex_buffer.count = vertex_count;
draw_state.base_insance = base_instance; draw_state.base_instance = base_instance;
ProcessDraw(false, num_instances); 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.first = index_first;
draw_state.index_buffer.count = index_count; draw_state.index_buffer.count = index_count;
draw_state.base_index = base_index; draw_state.base_index = base_index;
draw_state.base_insance = base_instance; draw_state.base_instance = base_instance;
ProcessDraw(true, num_instances); ProcessDraw(true, num_instances);
} }
@ -119,7 +119,7 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) {
break; break;
[[fallthrough]]; [[fallthrough]];
case DrawMode::General: 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; draw_state.base_index = regs.global_base_vertex_index;
if (draw_state.draw_indexed) { if (draw_state.draw_indexed) {
draw_state.index_buffer = regs.index_buffer; 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; draw_state.draw_indexed = false;
break; break;
case DrawMode::InlineIndex: 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.base_index = regs.global_base_vertex_index;
draw_state.index_buffer = regs.index_buffer; draw_state.index_buffer = regs.index_buffer;
draw_state.index_buffer.count = 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}; 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.base_index = regs.global_base_vertex_index;
draw_state.index_buffer = regs.index_buffer; draw_state.index_buffer = regs.index_buffer;
draw_state.index_buffer.first = argument & 0xffff; draw_state.index_buffer.first = index_small_params.first;
draw_state.index_buffer.count = (argument >> 16) & 0xfff; draw_state.index_buffer.count = index_small_params.count;
draw_state.topology = index_small_params.topology;
maxwell3d->dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d->dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
ProcessDraw(true, 1); ProcessDraw(true, 1);
} }

View File

@ -14,6 +14,7 @@ using PrimitiveTopology = Maxwell3D::Regs::PrimitiveTopology;
using PrimitiveTopologyOverride = Maxwell3D::Regs::PrimitiveTopologyOverride; using PrimitiveTopologyOverride = Maxwell3D::Regs::PrimitiveTopologyOverride;
using IndexBuffer = Maxwell3D::Regs::IndexBuffer; using IndexBuffer = Maxwell3D::Regs::IndexBuffer;
using VertexBuffer = Maxwell3D::Regs::VertexBuffer; using VertexBuffer = Maxwell3D::Regs::VertexBuffer;
using IndexBufferSmall = Maxwell3D::Regs::IndexBufferSmall;
class DrawManager { class DrawManager {
public: public:
@ -25,7 +26,7 @@ public:
u32 base_index{}; u32 base_index{};
VertexBuffer vertex_buffer; VertexBuffer vertex_buffer;
IndexBuffer index_buffer; IndexBuffer index_buffer;
u32 base_insance{}; u32 base_instance{};
u32 instance_count{}; u32 instance_count{};
std::vector<u8> inline_index_draw_indexes; std::vector<u8> inline_index_draw_indexes;
}; };
@ -55,7 +56,7 @@ private:
void DrawEnd(u32 instance_count = 1, bool force_draw = false); void DrawEnd(u32 instance_count = 1, bool force_draw = false);
void DrawIndexSmall(int argument); void DrawIndexSmall(u32 argument);
void ProcessTopologyOverride(); void ProcessTopologyOverride();

View File

@ -2225,6 +2225,7 @@ public:
struct IndexBufferSmall { struct IndexBufferSmall {
union { union {
u32 raw;
BitField<0, 16, u32> first; BitField<0, 16, u32> first;
BitField<16, 12, u32> count; BitField<16, 12, u32> count;
BitField<28, 4, PrimitiveTopology> topology; BitField<28, 4, PrimitiveTopology> topology;

View File

@ -229,7 +229,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, u32 instance_count) {
const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(draw_state.topology); const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(draw_state.topology);
BeginTransformFeedback(pipeline, primitive_mode); BeginTransformFeedback(pipeline, primitive_mode);
const GLuint base_instance = static_cast<GLuint>(draw_state.base_insance); const GLuint base_instance = static_cast<GLuint>(draw_state.base_instance);
const GLsizei num_instances = static_cast<GLsizei>(instance_count); const GLsizei num_instances = static_cast<GLsizei>(instance_count);
if (is_indexed) { if (is_indexed) {
const GLint base_vertex = static_cast<GLint>(draw_state.base_index); const GLint base_vertex = static_cast<GLint>(draw_state.base_index);

View File

@ -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 MakeDrawParams(const MaxwellDrawState& draw_state, u32 num_instances, bool is_indexed) {
DrawParams params{ DrawParams params{
.base_instance = draw_state.base_insance, .base_instance = draw_state.base_instance,
.num_instances = num_instances, .num_instances = num_instances,
.base_vertex = is_indexed ? draw_state.base_index : draw_state.vertex_buffer.first, .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, .num_vertices = is_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count,