mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 14:46:49 +01:00
OGL: Invalidate tracked state when calling ResetAPIState()
Due to the current design, any of the GL state can be mutated after calling this function, so we can't assume that the tracked state will match if we call SetPipeline() after ResetAPIState().
This commit is contained in:
parent
224b23b979
commit
396b7c2978
@ -357,7 +357,10 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context)
|
|||||||
: ::Renderer(static_cast<int>(std::max(main_gl_context->GetBackBufferWidth(), 1u)),
|
: ::Renderer(static_cast<int>(std::max(main_gl_context->GetBackBufferWidth(), 1u)),
|
||||||
static_cast<int>(std::max(main_gl_context->GetBackBufferHeight(), 1u)),
|
static_cast<int>(std::max(main_gl_context->GetBackBufferHeight(), 1u)),
|
||||||
AbstractTextureFormat::RGBA8),
|
AbstractTextureFormat::RGBA8),
|
||||||
m_main_gl_context(std::move(main_gl_context))
|
m_main_gl_context(std::move(main_gl_context)),
|
||||||
|
m_current_rasterization_state(RenderState::GetInvalidRasterizationState()),
|
||||||
|
m_current_depth_state(RenderState::GetInvalidDepthState()),
|
||||||
|
m_current_blend_state(RenderState::GetInvalidBlendingState())
|
||||||
{
|
{
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
|
|
||||||
@ -1585,6 +1588,9 @@ void Renderer::ResetAPIState()
|
|||||||
}
|
}
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
m_current_rasterization_state = RenderState::GetInvalidRasterizationState();
|
||||||
|
m_current_depth_state = RenderState::GetInvalidDepthState();
|
||||||
|
m_current_blend_state = RenderState::GetInvalidBlendingState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::RestoreAPIState()
|
void Renderer::RestoreAPIState()
|
||||||
@ -1603,10 +1609,6 @@ void Renderer::RestoreAPIState()
|
|||||||
}
|
}
|
||||||
BPFunctions::SetScissor();
|
BPFunctions::SetScissor();
|
||||||
BPFunctions::SetViewport();
|
BPFunctions::SetViewport();
|
||||||
|
|
||||||
ApplyRasterizationState(m_current_rasterization_state, true);
|
|
||||||
ApplyDepthState(m_current_depth_state, true);
|
|
||||||
ApplyBlendingState(m_current_blend_state, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::ApplyRasterizationState(const RasterizationState state, bool force)
|
void Renderer::ApplyRasterizationState(const RasterizationState state, bool force)
|
||||||
|
@ -168,8 +168,8 @@ private:
|
|||||||
std::unique_ptr<GLContext> m_main_gl_context;
|
std::unique_ptr<GLContext> m_main_gl_context;
|
||||||
std::array<const AbstractTexture*, 8> m_bound_textures{};
|
std::array<const AbstractTexture*, 8> m_bound_textures{};
|
||||||
const OGLPipeline* m_graphics_pipeline = nullptr;
|
const OGLPipeline* m_graphics_pipeline = nullptr;
|
||||||
RasterizationState m_current_rasterization_state = {};
|
RasterizationState m_current_rasterization_state;
|
||||||
DepthState m_current_depth_state = {};
|
DepthState m_current_depth_state;
|
||||||
BlendingState m_current_blend_state = {};
|
BlendingState m_current_blend_state;
|
||||||
};
|
};
|
||||||
} // namespace OGL
|
} // namespace OGL
|
||||||
|
@ -199,6 +199,13 @@ SamplerState& SamplerState::operator=(const SamplerState& rhs)
|
|||||||
|
|
||||||
namespace RenderState
|
namespace RenderState
|
||||||
{
|
{
|
||||||
|
RasterizationState GetInvalidRasterizationState()
|
||||||
|
{
|
||||||
|
RasterizationState state;
|
||||||
|
state.hex = UINT32_C(0xFFFFFFFF);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
RasterizationState GetNoCullRasterizationState()
|
RasterizationState GetNoCullRasterizationState()
|
||||||
{
|
{
|
||||||
RasterizationState state = {};
|
RasterizationState state = {};
|
||||||
@ -206,6 +213,13 @@ RasterizationState GetNoCullRasterizationState()
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DepthState GetInvalidDepthState()
|
||||||
|
{
|
||||||
|
DepthState state;
|
||||||
|
state.hex = UINT32_C(0xFFFFFFFF);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
DepthState GetNoDepthTestingDepthStencilState()
|
DepthState GetNoDepthTestingDepthStencilState()
|
||||||
{
|
{
|
||||||
DepthState state = {};
|
DepthState state = {};
|
||||||
@ -215,6 +229,13 @@ DepthState GetNoDepthTestingDepthStencilState()
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlendingState GetInvalidBlendingState()
|
||||||
|
{
|
||||||
|
BlendingState state;
|
||||||
|
state.hex = UINT32_C(0xFFFFFFFF);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
BlendingState GetNoBlendingBlendState()
|
BlendingState GetNoBlendingBlendState()
|
||||||
{
|
{
|
||||||
BlendingState state = {};
|
BlendingState state = {};
|
||||||
@ -230,6 +251,13 @@ BlendingState GetNoBlendingBlendState()
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SamplerState GetInvalidSamplerState()
|
||||||
|
{
|
||||||
|
SamplerState state;
|
||||||
|
state.hex = UINT64_C(0xFFFFFFFFFFFFFFFF);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
SamplerState GetPointSamplerState()
|
SamplerState GetPointSamplerState()
|
||||||
{
|
{
|
||||||
SamplerState state = {};
|
SamplerState state = {};
|
||||||
|
@ -113,9 +113,13 @@ union SamplerState
|
|||||||
|
|
||||||
namespace RenderState
|
namespace RenderState
|
||||||
{
|
{
|
||||||
|
RasterizationState GetInvalidRasterizationState();
|
||||||
RasterizationState GetNoCullRasterizationState();
|
RasterizationState GetNoCullRasterizationState();
|
||||||
|
DepthState GetInvalidDepthState();
|
||||||
DepthState GetNoDepthTestingDepthStencilState();
|
DepthState GetNoDepthTestingDepthStencilState();
|
||||||
|
BlendingState GetInvalidBlendingState();
|
||||||
BlendingState GetNoBlendingBlendState();
|
BlendingState GetNoBlendingBlendState();
|
||||||
|
SamplerState GetInvalidSamplerState();
|
||||||
SamplerState GetPointSamplerState();
|
SamplerState GetPointSamplerState();
|
||||||
SamplerState GetLinearSamplerState();
|
SamplerState GetLinearSamplerState();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user