mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[dxvk] Implement sampler reduction mode
This commit is contained in:
parent
43b19f773c
commit
2329c71b6f
@ -34,6 +34,8 @@ namespace dxvk {
|
||||
info.compareToDepth = (filterBits & 0x80) ? VK_TRUE : VK_FALSE;
|
||||
info.compareOp = DecodeCompareOp(desc.ComparisonFunc);
|
||||
|
||||
info.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
info.borderColor.float32[i] = desc.BorderColor[i];
|
||||
|
||||
|
@ -362,6 +362,7 @@ namespace dxvk {
|
||||
samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
samplerInfo.compareToDepth = VK_FALSE;
|
||||
samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS;
|
||||
samplerInfo.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
samplerInfo.borderColor = VkClearColorValue();
|
||||
samplerInfo.usePixelCoord = VK_FALSE;
|
||||
samplerInfo.nonSeamless = VK_FALSE;
|
||||
|
@ -5978,6 +5978,7 @@ namespace dxvk {
|
||||
info.mipmapLodBias = cKey.MipmapLodBias;
|
||||
info.mipmapLodMin = mipFilter.MipsEnabled ? float(cKey.MaxMipLevel) : 0;
|
||||
info.mipmapLodMax = mipFilter.MipsEnabled ? FLT_MAX : 0;
|
||||
info.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
info.usePixelCoord = VK_FALSE;
|
||||
info.nonSeamless = m_dxvkDevice->features().extNonSeamlessCubeMap.nonSeamlessCubeMap && !m_d3d9Options.seamlessCubes;
|
||||
|
||||
|
@ -10,6 +10,9 @@ namespace dxvk {
|
||||
VkSamplerCustomBorderColorCreateInfoEXT borderColorInfo = { VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT };
|
||||
borderColorInfo.customBorderColor = info.borderColor;
|
||||
|
||||
VkSamplerReductionModeCreateInfo reductionInfo = { VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO };
|
||||
reductionInfo.reductionMode = info.reductionMode;
|
||||
|
||||
VkSamplerCreateInfo samplerInfo = { VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO };
|
||||
samplerInfo.flags = info.nonSeamless ? VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT : 0;
|
||||
samplerInfo.magFilter = info.magFilter;
|
||||
@ -39,6 +42,9 @@ namespace dxvk {
|
||||
if (samplerInfo.borderColor == VK_BORDER_COLOR_FLOAT_CUSTOM_EXT)
|
||||
borderColorInfo.pNext = std::exchange(samplerInfo.pNext, &borderColorInfo);
|
||||
|
||||
if (reductionInfo.reductionMode != VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE)
|
||||
reductionInfo.pNext = std::exchange(samplerInfo.pNext, &reductionInfo);
|
||||
|
||||
if (m_vkd->vkCreateSampler(m_vkd->device(),
|
||||
&samplerInfo, nullptr, &m_sampler) != VK_SUCCESS)
|
||||
throw DxvkError("DxvkSampler::DxvkSampler: Failed to create sampler");
|
||||
|
@ -33,9 +33,12 @@ namespace dxvk {
|
||||
VkBool32 compareToDepth;
|
||||
VkCompareOp compareOp;
|
||||
|
||||
/// Reduction mode for min/max samplers
|
||||
VkSamplerReductionMode reductionMode;
|
||||
|
||||
/// Texture border color
|
||||
VkClearColorValue borderColor;
|
||||
|
||||
|
||||
/// Enables unnormalized coordinates
|
||||
VkBool32 usePixelCoord;
|
||||
|
||||
|
@ -301,6 +301,7 @@ namespace dxvk {
|
||||
samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
|
||||
samplerInfo.compareToDepth = VK_FALSE;
|
||||
samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS;
|
||||
samplerInfo.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
samplerInfo.borderColor = VkClearColorValue();
|
||||
samplerInfo.usePixelCoord = VK_TRUE;
|
||||
samplerInfo.nonSeamless = VK_FALSE;
|
||||
|
@ -29,6 +29,7 @@ namespace dxvk {
|
||||
info.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
info.compareToDepth = VK_FALSE;
|
||||
info.compareOp = VK_COMPARE_OP_NEVER;
|
||||
info.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
info.borderColor = VkClearColorValue();
|
||||
info.usePixelCoord = VK_FALSE;
|
||||
info.nonSeamless = VK_FALSE;
|
||||
|
@ -309,6 +309,7 @@ namespace dxvk::hud {
|
||||
info.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
info.compareToDepth = VK_FALSE;
|
||||
info.compareOp = VK_COMPARE_OP_NEVER;
|
||||
info.reductionMode = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE;
|
||||
info.borderColor = VkClearColorValue();
|
||||
info.usePixelCoord = VK_TRUE;
|
||||
info.nonSeamless = VK_FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user