gl_state: Remove clip distances tracking

This commit is contained in:
ReinUsesLisp 2019-12-26 02:20:08 -03:00
parent e8125af8dd
commit 1eee891f6e
4 changed files with 3 additions and 29 deletions

View File

@ -872,16 +872,7 @@ public:
INSERT_UNION_PADDING_WORDS(0x35); INSERT_UNION_PADDING_WORDS(0x35);
union { u32 clip_distance_enabled;
BitField<0, 1, u32> c0;
BitField<1, 1, u32> c1;
BitField<2, 1, u32> c2;
BitField<3, 1, u32> c3;
BitField<4, 1, u32> c4;
BitField<5, 1, u32> c5;
BitField<6, 1, u32> c6;
BitField<7, 1, u32> c7;
} clip_distance_enabled;
u32 samplecnt_enable; u32 samplecnt_enable;

View File

@ -969,16 +969,10 @@ void RasterizerOpenGL::SyncDepthClamp() {
void RasterizerOpenGL::SyncClipEnabled( void RasterizerOpenGL::SyncClipEnabled(
const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) { const std::array<bool, Maxwell::Regs::NumClipDistances>& clip_mask) {
const auto& regs = system.GPU().Maxwell3D().regs; const auto& regs = system.GPU().Maxwell3D().regs;
const std::array<bool, Maxwell::Regs::NumClipDistances> reg_state{
regs.clip_distance_enabled.c0 != 0, regs.clip_distance_enabled.c1 != 0,
regs.clip_distance_enabled.c2 != 0, regs.clip_distance_enabled.c3 != 0,
regs.clip_distance_enabled.c4 != 0, regs.clip_distance_enabled.c5 != 0,
regs.clip_distance_enabled.c6 != 0, regs.clip_distance_enabled.c7 != 0};
for (std::size_t i = 0; i < Maxwell::Regs::NumClipDistances; ++i) { for (std::size_t i = 0; i < Maxwell::Regs::NumClipDistances; ++i) {
state.clip_distance[i] = reg_state[i] && clip_mask[i]; oglEnable(static_cast<GLenum>(GL_CLIP_DISTANCE0 + i),
clip_mask[i] && ((regs.clip_distance_enabled >> i) & 1));
} }
} }

View File

@ -106,13 +106,6 @@ void OpenGLState::ApplyProgramPipeline() {
} }
} }
void OpenGLState::ApplyClipDistances() {
for (std::size_t i = 0; i < clip_distance.size(); ++i) {
Enable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i), cur_state.clip_distance[i],
clip_distance[i]);
}
}
void OpenGLState::ApplyStencilTest() { void OpenGLState::ApplyStencilTest() {
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled); Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
@ -249,7 +242,6 @@ void OpenGLState::Apply() {
ApplyFramebufferState(); ApplyFramebufferState();
ApplyShaderProgram(); ApplyShaderProgram();
ApplyProgramPipeline(); ApplyProgramPipeline();
ApplyClipDistances();
ApplyStencilTest(); ApplyStencilTest();
ApplyBlending(); ApplyBlending();
ApplyTextures(); ApplyTextures();

View File

@ -54,8 +54,6 @@ public:
GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING GLuint program_pipeline = 0; // GL_PROGRAM_PIPELINE_BINDING
} draw; } draw;
std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
struct { struct {
GLenum origin = GL_LOWER_LEFT; GLenum origin = GL_LOWER_LEFT;
GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE; GLenum depth_mode = GL_NEGATIVE_ONE_TO_ONE;
@ -76,7 +74,6 @@ public:
void ApplyFramebufferState(); void ApplyFramebufferState();
void ApplyShaderProgram(); void ApplyShaderProgram();
void ApplyProgramPipeline(); void ApplyProgramPipeline();
void ApplyClipDistances();
void ApplyStencilTest(); void ApplyStencilTest();
void ApplyTargetBlending(std::size_t target, bool force); void ApplyTargetBlending(std::size_t target, bool force);
void ApplyGlobalBlending(); void ApplyGlobalBlending();