mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
add support for fragment_color_clamp
This commit is contained in:
parent
02c22a3440
commit
8ed7e1af2c
5 changed files with 24 additions and 1 deletions
|
@ -706,7 +706,9 @@ public:
|
||||||
u32 stencil_front_func_mask;
|
u32 stencil_front_func_mask;
|
||||||
u32 stencil_front_mask;
|
u32 stencil_front_mask;
|
||||||
|
|
||||||
INSERT_PADDING_WORDS(0x3);
|
INSERT_PADDING_WORDS(0x2);
|
||||||
|
|
||||||
|
u32 frag_color_clamp;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
BitField<4, 1, u32> triangle_rast_flip;
|
BitField<4, 1, u32> triangle_rast_flip;
|
||||||
|
@ -1142,6 +1144,7 @@ ASSERT_REG_POSITION(stencil_front_func_func, 0x4E4);
|
||||||
ASSERT_REG_POSITION(stencil_front_func_ref, 0x4E5);
|
ASSERT_REG_POSITION(stencil_front_func_ref, 0x4E5);
|
||||||
ASSERT_REG_POSITION(stencil_front_func_mask, 0x4E6);
|
ASSERT_REG_POSITION(stencil_front_func_mask, 0x4E6);
|
||||||
ASSERT_REG_POSITION(stencil_front_mask, 0x4E7);
|
ASSERT_REG_POSITION(stencil_front_mask, 0x4E7);
|
||||||
|
ASSERT_REG_POSITION(frag_color_clamp, 0x4EA);
|
||||||
ASSERT_REG_POSITION(screen_y_control, 0x4EB);
|
ASSERT_REG_POSITION(screen_y_control, 0x4EB);
|
||||||
ASSERT_REG_POSITION(vb_element_base, 0x50D);
|
ASSERT_REG_POSITION(vb_element_base, 0x50D);
|
||||||
ASSERT_REG_POSITION(point_size, 0x546);
|
ASSERT_REG_POSITION(point_size, 0x546);
|
||||||
|
|
|
@ -582,6 +582,7 @@ void RasterizerOpenGL::DrawArrays() {
|
||||||
|
|
||||||
ConfigureFramebuffers(state);
|
ConfigureFramebuffers(state);
|
||||||
SyncColorMask();
|
SyncColorMask();
|
||||||
|
SyncFragmentColorClampState();
|
||||||
SyncDepthTestState();
|
SyncDepthTestState();
|
||||||
SyncStencilTestState();
|
SyncStencilTestState();
|
||||||
SyncBlendState();
|
SyncBlendState();
|
||||||
|
@ -1032,6 +1033,11 @@ void RasterizerOpenGL::SyncColorMask() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RasterizerOpenGL::SyncFragmentColorClampState() {
|
||||||
|
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
||||||
|
state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncBlendState() {
|
void RasterizerOpenGL::SyncBlendState() {
|
||||||
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,9 @@ private:
|
||||||
/// Syncs the LogicOp state to match the guest state
|
/// Syncs the LogicOp state to match the guest state
|
||||||
void SyncLogicOpState();
|
void SyncLogicOpState();
|
||||||
|
|
||||||
|
/// Syncs the the color clamp state
|
||||||
|
void SyncFragmentColorClampState();
|
||||||
|
|
||||||
/// Syncs the scissor test state to match the guest state
|
/// Syncs the scissor test state to match the guest state
|
||||||
void SyncScissorTest();
|
void SyncScissorTest();
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ OpenGLState::OpenGLState() {
|
||||||
clip_distance = {};
|
clip_distance = {};
|
||||||
|
|
||||||
point.size = 1;
|
point.size = 1;
|
||||||
|
fragment_color_clamp.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::ApplyDefaultState() {
|
void OpenGLState::ApplyDefaultState() {
|
||||||
|
@ -497,6 +498,12 @@ void OpenGLState::Apply() const {
|
||||||
if (point.size != cur_state.point.size) {
|
if (point.size != cur_state.point.size) {
|
||||||
glPointSize(point.size);
|
glPointSize(point.size);
|
||||||
}
|
}
|
||||||
|
if (GLAD_GL_ARB_color_buffer_float) {
|
||||||
|
if (fragment_color_clamp.enabled != cur_state.fragment_color_clamp.enabled) {
|
||||||
|
glClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB,
|
||||||
|
fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
ApplyColorMask();
|
ApplyColorMask();
|
||||||
ApplyViewport();
|
ApplyViewport();
|
||||||
ApplyStencilTest();
|
ApplyStencilTest();
|
||||||
|
|
|
@ -39,6 +39,10 @@ public:
|
||||||
bool enabled; // GL_FRAMEBUFFER_SRGB
|
bool enabled; // GL_FRAMEBUFFER_SRGB
|
||||||
} framebuffer_srgb;
|
} framebuffer_srgb;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool enabled; // GL_CLAMP_FRAGMENT_COLOR_ARB
|
||||||
|
} fragment_color_clamp;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled; // viewports arrays are only supported when geometry shaders are enabled.
|
bool enabled; // viewports arrays are only supported when geometry shaders are enabled.
|
||||||
} geometry_shaders;
|
} geometry_shaders;
|
||||||
|
|
Loading…
Reference in a new issue