1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxvk] Do not require GL_EXT_samplerless_texture_functions

Ubuntu ships a version of the GLSL compiler that does not support
this extension yet, so building DXVK fails on those systems.
Closes #760.
This commit is contained in:
Philip Rebohle 2018-11-11 15:48:07 +01:00
parent a971370524
commit 6f28ce5809
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 46 additions and 14 deletions

View File

@ -7,6 +7,7 @@ namespace dxvk {
DxvkMetaPackObjects::DxvkMetaPackObjects(const Rc<vk::DeviceFn>& vkd)
: m_vkd (vkd),
m_sampler (createSampler()),
m_dsetLayout (createDescriptorSetLayout()),
m_pipeLayout (createPipelineLayout()),
m_template (createDescriptorUpdateTemplate()),
@ -28,6 +29,9 @@ namespace dxvk {
m_vkd->vkDestroyDescriptorSetLayout(
m_vkd->device(), m_dsetLayout, nullptr);
m_vkd->vkDestroySampler(
m_vkd->device(), m_sampler, nullptr);
}
@ -48,11 +52,39 @@ namespace dxvk {
}
VkSampler DxvkMetaPackObjects::createSampler() {
VkSamplerCreateInfo info;
info.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
info.pNext = nullptr;
info.flags = 0;
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.mipLodBias = 0.0f;
info.anisotropyEnable = VK_FALSE;
info.maxAnisotropy = 1.0f;
info.compareEnable = VK_FALSE;
info.compareOp = VK_COMPARE_OP_ALWAYS;
info.minLod = 0.0f;
info.maxLod = 0.0f;
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::createDescriptorSetLayout() {
std::array<VkDescriptorSetLayoutBinding, 3> bindings = {{
{ 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 },
{ 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 },
}};
VkDescriptorSetLayoutCreateInfo dsetInfo;
@ -93,9 +125,9 @@ namespace dxvk {
VkDescriptorUpdateTemplateKHR DxvkMetaPackObjects::createDescriptorUpdateTemplate() {
std::array<VkDescriptorUpdateTemplateEntryKHR, 3> bindings = {{
{ 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 },
{ 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 },
}};
VkDescriptorUpdateTemplateCreateInfoKHR templateInfo;

View File

@ -69,6 +69,8 @@ namespace dxvk {
Rc<vk::DeviceFn> m_vkd;
VkSampler m_sampler;
VkDescriptorSetLayout m_dsetLayout;
VkPipelineLayout m_pipeLayout;
@ -80,6 +82,8 @@ namespace dxvk {
VkPipeline m_pipeD24S8;
VkPipeline m_pipeD32S8;
VkSampler createSampler();
VkDescriptorSetLayout createDescriptorSetLayout();
VkPipelineLayout createPipelineLayout();

View File

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

View File

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