Remove the confusing "DisableState" across the codebase

This commit is contained in:
Henrik Rydgård 2018-02-08 16:21:41 +01:00
parent b9081dd624
commit 86cfc411a4
11 changed files with 9 additions and 44 deletions

View file

@ -690,7 +690,6 @@ void FramebufferManagerCommon::UpdateFromMemory(u32 addr, int size, bool safe) {
FlushBeforeCopy();
if (useBufferedRendering_ && vfb->fbo) {
DisableState();
GEBufferFormat fmt = vfb->format;
if (vfb->last_frame_render + 1 < gpuStats.numFlips && isDisplayBuf) {
// If we're not rendering to it, format may be wrong. Use displayFormat_ instead.
@ -731,7 +730,6 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
SetViewport2D(x, y, w, h);
draw_->SetScissorRect(0, 0, pixelWidth_, pixelHeight_);
}
DisableState();
MakePixelTexture(srcPixels, srcPixelFormat, srcStride, width, height, u1, v1);
@ -775,8 +773,6 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, GEBu
float v0 = 0.0f, v1 = 1.0f;
MakePixelTexture(srcPixels, srcPixelFormat, srcStride, 512, 272, u1, v1);
DisableState();
struct CardboardSettings cardboardSettings;
GetCardboardSettings(&cardboardSettings);
@ -951,7 +947,6 @@ void FramebufferManagerCommon::CopyDisplayToOutput() {
if (vfb->fbo) {
DEBUG_LOG(FRAMEBUF, "Displaying FBO %08x", vfb->fb_address);
DisableState();
int uvRotation = useBufferedRendering_ ? g_Config.iInternalScreenRotation : ROTATION_LOCKED_HORIZONTAL;

View file

@ -312,7 +312,6 @@ protected:
bool UpdateSize();
void SetNumExtraFBOs(int num);
virtual void DisableState() = 0;
void FlushBeforeCopy();
virtual void DecimateFBOs(); // keeping it virtual to let D3D do a little extra

View file

@ -197,13 +197,6 @@ void FramebufferManagerD3D11::SetDrawEngine(DrawEngineD3D11 *td) {
drawEngine_ = td;
}
void FramebufferManagerD3D11::DisableState() {
context_->OMSetBlendState(stockD3D11.blendStateDisabledWithColorMask[0xF], nullptr, 0xFFFFFFFF);
context_->RSSetState(stockD3D11.rasterStateNoCull);
context_->OMSetDepthStencilState(stockD3D11.depthStencilDisabled, 0xFF);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
void FramebufferManagerD3D11::CompilePostShader() {
std::string vsSource;
std::string psSource;
@ -731,8 +724,6 @@ void FramebufferManagerD3D11::DestroyAllFBOs() {
tempFBOs_.clear();
SetNumExtraFBOs(0);
DisableState();
}
void FramebufferManagerD3D11::Resized() {

View file

@ -65,8 +65,6 @@ public:
}
protected:
void DisableState() override;
// Used by ReadFramebufferToMemory and later framebuffer block copies
void BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int dstY, VirtualFramebuffer *src, int srcX, int srcY, int w, int h, int bpp) override;

View file

@ -81,17 +81,6 @@ static const D3DVERTEXELEMENT9 g_FramebufferVertexElements[] = {
D3DDECL_END()
};
void FramebufferManagerDX9::DisableState() {
dxstate.blend.disable();
dxstate.cullMode.set(false, false);
dxstate.depthTest.disable();
dxstate.scissorTest.disable();
dxstate.stencilTest.disable();
dxstate.colorMask.set(true, true, true, true);
dxstate.stencilMask.set(0xFF);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VIEWPORTSCISSOR_STATE);
}
FramebufferManagerDX9::FramebufferManagerDX9(Draw::DrawContext *draw)
: FramebufferManagerCommon(draw),
drawPixelsTex_(0),
@ -249,7 +238,7 @@ static const D3DVERTEXELEMENT9 g_FramebufferVertexElements[] = {
}
void FramebufferManagerDX9::DrawActiveTexture(float x, float y, float w, float h, float destW, float destH, float u0, float v0, float u1, float v1, int uvRotation, int flags) {
// TODO: StretchRect instead?
// TODO: StretchRect instead when possible?
float coord[20] = {
x,y,0, u0,v0,
x+w,y,0, u1,v0,
@ -297,7 +286,13 @@ static const D3DVERTEXELEMENT9 g_FramebufferVertexElements[] = {
}
dxstate.texMipLodBias.set(0.0f);
dxstate.texMaxMipLevel.set(0);
device_->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
dxstate.blend.disable();
dxstate.cullMode.set(false, false);
dxstate.depthTest.disable();
dxstate.scissorTest.disable();
dxstate.stencilTest.disable();
dxstate.colorMask.set(true, true, true, true);
dxstate.stencilMask.set(0xFF);
HRESULT hr = device_->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, coord, 5 * sizeof(float));
if (FAILED(hr)) {
ERROR_LOG_REPORT(G3D, "DrawActiveTexture() failed: %08x", hr);
@ -725,8 +720,6 @@ static const D3DVERTEXELEMENT9 g_FramebufferVertexElements[] = {
offscreenSurfaces_.clear();
SetNumExtraFBOs(0);
DisableState();
}
void FramebufferManagerDX9::Resized() {

View file

@ -73,7 +73,6 @@ protected:
void Bind2DShader() override;
void BindPostShader(const PostShaderUniforms &uniforms) override;
void SetViewport2D(int x, int y, int w, int h) override;
void DisableState() override;
void DecimateFBOs() override;
// Used by ReadFramebufferToMemory and later framebuffer block copies

View file

@ -181,7 +181,6 @@ bool FramebufferManagerDX9::NotifyStencilUpload(u32 addr, int size, bool skipZer
shaderManagerDX9_->DirtyLastShader();
DisableState();
dxstate.colorMask.set(false, false, false, true);
dxstate.stencilTest.enable();
dxstate.stencilOp.set(D3DSTENCILOP_REPLACE, D3DSTENCILOP_REPLACE, D3DSTENCILOP_REPLACE);

View file

@ -80,10 +80,6 @@ const int MAX_PBO = 2;
void ConvertFromRGBA8888(u8 *dst, const u8 *src, u32 dstStride, u32 srcStride, u32 width, u32 height, GEBufferFormat format);
void FramebufferManagerGLES::DisableState() {
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VIEWPORTSCISSOR_STATE);
}
void FramebufferManagerGLES::CompileDraw2DProgram() {
if (!draw2dprogram_) {
std::string errorString;
@ -784,8 +780,6 @@ void FramebufferManagerGLES::DestroyAllFBOs() {
tempFBOs_.clear();
SetNumExtraFBOs(0);
DisableState();
}
void FramebufferManagerGLES::Resized() {

View file

@ -69,7 +69,6 @@ public:
protected:
void SetViewport2D(int x, int y, int w, int h) override;
void DisableState() override;
// Used by ReadFramebufferToMemory and later framebuffer block copies
void BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int dstY, VirtualFramebuffer *src, int srcX, int srcY, int w, int h, int bpp) override;

View file

@ -142,8 +142,6 @@ bool FramebufferManagerGLES::NotifyStencilUpload(u32 addr, int size, bool skipZe
shaderManagerGL_->DirtyLastShader();
DisableState();
bool useBlit = gstate_c.Supports(GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT | GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT);
// Our fragment shader (and discard) is slow. Since the source is 1x, we can stencil to 1x.
@ -169,6 +167,7 @@ bool FramebufferManagerGLES::NotifyStencilUpload(u32 addr, int size, bool skipZe
textureCacheGL_->ForgetLastTexture();
// We must bind the program after starting the render pass, and set the color mask after clearing.
render_->SetDepth(false, false, GL_ALWAYS);
render_->Clear(0, 0, 0, GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, 0x8, 0, 0, 0, 0);
render_->SetStencilFunc(GL_TRUE, GL_ALWAYS, 0xFF, 0xFF);
render_->BindProgram(stencilUploadProgram_);

View file

@ -89,7 +89,6 @@ protected:
void Bind2DShader() override;
void BindPostShader(const PostShaderUniforms &uniforms) override;
void SetViewport2D(int x, int y, int w, int h) override;
void DisableState() override {}
// Used by ReadFramebufferToMemory and later framebuffer block copies
void BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int dstY, VirtualFramebuffer *src, int srcX, int srcY, int w, int h, int bpp) override;