mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[d3d11] Implement min/max filters
This commit is contained in:
parent
0a222aaaf0
commit
790da79512
@ -1157,8 +1157,11 @@ namespace dxvk {
|
||||
|
||||
if (FAILED(D3D11SamplerState::NormalizeDesc(&desc)))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (ppSamplerState == nullptr)
|
||||
|
||||
if (IsMinMaxFilter(desc.Filter) && m_tiledResourcesTier < D3D11_TILED_RESOURCES_TIER_2)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!ppSamplerState)
|
||||
return S_FALSE;
|
||||
|
||||
try {
|
||||
|
@ -31,10 +31,10 @@ namespace dxvk {
|
||||
info.addressModeV = DecodeAddressMode(desc.AddressV);
|
||||
info.addressModeW = DecodeAddressMode(desc.AddressW);
|
||||
|
||||
info.compareToDepth = (filterBits & 0x80) ? VK_TRUE : VK_FALSE;
|
||||
info.compareToDepth = (filterBits & 0x180) == 0x80 ? VK_TRUE : VK_FALSE;
|
||||
info.compareOp = DecodeCompareOp(desc.ComparisonFunc);
|
||||
|
||||
info.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
|
||||
info.reductionMode = DecodeReductionMode(filterBits);
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
info.borderColor.float32[i] = desc.BorderColor[i];
|
||||
@ -100,7 +100,7 @@ namespace dxvk {
|
||||
HRESULT D3D11SamplerState::NormalizeDesc(D3D11_SAMPLER_DESC* pDesc) {
|
||||
const uint32_t filterBits = uint32_t(pDesc->Filter);
|
||||
|
||||
if (filterBits & 0xFFFFFF2A) {
|
||||
if (filterBits & 0xFFFFFE2A) {
|
||||
Logger::err(str::format(
|
||||
"D3D11SamplerState: Unhandled filter: ", filterBits));
|
||||
return E_INVALIDARG;
|
||||
@ -114,7 +114,7 @@ namespace dxvk {
|
||||
pDesc->MaxAnisotropy = 0;
|
||||
}
|
||||
|
||||
if (filterBits & 0x80 /* compare-to-depth */) {
|
||||
if ((filterBits & 0x180) == 0x80 /* compare-to-depth */) {
|
||||
if (!ValidateComparisonFunc(pDesc->ComparisonFunc))
|
||||
return E_INVALIDARG;
|
||||
} else {
|
||||
|
@ -64,6 +64,19 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkSamplerReductionMode DecodeReductionMode(
|
||||
UINT Filter) {
|
||||
switch (Filter & 0x180) {
|
||||
default:
|
||||
return VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
case 0x100:
|
||||
return VK_SAMPLER_REDUCTION_MODE_MIN;
|
||||
case 0x180:
|
||||
return VK_SAMPLER_REDUCTION_MODE_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
||||
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode) {
|
||||
switch (Mode) {
|
||||
@ -125,4 +138,9 @@ namespace dxvk {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL IsMinMaxFilter(D3D11_FILTER Filter) {
|
||||
return DecodeReductionMode(uint32_t(Filter)) != VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
}
|
||||
|
||||
}
|
@ -21,13 +21,16 @@ namespace dxvk {
|
||||
HRESULT DecodeSampleCount(
|
||||
UINT Count,
|
||||
VkSampleCountFlagBits* pCount);
|
||||
|
||||
|
||||
VkSamplerAddressMode DecodeAddressMode(
|
||||
D3D11_TEXTURE_ADDRESS_MODE mode);
|
||||
|
||||
|
||||
VkCompareOp DecodeCompareOp(
|
||||
D3D11_COMPARISON_FUNC Mode);
|
||||
|
||||
|
||||
VkSamplerReductionMode DecodeReductionMode(
|
||||
UINT Filter);
|
||||
|
||||
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
||||
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode);
|
||||
|
||||
@ -40,6 +43,8 @@ namespace dxvk {
|
||||
VkFormat GetPackedDepthStencilFormat(
|
||||
DXGI_FORMAT Format);
|
||||
|
||||
BOOL IsMinMaxFilter(D3D11_FILTER Filter);
|
||||
|
||||
/**
|
||||
* \brief Translates D3D11 shader stage to corresponding Vulkan stage
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user