Use a new sampler for 2d rendering
This commit is contained in:
parent
26bd8a5b8b
commit
1b92e99cfe
@ -26,6 +26,7 @@ namespace GE
|
|||||||
{
|
{
|
||||||
GVS_MIN = 0,
|
GVS_MIN = 0,
|
||||||
GVS_NEAREST = GVS_MIN,
|
GVS_NEAREST = GVS_MIN,
|
||||||
|
GVS_2D_RENDER,
|
||||||
GVS_COUNT,
|
GVS_COUNT,
|
||||||
};
|
};
|
||||||
class GEVulkanDriver : public video::CNullDriver
|
class GEVulkanDriver : public video::CNullDriver
|
||||||
|
@ -387,7 +387,7 @@ void GEVulkan2dRenderer::render()
|
|||||||
VkDescriptorImageInfo image_info;
|
VkDescriptorImageInfo image_info;
|
||||||
image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
image_info.imageView = (VkImageView)tex.first->getTextureHandler();
|
image_info.imageView = (VkImageView)tex.first->getTextureHandler();
|
||||||
image_info.sampler = g_vk->getSampler(GVS_NEAREST);
|
image_info.sampler = g_vk->getSampler(GVS_2D_RENDER);
|
||||||
image_infos.push_back(image_info);
|
image_infos.push_back(image_info);
|
||||||
if (image_infos.size() >= GEVulkanShaderManager::getSamplerSize())
|
if (image_infos.size() >= GEVulkanShaderManager::getSamplerSize())
|
||||||
break;
|
break;
|
||||||
|
@ -1218,6 +1218,7 @@ void GEVulkanDriver::createSamplers()
|
|||||||
sampler_info.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
sampler_info.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||||
sampler_info.magFilter = VK_FILTER_NEAREST;
|
sampler_info.magFilter = VK_FILTER_NEAREST;
|
||||||
sampler_info.minFilter = VK_FILTER_NEAREST;
|
sampler_info.minFilter = VK_FILTER_NEAREST;
|
||||||
|
sampler_info.maxLod = VK_LOD_CLAMP_NONE;
|
||||||
sampler_info.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
sampler_info.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||||
sampler_info.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
sampler_info.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||||
sampler_info.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
sampler_info.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||||
@ -1234,6 +1235,18 @@ void GEVulkanDriver::createSamplers()
|
|||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
throw std::runtime_error("vkCreateSampler failed for GVS_NEAREST");
|
throw std::runtime_error("vkCreateSampler failed for GVS_NEAREST");
|
||||||
m_vk->samplers[GVS_NEAREST] = sampler;
|
m_vk->samplers[GVS_NEAREST] = sampler;
|
||||||
|
|
||||||
|
// GVS_2D_RENDER
|
||||||
|
sampler_info.magFilter = VK_FILTER_LINEAR;
|
||||||
|
sampler_info.minFilter = VK_FILTER_LINEAR;
|
||||||
|
// Avoid artifacts when resizing down the screen
|
||||||
|
sampler_info.maxLod = 0.25f;
|
||||||
|
result = vkCreateSampler(m_vk->device, &sampler_info, NULL,
|
||||||
|
&sampler);
|
||||||
|
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
throw std::runtime_error("vkCreateSampler failed for GVS_2D_RENDER");
|
||||||
|
m_vk->samplers[GVS_2D_RENDER] = sampler;
|
||||||
} // createSamplers
|
} // createSamplers
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user