mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxbc] Implement stencil ref export from fragment shaders
This is an optional feature in D3D11.3, but easy enough to support.
This commit is contained in:
parent
b7bc51c3bd
commit
17a6c4168e
@ -1367,10 +1367,11 @@ namespace dxvk {
|
||||
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS2))
|
||||
return E_INVALIDARG;
|
||||
|
||||
const auto& extensions = m_dxvkDevice->extensions();
|
||||
const auto& features = m_dxvkDevice->features();
|
||||
|
||||
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS2*>(pFeatureSupportData);
|
||||
info->PSSpecifiedStencilRefSupported = FALSE; // TODO
|
||||
info->PSSpecifiedStencilRefSupported = extensions.extShaderStencilExport;
|
||||
info->TypedUAVLoadAdditionalFormats = features.core.features.shaderStorageImageReadWithoutFormat;
|
||||
info->ROVsSupported = FALSE;
|
||||
info->ConservativeRasterizationTier = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED;
|
||||
|
@ -554,6 +554,18 @@ namespace dxvk {
|
||||
"oDepth");
|
||||
} break;
|
||||
|
||||
case DxbcOperandType::OutputStencilRef: {
|
||||
m_module.enableExtension("SPV_EXT_shader_stencil_export");
|
||||
m_module.enableCapability(spv::CapabilityStencilExportEXT);
|
||||
m_module.setExecutionMode(m_entryPointId,
|
||||
spv::ExecutionModeStencilRefReplacingEXT);
|
||||
m_ps.builtinStencilRef = emitNewBuiltinVariable({
|
||||
{ DxbcScalarType::Sint32, 1, 0 },
|
||||
spv::StorageClassOutput },
|
||||
spv::BuiltInFragStencilRefEXT,
|
||||
"oStencilRef");
|
||||
} break;
|
||||
|
||||
case DxbcOperandType::OutputDepthGe: {
|
||||
m_module.setExecutionMode(m_entryPointId, spv::ExecutionModeDepthReplacing);
|
||||
m_module.setExecutionMode(m_entryPointId, spv::ExecutionModeDepthGreater);
|
||||
@ -4860,6 +4872,11 @@ namespace dxvk {
|
||||
{ DxbcScalarType::Float32, 1 },
|
||||
m_ps.builtinDepth };
|
||||
|
||||
case DxbcOperandType::OutputStencilRef:
|
||||
return DxbcRegisterPointer {
|
||||
{ DxbcScalarType::Sint32, 1 },
|
||||
m_ps.builtinStencilRef };
|
||||
|
||||
case DxbcOperandType::InputPrimitiveId:
|
||||
return DxbcRegisterPointer {
|
||||
{ DxbcScalarType::Uint32, 1 },
|
||||
|
@ -171,6 +171,7 @@ namespace dxvk {
|
||||
|
||||
uint32_t builtinFragCoord = 0;
|
||||
uint32_t builtinDepth = 0;
|
||||
uint32_t builtinStencilRef = 0;
|
||||
uint32_t builtinIsFrontFace = 0;
|
||||
uint32_t builtinSampleId = 0;
|
||||
uint32_t builtinSampleMaskIn = 0;
|
||||
|
@ -288,6 +288,7 @@ namespace dxvk {
|
||||
OutputDepthGe = 38,
|
||||
OutputDepthLe = 39,
|
||||
CycleCounter = 40,
|
||||
OutputStencilRef = 41,
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user