Skip to content
Snippets Groups Projects
Commit 28a0a425 authored by Artur Wasmut's avatar Artur Wasmut
Browse files

[#105] WIP: add descriptor indexing feature to glsl

parent 35f774ed
No related branches found
No related tags found
1 merge request!88Resolve "Indirect Draw"
Pipeline #26675 passed
#version 450 #version 450
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_nonuniform_qualifier : enable
layout(location = 0) in vec3 passNormal; layout(location = 0) in vec3 passNormal;
layout(location = 1) in vec2 passUV; layout(location = 1) in vec2 passUV;
layout(location = 0) out vec3 outColor; layout(location = 0) out vec3 outColor;
layout(set=0, binding=0) uniform texture2D meshTexture; layout(set=0, binding=0) uniform texture2D materialTextures[];
layout(set=0, binding=1) uniform sampler textureSampler; layout(set=0, binding=1) uniform sampler textureSampler;
void main() { void main() {
outColor = texture(sampler2D(meshTexture, textureSampler), passUV).rgb; outColor = texture(sampler2D(materialTextures[1], textureSampler), passUV).rgb;
} }
\ No newline at end of file
...@@ -25,7 +25,7 @@ int main(int argc, const char** argv) { ...@@ -25,7 +25,7 @@ int main(int argc, const char** argv) {
VK_MAKE_VERSION(0, 0, 1), VK_MAKE_VERSION(0, 0, 1),
{ vk::QueueFlagBits::eGraphics ,vk::QueueFlagBits::eCompute , vk::QueueFlagBits::eTransfer }, { vk::QueueFlagBits::eGraphics ,vk::QueueFlagBits::eCompute , vk::QueueFlagBits::eTransfer },
{}, {},
{ "VK_KHR_swapchain" } { "VK_KHR_swapchain", VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME }
); );
vkcv::asset::Scene mesh; vkcv::asset::Scene mesh;
...@@ -106,8 +106,7 @@ int main(int argc, const char** argv) { ...@@ -106,8 +106,7 @@ int main(int argc, const char** argv) {
const vkcv::VertexLayout firstMeshLayout (bindings); const vkcv::VertexLayout firstMeshLayout (bindings);
uint32_t setID = 0; std::vector<vkcv::DescriptorBinding> descriptorBindings = { firstMeshProgram.getReflectedDescriptors()[0] };
std::vector<vkcv::DescriptorBinding> descriptorBindings = { firstMeshProgram.getReflectedDescriptors()[setID] };
vkcv::DescriptorSetHandle descriptorSet = core.createDescriptorSet(descriptorBindings); vkcv::DescriptorSetHandle descriptorSet = core.createDescriptorSet(descriptorBindings);
const vkcv::PipelineConfig firstMeshPipelineConfig { const vkcv::PipelineConfig firstMeshPipelineConfig {
......
...@@ -294,6 +294,7 @@ namespace vkcv ...@@ -294,6 +294,7 @@ namespace vkcv
deviceFeatures2.features.shaderInt16 = true; deviceFeatures2.features.shaderInt16 = true;
// TODO: proper feature management // TODO: proper feature management
// TODO: check whether these features are ACTUALLY SUPPORTED
// -------------- HARD CODED LIST OF DEVICE FEATURES THAT ARE CHECKED AGAINST AND IF USED, ENABLED ------------ // -------------- HARD CODED LIST OF DEVICE FEATURES THAT ARE CHECKED AGAINST AND IF USED, ENABLED ------------
const bool usingMeshShaders = checkSupport(deviceExtensions, { VK_NV_MESH_SHADER_EXTENSION_NAME }); const bool usingMeshShaders = checkSupport(deviceExtensions, { VK_NV_MESH_SHADER_EXTENSION_NAME });
...@@ -317,7 +318,17 @@ namespace vkcv ...@@ -317,7 +318,17 @@ namespace vkcv
device16BitStorageFeatures.storageBuffer16BitAccess = true; device16BitStorageFeatures.storageBuffer16BitAccess = true;
deviceShaderFloat16Int8Features.setPNext(&device16BitStorageFeatures); deviceShaderFloat16Int8Features.setPNext(&device16BitStorageFeatures);
} }
const bool descriptorIndexing = checkSupport(deviceExtensions, { VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME });
vk::PhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures;
if (descriptorIndexing) {
// NOTE: what about
// shaderSampledImageArrayNonUniformIndexing ?
descriptorIndexingFeatures.descriptorBindingPartiallyBound = true;
descriptorIndexingFeatures.runtimeDescriptorArray = true;
deviceFeatures2.setPNext(&descriptorIndexingFeatures);
}
deviceCreateInfo.setPNext(&deviceFeatures2); deviceCreateInfo.setPNext(&deviceFeatures2);
// Ablauf // Ablauf
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment