1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 13:54:16 +01:00

[d3d9] Unbind fragment shader for ProcessVertices

Fixes validation errors and potential UB on some drivers
This commit is contained in:
Joshua Ashton 2020-01-29 21:43:12 +00:00
parent 201d508626
commit 3196fbc759

View File

@ -2441,6 +2441,10 @@ namespace dxvk {
ApplyPrimitiveType(ctx, D3DPT_POINTLIST); ApplyPrimitiveType(ctx, D3DPT_POINTLIST);
// Unbind the pixel shader, we aren't drawing
// to avoid val errors / UB.
ctx->bindShader(VK_SHADER_STAGE_FRAGMENT_BIT, nullptr);
ctx->bindShader(VK_SHADER_STAGE_GEOMETRY_BIT, shader); ctx->bindShader(VK_SHADER_STAGE_GEOMETRY_BIT, shader);
ctx->bindResourceBuffer(getSWVPBufferSlot(), cBufferSlice); ctx->bindResourceBuffer(getSWVPBufferSlot(), cBufferSlice);
ctx->draw( ctx->draw(
@ -2450,6 +2454,16 @@ namespace dxvk {
ctx->bindShader(VK_SHADER_STAGE_GEOMETRY_BIT, nullptr); ctx->bindShader(VK_SHADER_STAGE_GEOMETRY_BIT, nullptr);
}); });
// We unbound the pixel shader before,
// let's make sure that gets rebound.
m_flags.set(D3D9DeviceFlag::DirtyFFPixelShader);
if (m_state.pixelShader != nullptr) {
BindShader<DxsoProgramTypes::PixelShader>(
GetCommonShader(m_state.pixelShader),
GetPixelShaderPermutation());
}
if (dst->GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER) { if (dst->GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER) {
uint32_t copySize = VertexCount * decl->GetSize(); uint32_t copySize = VertexCount * decl->GetSize();