1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxvk] Get rid of sampler for pack operations

This commit is contained in:
Philip Rebohle 2022-09-12 14:20:30 +02:00
parent 8dc9400045
commit 8842af2ad6
4 changed files with 14 additions and 35 deletions

View File

@ -12,7 +12,6 @@ namespace dxvk {
DxvkMetaPackObjects::DxvkMetaPackObjects(const DxvkDevice* device)
: m_vkd (device->vkd()),
m_sampler (createSampler()),
m_dsetLayoutPack (createPackDescriptorSetLayout()),
m_dsetLayoutUnpack(createUnpackDescriptorSetLayout()),
m_pipeLayoutPack (createPipelineLayout(m_dsetLayoutPack, sizeof(DxvkMetaPackArgs))),
@ -44,8 +43,6 @@ namespace dxvk {
m_vkd->vkDestroyDescriptorSetLayout(m_vkd->device(), m_dsetLayoutPack, nullptr);
m_vkd->vkDestroyDescriptorSetLayout(m_vkd->device(), m_dsetLayoutUnpack, nullptr);
m_vkd->vkDestroySampler(m_vkd->device(), m_sampler, nullptr);
}
@ -91,29 +88,11 @@ namespace dxvk {
}
VkSampler DxvkMetaPackObjects::createSampler() {
VkSamplerCreateInfo info = { VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO };
info.magFilter = VK_FILTER_NEAREST;
info.minFilter = VK_FILTER_NEAREST;
info.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST;
info.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
info.unnormalizedCoordinates = VK_FALSE;
VkSampler result = VK_NULL_HANDLE;
if (m_vkd->vkCreateSampler(m_vkd->device(), &info, nullptr, &result) != VK_SUCCESS)
throw DxvkError("DxvkMetaPackObjects: Failed to create sampler");
return result;
}
VkDescriptorSetLayout DxvkMetaPackObjects::createPackDescriptorSetLayout() {
std::array<VkDescriptorSetLayoutBinding, 3> bindings = {{
{ 0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr },
{ 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, &m_sampler },
{ 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, &m_sampler },
{ 0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr },
{ 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr },
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr },
}};
VkDescriptorSetLayoutCreateInfo dsetInfo = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO };
@ -165,9 +144,9 @@ namespace dxvk {
VkDescriptorUpdateTemplate DxvkMetaPackObjects::createPackDescriptorUpdateTemplate() {
std::array<VkDescriptorUpdateTemplateEntry, 3> bindings = {{
{ 0, 0, 1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, offsetof(DxvkMetaPackDescriptors, dstBuffer), 0 },
{ 1, 0, 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, offsetof(DxvkMetaPackDescriptors, srcDepth), 0 },
{ 2, 0, 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, offsetof(DxvkMetaPackDescriptors, srcStencil), 0 },
{ 0, 0, 1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, offsetof(DxvkMetaPackDescriptors, dstBuffer), 0 },
{ 1, 0, 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, offsetof(DxvkMetaPackDescriptors, srcDepth), 0 },
{ 2, 0, 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, offsetof(DxvkMetaPackDescriptors, srcStencil), 0 },
}};
VkDescriptorUpdateTemplateCreateInfo templateInfo = { VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO };

View File

@ -92,8 +92,6 @@ namespace dxvk {
Rc<vk::DeviceFn> m_vkd;
VkSampler m_sampler;
VkDescriptorSetLayout m_dsetLayoutPack;
VkDescriptorSetLayout m_dsetLayoutUnpack;
@ -110,8 +108,6 @@ namespace dxvk {
VkPipeline m_pipeUnpackD24S8;
VkPipeline m_pipeUnpackD32S8;
VkSampler createSampler();
VkDescriptorSetLayout createPackDescriptorSetLayout();
VkDescriptorSetLayout createUnpackDescriptorSetLayout();

View File

@ -1,5 +1,7 @@
#version 450
#extension GL_EXT_samplerless_texture_functions : require
layout(
local_size_x = 8,
local_size_y = 8,
@ -10,8 +12,8 @@ writeonly buffer s_buffer_t {
uint data[];
} s_buffer;
layout(binding = 1) uniform sampler2DArray u_depth;
layout(binding = 2) uniform usampler2DArray u_stencil;
layout(binding = 1) uniform texture2DArray u_depth;
layout(binding = 2) uniform utexture2DArray u_stencil;
layout(push_constant)
uniform u_info_t {

View File

@ -1,5 +1,7 @@
#version 450
#extension GL_EXT_samplerless_texture_functions : require
layout(
local_size_x = 8,
local_size_y = 8,
@ -15,8 +17,8 @@ writeonly buffer s_buffer_t {
d32s8_t data[];
} s_buffer;
layout(binding = 1) uniform sampler2DArray u_depth;
layout(binding = 2) uniform usampler2DArray u_stencil;
layout(binding = 1) uniform texture2DArray u_depth;
layout(binding = 2) uniform utexture2DArray u_stencil;
layout(push_constant)
uniform u_info_t {