GPUDevice: Implement MirrorRepeat address mode

This commit is contained in:
Stenzek 2023-12-08 20:06:29 +10:00
parent 6deb9d3072
commit b65d2748b4
No known key found for this signature in database
7 changed files with 7 additions and 1 deletions

View file

@ -177,6 +177,7 @@ std::unique_ptr<GPUSampler> D3D11Device::CreateSampler(const GPUSampler::Config&
D3D11_TEXTURE_ADDRESS_WRAP, // Repeat D3D11_TEXTURE_ADDRESS_WRAP, // Repeat
D3D11_TEXTURE_ADDRESS_CLAMP, // ClampToEdge D3D11_TEXTURE_ADDRESS_CLAMP, // ClampToEdge
D3D11_TEXTURE_ADDRESS_BORDER, // ClampToBorder D3D11_TEXTURE_ADDRESS_BORDER, // ClampToBorder
D3D11_TEXTURE_ADDRESS_MIRROR, // MirrorRepeat
}}; }};
static constexpr u8 filter_count = static_cast<u8>(GPUSampler::Filter::MaxCount); static constexpr u8 filter_count = static_cast<u8>(GPUSampler::Filter::MaxCount);
static constexpr D3D11_FILTER filters[filter_count][filter_count][filter_count] = { static constexpr D3D11_FILTER filters[filter_count][filter_count][filter_count] = {

View file

@ -786,6 +786,7 @@ D3D12DescriptorHandle D3D12Device::GetSampler(const GPUSampler::Config& config)
D3D12_TEXTURE_ADDRESS_MODE_WRAP, // Repeat D3D12_TEXTURE_ADDRESS_MODE_WRAP, // Repeat
D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // ClampToEdge D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // ClampToEdge
D3D12_TEXTURE_ADDRESS_MODE_BORDER, // ClampToBorder D3D12_TEXTURE_ADDRESS_MODE_BORDER, // ClampToBorder
D3D12_TEXTURE_ADDRESS_MODE_MIRROR, // MirrorRepeat
}}; }};
static constexpr u8 filter_count = static_cast<u8>(GPUSampler::Filter::MaxCount); static constexpr u8 filter_count = static_cast<u8>(GPUSampler::Filter::MaxCount);

View file

@ -69,6 +69,7 @@ public:
Repeat, Repeat,
ClampToEdge, ClampToEdge,
ClampToBorder, ClampToBorder,
MirrorRepeat,
MaxCount MaxCount
}; };

View file

@ -1231,6 +1231,7 @@ std::unique_ptr<GPUSampler> MetalDevice::CreateSampler(const GPUSampler::Config&
MTLSamplerAddressModeRepeat, // Repeat MTLSamplerAddressModeRepeat, // Repeat
MTLSamplerAddressModeClampToEdge, // ClampToEdge MTLSamplerAddressModeClampToEdge, // ClampToEdge
MTLSamplerAddressModeClampToBorderColor, // ClampToBorder MTLSamplerAddressModeClampToBorderColor, // ClampToBorder
MTLSamplerAddressModeMirrorRepeat, // MirrorRepeat
}}; }};
static constexpr std::array<MTLSamplerMinMagFilter, static_cast<u8>(GPUSampler::Filter::MaxCount)> min_mag_filters = static constexpr std::array<MTLSamplerMinMagFilter, static_cast<u8>(GPUSampler::Filter::MaxCount)> min_mag_filters =
{{ {{

View file

@ -363,6 +363,7 @@ std::unique_ptr<GPUSampler> OpenGLDevice::CreateSampler(const GPUSampler::Config
GL_REPEAT, // Repeat GL_REPEAT, // Repeat
GL_CLAMP_TO_EDGE, // ClampToEdge GL_CLAMP_TO_EDGE, // ClampToEdge
GL_CLAMP_TO_BORDER, // ClampToBorder GL_CLAMP_TO_BORDER, // ClampToBorder
GL_MIRRORED_REPEAT, // MirrorRepeat
}}; }};
// [mipmap_on_off][mipmap][filter] // [mipmap_on_off][mipmap][filter]

View file

@ -182,7 +182,7 @@ static GPUSampler::Config MapSampler(const reshadefx::sampler_info& si)
case reshadefx::texture_address_mode::wrap: case reshadefx::texture_address_mode::wrap:
return GPUSampler::AddressMode::Repeat; return GPUSampler::AddressMode::Repeat;
case reshadefx::texture_address_mode::mirror: case reshadefx::texture_address_mode::mirror:
Panic("Not implemented"); return GPUSampler::AddressMode::MirrorRepeat;
case reshadefx::texture_address_mode::clamp: case reshadefx::texture_address_mode::clamp:
return GPUSampler::AddressMode::ClampToEdge; return GPUSampler::AddressMode::ClampToEdge;
case reshadefx::texture_address_mode::border: case reshadefx::texture_address_mode::border:

View file

@ -870,6 +870,7 @@ VkSampler VulkanDevice::GetSampler(const GPUSampler::Config& config)
VK_SAMPLER_ADDRESS_MODE_REPEAT, // Repeat VK_SAMPLER_ADDRESS_MODE_REPEAT, // Repeat
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // ClampToEdge VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // ClampToEdge
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, // ClampToBorder VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, // ClampToBorder
VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT, // MirrorRepeat
}}; }};
static constexpr std::array<VkFilter, static_cast<u8>(GPUSampler::Filter::MaxCount)> min_mag_filters = {{ static constexpr std::array<VkFilter, static_cast<u8>(GPUSampler::Filter::MaxCount)> min_mag_filters = {{
VK_FILTER_NEAREST, // Nearest VK_FILTER_NEAREST, // Nearest