mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- fixed texture sampler generation in the Vulkan backend.
This commit is contained in:
parent
d643a42c4f
commit
5ab648b055
2 changed files with 37 additions and 8 deletions
|
@ -60,9 +60,6 @@ VkTexClamp TexClamp[] ={
|
|||
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_REPEAT },
|
||||
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
||||
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
||||
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
||||
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT },
|
||||
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT }
|
||||
};
|
||||
|
||||
VkSamplerManager::VkSamplerManager(VulkanDevice *dev)
|
||||
|
@ -86,14 +83,14 @@ void VkSamplerManager::Create()
|
|||
{
|
||||
int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()? 0 : gl_texture_filter;
|
||||
|
||||
for(int i = 0; i < 7; i++)
|
||||
for (int i = CLAMP_NONE; i <= CLAMP_XY; i++)
|
||||
{
|
||||
SamplerBuilder builder;
|
||||
builder.setMagFilter(TexFilter[filter].magFilter);
|
||||
builder.setMinFilter(TexFilter[filter].minFilter);
|
||||
builder.setAddressMode(TexClamp[i].clamp_u, TexClamp[i].clamp_v, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||
builder.setMipmapMode(TexFilter[filter].mipfilter);
|
||||
if (i <= CLAMP_XY && TexFilter[filter].mipmapping)
|
||||
if (TexFilter[filter].mipmapping)
|
||||
{
|
||||
builder.setAnisotropy(gl_texture_filter_anisotropic);
|
||||
builder.setMaxLod(100.0f); // According to the spec this value is clamped so something high makes it usable for all textures.
|
||||
|
@ -104,11 +101,43 @@ void VkSamplerManager::Create()
|
|||
}
|
||||
mSamplers[i] = builder.create(vDevice);
|
||||
mSamplers[i]->SetDebugName("VkSamplerManager.mSamplers");
|
||||
}
|
||||
}
|
||||
{
|
||||
SamplerBuilder builder;
|
||||
builder.setMagFilter(TexFilter[filter].magFilter);
|
||||
builder.setMinFilter(TexFilter[filter].magFilter);
|
||||
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||
builder.setMaxLod(0.25f);
|
||||
mSamplers[CLAMP_XY_NOMIP] = builder.create(vDevice);
|
||||
mSamplers[CLAMP_XY_NOMIP]->SetDebugName("VkSamplerManager.mSamplers");
|
||||
}
|
||||
for (int i = CLAMP_NOFILTER; i <= CLAMP_NOFILTER_XY; i++)
|
||||
{
|
||||
SamplerBuilder builder;
|
||||
builder.setMagFilter(VK_FILTER_NEAREST);
|
||||
builder.setMinFilter(VK_FILTER_NEAREST);
|
||||
builder.setAddressMode(TexClamp[i - CLAMP_NOFILTER].clamp_u, TexClamp[i - CLAMP_NOFILTER].clamp_v, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||
builder.setMaxLod(0.25f);
|
||||
mSamplers[i] = builder.create(vDevice);
|
||||
mSamplers[i]->SetDebugName("VkSamplerManager.mSamplers");
|
||||
}
|
||||
// CAMTEX is repeating with texture filter and no mipmap
|
||||
{
|
||||
SamplerBuilder builder;
|
||||
builder.setMagFilter(TexFilter[filter].magFilter);
|
||||
builder.setMinFilter(TexFilter[filter].magFilter);
|
||||
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||
builder.setMaxLod(0.25f);
|
||||
mSamplers[CLAMP_CAMTEX] = builder.create(vDevice);
|
||||
mSamplers[CLAMP_CAMTEX]->SetDebugName("VkSamplerManager.mSamplers");
|
||||
}
|
||||
}
|
||||
|
||||
void VkSamplerManager::Destroy()
|
||||
{
|
||||
for (int i = 0; i < 7; i++)
|
||||
for (int i = 0; i < NUMSAMPLERS; i++)
|
||||
mSamplers[i].reset();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class VulkanDevice;
|
|||
class VkSamplerManager
|
||||
{
|
||||
VulkanDevice *vDevice;
|
||||
std::unique_ptr<VulkanSampler> mSamplers[7];
|
||||
std::unique_ptr<VulkanSampler> mSamplers[NUMSAMPLERS];
|
||||
|
||||
//void UnbindAll();
|
||||
|
||||
|
|
Loading…
Reference in a new issue