Skip to content

Commit

Permalink
rend: reset scissoring before drawing final modvol quad
Browse files Browse the repository at this point in the history
  • Loading branch information
flyinghead committed Dec 31, 2024
1 parent f3a3364 commit e18ada7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/rend/dx11/dx11_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ void DX11Renderer::drawModVols(int first, int count)
setCullMode(0);
//enable color writes
deviceContext->OMSetBlendState(blendStates.getState(true, 4, 5), nullptr, 0xffffffff);
deviceContext->RSSetScissorRects(1, &scissorRect);

//black out any stencil with '1'
//only pixels that are Modvol enabled, and in area 1
Expand Down
3 changes: 2 additions & 1 deletion core/rend/dx9/d3d_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ void D3DRenderer::drawModVols(int first, int count)
devCache.SetRenderState(D3DRS_COLORWRITEENABLE, 0);

int mod_base = -1;
int clip_rect[4] = {};

for (int cmv = 0; cmv < count; cmv++)
{
Expand All @@ -715,7 +716,6 @@ void D3DRenderer::drawModVols(int first, int count)
else
setMVS_Mode(Xor, param.isp); // XOR'ing (closed volume)

int clip_rect[4] = {};
setTileClip(param.tileclip, clip_rect);
//TODO inside clipping

Expand All @@ -733,6 +733,7 @@ void D3DRenderer::drawModVols(int first, int count)
devCache.SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
//enable color writes
devCache.SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE);
setTileClip(0, clip_rect);

//black out any stencil with '1'
devCache.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
Expand Down
1 change: 1 addition & 0 deletions core/rend/gles/gldraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ void DrawModVols(int first, int count)
SetCull(0);
//enable color writes
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
SetBaseClipping();

//black out any stencil with '1'
glcache.Enable(GL_BLEND);
Expand Down
3 changes: 2 additions & 1 deletion core/rend/vulkan/drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ void Drawer::DrawModVols(const vk::CommandBuffer& cmdBuffer, int first, int coun

int mod_base = -1;
vk::Pipeline pipeline;
vk::Rect2D scissorRect;

for (int cmv = 0; cmv < count; cmv++)
{
Expand All @@ -317,7 +318,6 @@ void Drawer::DrawModVols(const vk::CommandBuffer& cmdBuffer, int first, int coun

cmdBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline);
descriptorSets.bindPerPolyDescriptorSets(cmdBuffer, param, first + cmv, curMainBuffer, offsets.naomi2ModVolOffset);
vk::Rect2D scissorRect;
SetTileClip(cmdBuffer, param.tileclip, scissorRect);
// TODO inside clipping

Expand All @@ -333,6 +333,7 @@ void Drawer::DrawModVols(const vk::CommandBuffer& cmdBuffer, int first, int coun
}
}
cmdBuffer.bindVertexBuffers(0, curMainBuffer, {0});
SetTileClip(cmdBuffer, 0, scissorRect);

const std::array<float, 6> pushConstants = { 1 - FPU_SHAD_SCALE.scale_factor / 256.f, 0, 0, 0, 0, 0 };
cmdBuffer.pushConstants<float>(pipelineManager->GetPipelineLayout(), vk::ShaderStageFlagBits::eFragment, 0, pushConstants);
Expand Down

0 comments on commit e18ada7

Please sign in to comment.