mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 03:38:38 +12:00
d3d12: Make depth test optionnal and use (0,0,0,0) when texture unit is disabled
This commit is contained in:
parent
482a371bb0
commit
2f54482592
4 changed files with 11 additions and 3 deletions
|
@ -436,7 +436,9 @@ void D3D12GSRender::setScaleOffset()
|
||||||
void *scaleOffsetMap;
|
void *scaleOffsetMap;
|
||||||
check(scaleOffsetBuffer->Map(0, nullptr, &scaleOffsetMap));
|
check(scaleOffsetBuffer->Map(0, nullptr, &scaleOffsetMap));
|
||||||
streamToBuffer(scaleOffsetMap, scaleOffsetMat, 16 * sizeof(float));
|
streamToBuffer(scaleOffsetMap, scaleOffsetMat, 16 * sizeof(float));
|
||||||
streamToBuffer((char*)scaleOffsetMap + 16 * sizeof(float), &m_alpha_ref, sizeof(float));
|
int isAlphaTested = m_set_alpha_test;
|
||||||
|
streamToBuffer((char*)scaleOffsetMap + 16 * sizeof(float), &isAlphaTested, sizeof(int));
|
||||||
|
streamToBuffer((char*)scaleOffsetMap + 17 * sizeof(float), &m_alpha_ref, sizeof(float));
|
||||||
scaleOffsetBuffer->Unmap(0, nullptr);
|
scaleOffsetBuffer->Unmap(0, nullptr);
|
||||||
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
||||||
|
|
|
@ -37,6 +37,7 @@ void D3D12FragmentDecompiler::insertHeader(std::stringstream & OS)
|
||||||
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
||||||
OS << "{" << std::endl;
|
OS << "{" << std::endl;
|
||||||
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
||||||
|
OS << " int isAlphaTested;" << std::endl;
|
||||||
OS << " float alphaRef;" << std::endl;
|
OS << " float alphaRef;" << std::endl;
|
||||||
OS << "};" << std::endl;
|
OS << "};" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +163,7 @@ void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS)
|
||||||
else if (m_parr.HasParam(PF_PARAM_NONE, "float4", table2[i].second))
|
else if (m_parr.HasParam(PF_PARAM_NONE, "float4", table2[i].second))
|
||||||
OS << " Out." << table2[i].first << " = " << table2[i].second << ";" << std::endl;
|
OS << " Out." << table2[i].first << " = " << table2[i].second << ";" << std::endl;
|
||||||
}
|
}
|
||||||
OS << " if (Out.ocol0.a <= alphaRef) discard;" << std::endl;
|
OS << " if (isAlphaTested && Out.ocol0.a <= alphaRef) discard;" << std::endl;
|
||||||
OS << " return Out;" << std::endl;
|
OS << " return Out;" << std::endl;
|
||||||
OS << "}" << std::endl;
|
OS << "}" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,11 @@ void D3D12GSRender::ExecCMD()
|
||||||
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||||
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
srvDesc.Texture2D.MipLevels = 1;
|
srvDesc.Texture2D.MipLevels = 1;
|
||||||
srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1, D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1, D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1, D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1);
|
srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
||||||
|
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
||||||
|
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
||||||
|
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0,
|
||||||
|
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0);
|
||||||
m_device->CreateShaderResourceView(m_dummyTexture, &srvDesc, Handle);
|
m_device->CreateShaderResourceView(m_dummyTexture, &srvDesc, Handle);
|
||||||
|
|
||||||
D3D12_SAMPLER_DESC samplerDesc = {};
|
D3D12_SAMPLER_DESC samplerDesc = {};
|
||||||
|
|
|
@ -26,6 +26,7 @@ void D3D12VertexProgramDecompiler::insertHeader(std::stringstream &OS)
|
||||||
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
||||||
OS << "{" << std::endl;
|
OS << "{" << std::endl;
|
||||||
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
||||||
|
OS << " int isAlphaTested;" << std::endl;
|
||||||
OS << " float alphaRef;" << std::endl;
|
OS << " float alphaRef;" << std::endl;
|
||||||
OS << "};" << std::endl;
|
OS << "};" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue