Maxwell3D: Reorganize and address feedback
This commit is contained in:
parent
4be61013a1
commit
7a35178ee2
|
@ -70,6 +70,10 @@ void Maxwell3D::InitializeRegisterDefaults() {
|
||||||
regs.stencil_back_func_mask = 0xFFFFFFFF;
|
regs.stencil_back_func_mask = 0xFFFFFFFF;
|
||||||
regs.stencil_back_mask = 0xFFFFFFFF;
|
regs.stencil_back_mask = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
regs.depth_test_func = Regs::ComparisonOp::Always;
|
||||||
|
regs.cull.front_face = Regs::Cull::FrontFace::CounterClockWise;
|
||||||
|
regs.cull.cull_face = Regs::Cull::CullFace::Back;
|
||||||
|
|
||||||
// TODO(Rodrigo): Most games do not set a point size. I think this is a case of a
|
// TODO(Rodrigo): Most games do not set a point size. I think this is a case of a
|
||||||
// register carrying a default value. Assume it's OpenGL's default (1).
|
// register carrying a default value. Assume it's OpenGL's default (1).
|
||||||
regs.point_size = 1.0f;
|
regs.point_size = 1.0f;
|
||||||
|
|
|
@ -1246,8 +1246,6 @@ private:
|
||||||
/// Interpreter for the macro codes uploaded to the GPU.
|
/// Interpreter for the macro codes uploaded to the GPU.
|
||||||
MacroInterpreter macro_interpreter;
|
MacroInterpreter macro_interpreter;
|
||||||
|
|
||||||
Upload::State upload_state;
|
|
||||||
|
|
||||||
static constexpr u32 null_cb_data = 0xFFFFFFFF;
|
static constexpr u32 null_cb_data = 0xFFFFFFFF;
|
||||||
struct {
|
struct {
|
||||||
std::array<std::array<u32, 0x4000>, 16> buffer;
|
std::array<std::array<u32, 0x4000>, 16> buffer;
|
||||||
|
@ -1257,6 +1255,8 @@ private:
|
||||||
u32 counter{};
|
u32 counter{};
|
||||||
} cb_data_state;
|
} cb_data_state;
|
||||||
|
|
||||||
|
Upload::State upload_state;
|
||||||
|
|
||||||
/// Retrieves information about a specific TIC entry from the TIC buffer.
|
/// Retrieves information about a specific TIC entry from the TIC buffer.
|
||||||
Texture::TICEntry GetTICEntry(u32 tic_index) const;
|
Texture::TICEntry GetTICEntry(u32 tic_index) const;
|
||||||
|
|
||||||
|
|
|
@ -993,6 +993,7 @@ void RasterizerOpenGL::SyncCullMode() {
|
||||||
const auto& regs = maxwell3d.regs;
|
const auto& regs = maxwell3d.regs;
|
||||||
|
|
||||||
state.cull.enabled = regs.cull.enabled != 0;
|
state.cull.enabled = regs.cull.enabled != 0;
|
||||||
|
if (state.cull.enabled) {
|
||||||
state.cull.front_face = MaxwellToGL::FrontFace(regs.cull.front_face);
|
state.cull.front_face = MaxwellToGL::FrontFace(regs.cull.front_face);
|
||||||
state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face);
|
state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face);
|
||||||
|
|
||||||
|
@ -1008,22 +1009,26 @@ void RasterizerOpenGL::SyncCullMode() {
|
||||||
else if (state.cull.front_face == GL_CW)
|
else if (state.cull.front_face == GL_CW)
|
||||||
state.cull.front_face = GL_CCW;
|
state.cull.front_face = GL_CCW;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
||||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
const auto& regs = system.GPU().Maxwell3D().regs;
|
||||||
const auto& regs = maxwell3d.regs;
|
|
||||||
|
|
||||||
state.primitive_restart.enabled = regs.primitive_restart.enabled;
|
state.primitive_restart.enabled = regs.primitive_restart.enabled;
|
||||||
state.primitive_restart.index = regs.primitive_restart.index;
|
state.primitive_restart.index = regs.primitive_restart.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncDepthTestState() {
|
void RasterizerOpenGL::SyncDepthTestState() {
|
||||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
const auto& regs = system.GPU().Maxwell3D().regs;
|
||||||
const auto& regs = maxwell3d.regs;
|
|
||||||
|
|
||||||
state.depth.test_enabled = regs.depth_test_enable != 0;
|
state.depth.test_enabled = regs.depth_test_enable != 0;
|
||||||
state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE;
|
state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE;
|
||||||
|
|
||||||
|
if (!state.depth.test_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func);
|
state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,6 +1040,10 @@ void RasterizerOpenGL::SyncStencilTestState() {
|
||||||
const auto& regs = maxwell3d.regs;
|
const auto& regs = maxwell3d.regs;
|
||||||
|
|
||||||
state.stencil.test_enabled = regs.stencil_enable != 0;
|
state.stencil.test_enabled = regs.stencil_enable != 0;
|
||||||
|
if (!regs.stencil_enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func);
|
state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func);
|
||||||
state.stencil.front.test_ref = regs.stencil_front_func_ref;
|
state.stencil.front.test_ref = regs.stencil_front_func_ref;
|
||||||
state.stencil.front.test_mask = regs.stencil_front_func_mask;
|
state.stencil.front.test_mask = regs.stencil_front_func_mask;
|
||||||
|
|
Reference in New Issue