Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 119-graphicspipeline-refactoring
  • 129-projekte-und-assets-auslagern
  • 132-denoising-module
  • 143-ar-vr-support-via-openxr
  • 43-multi-threading
  • 91-compute-first-network
  • 95-arm64-raspberry-pi-4-support
  • develop
  • master
  • optimizations
  • 0.1.0
  • 0.2.0
12 results

Target

Select target project
  • vulkan2021/vkcv-framework
1 result
Select Git revision
  • 119-graphicspipeline-refactoring
  • 129-projekte-und-assets-auslagern
  • 132-denoising-module
  • 143-ar-vr-support-via-openxr
  • 43-multi-threading
  • 91-compute-first-network
  • 95-arm64-raspberry-pi-4-support
  • develop
  • master
  • optimizations
  • 0.1.0
  • 0.2.0
12 results
Show changes
Commits on Source (7)
Showing
with 290 additions and 256 deletions
...@@ -71,9 +71,6 @@ set(vkcv_sources ...@@ -71,9 +71,6 @@ set(vkcv_sources
${vkcv_include}/vkcv/QueueManager.hpp ${vkcv_include}/vkcv/QueueManager.hpp
${vkcv_source}/vkcv/QueueManager.cpp ${vkcv_source}/vkcv/QueueManager.cpp
${vkcv_include}/vkcv/VertexLayout.hpp
${vkcv_source}/vkcv/VertexLayout.cpp
${vkcv_include}/vkcv/Event.hpp ${vkcv_include}/vkcv/Event.hpp
${vkcv_source}/vkcv/DescriptorManager.hpp ${vkcv_source}/vkcv/DescriptorManager.hpp
......
...@@ -14,14 +14,6 @@ ...@@ -14,14 +14,6 @@
#include "Buffer.hpp" #include "Buffer.hpp"
namespace vkcv { namespace vkcv {
/**
* @brief Structure to store details about a vertex buffer binding.
*/
struct VertexBufferBinding {
vk::DeviceSize offset;
vk::Buffer buffer;
};
/** /**
* @brief Enum class to specify the size of indexes. * @brief Enum class to specify the size of indexes.
...@@ -53,16 +45,13 @@ namespace vkcv { ...@@ -53,16 +45,13 @@ namespace vkcv {
struct Mesh { struct Mesh {
inline Mesh() {} inline Mesh() {}
inline Mesh(std::vector<VertexBufferBinding> vertexBufferBindings, inline Mesh(vk::Buffer indexBuffer,
vk::Buffer indexBuffer,
size_t indexCount, size_t indexCount,
IndexBitCount indexBitCount = IndexBitCount::Bit16) noexcept : IndexBitCount indexBitCount = IndexBitCount::Bit16) noexcept :
vertexBufferBindings(vertexBufferBindings),
indexBuffer(indexBuffer), indexBuffer(indexBuffer),
indexCount(indexCount), indexCount(indexCount),
indexBitCount(indexBitCount) {} indexBitCount(indexBitCount) {}
std::vector<VertexBufferBinding> vertexBufferBindings;
vk::Buffer indexBuffer; vk::Buffer indexBuffer;
size_t indexCount; size_t indexCount;
IndexBitCount indexBitCount; IndexBitCount indexBitCount;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "Handles.hpp" #include "Handles.hpp"
#include "ShaderProgram.hpp" #include "ShaderProgram.hpp"
#include "VertexLayout.hpp"
#include "ImageConfig.hpp" #include "ImageConfig.hpp"
namespace vkcv { namespace vkcv {
...@@ -65,7 +64,6 @@ namespace vkcv { ...@@ -65,7 +64,6 @@ namespace vkcv {
uint32_t m_Width; uint32_t m_Width;
uint32_t m_Height; uint32_t m_Height;
PassHandle m_PassHandle; PassHandle m_PassHandle;
VertexLayout m_VertexLayout;
std::vector<DescriptorSetLayoutHandle> m_DescriptorLayouts; std::vector<DescriptorSetLayoutHandle> m_DescriptorLayouts;
bool m_UseDynamicViewport; bool m_UseDynamicViewport;
bool m_UseConservativeRasterization = false; bool m_UseConservativeRasterization = false;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <vulkan/vulkan.hpp> #include <vulkan/vulkan.hpp>
#include <spirv_cross.hpp> #include <spirv_cross.hpp>
#include "VertexLayout.hpp"
#include "DescriptorConfig.hpp" #include "DescriptorConfig.hpp"
#include "ShaderStage.hpp" #include "ShaderStage.hpp"
...@@ -61,14 +60,6 @@ namespace vkcv { ...@@ -61,14 +60,6 @@ namespace vkcv {
* @return True, if a shader exists for the stage, else false * @return True, if a shader exists for the stage, else false
*/ */
bool existsShader(ShaderStage stage) const; bool existsShader(ShaderStage stage) const;
/**
* @brief Returns the vertex attachments for the program and its
* shader stages.
*
* @return Vertex attachments
*/
const std::vector<VertexAttachment> &getVertexAttachments() const;
/** /**
* @brief Returns the size of the programs push constants. * @brief Returns the size of the programs push constants.
...@@ -95,9 +86,7 @@ namespace vkcv { ...@@ -95,9 +86,7 @@ namespace vkcv {
void reflectShader(ShaderStage shaderStage); void reflectShader(ShaderStage shaderStage);
std::unordered_map<ShaderStage, std::vector<uint32_t> > m_Shaders; std::unordered_map<ShaderStage, std::vector<uint32_t> > m_Shaders;
// contains all vertex input attachments used in the vertex buffer
VertexAttachments m_VertexAttachments;
std::unordered_map<uint32_t, DescriptorBindings> m_DescriptorSets; std::unordered_map<uint32_t, DescriptorBindings> m_DescriptorSets;
size_t m_pushConstantsSize = 0; size_t m_pushConstantsSize = 0;
......
#pragma once
/**
* @authors Alexander Gauggel, Artur Wasmut, Mara Vogt, Susanne Dötsch,
* Trevor Hollmann, Leonie Franken, Simeon Hermann, Tobias Frisch
* @file vkcv/VertexLayout.hpp
* @brief Structures to handle vertex layout, bindings and attachments.
*/
#include <vector>
#include <iostream>
#include <string>
namespace vkcv {
/**
* @brief Enum class to specify the format of vertex attributes.
*/
enum class VertexAttachmentFormat {
FLOAT,
FLOAT2,
FLOAT3,
FLOAT4,
INT,
INT2,
INT3,
INT4
};
/**
* @brief Returns the size in bytes of a vertex with a
* given vertex format.
*
* @param[in] format Vertex format
* @return Size in bytes
*/
uint32_t getFormatSize(VertexAttachmentFormat format);
/**
* @brief Structure to store the details of a vertex input attachment.
*
* Describes an individual vertex input attribute/attachment. The offset
* is calculated when a collection of attachments forms a binding.
*/
struct VertexAttachment {
uint32_t inputLocation;
std::string name;
VertexAttachmentFormat format;
uint32_t offset;
};
typedef std::vector<VertexAttachment> VertexAttachments;
/**
* @brief Structure to store the details of a vertex buffer binding.
*
* Describes all vertex input attachments _one_ buffer contains to create
* a vertex buffer binding. NOTE: multiple vertex layouts may contain
* various (mutually exclusive) vertex input attachments to form one
* complete vertex buffer binding!
*/
struct VertexBinding {
uint32_t bindingLocation;
uint32_t stride;
VertexAttachments vertexAttachments;
};
/**
* Creates a vertex binding with given parameters and calculates its strides
* depending on its attachments.
*
* @param[in] bindingLocation Its entry in the buffers that make up the whole vertex buffer.
* @param[in] attachments The vertex input attachments this specific buffer layout contains.
* @return Vertex buffer binding with calculated stride
*/
VertexBinding createVertexBinding(uint32_t bindingLocation, const VertexAttachments &attachments);
typedef std::vector<VertexBinding> VertexBindings;
/**
* @brief Structure to store the details of a vertex layout.
*
* Describes the complete layout of one vertex, e.g. all of the vertex input
* attachments used, and all of the buffer bindings that refer to the attachments
* (for when multiple buffers are used).
*/
struct VertexLayout {
VertexBindings vertexBindings;
};
}
...@@ -146,7 +146,7 @@ namespace vkcv::algorithm { ...@@ -146,7 +146,7 @@ namespace vkcv::algorithm {
vkcv::Downsampler(core), vkcv::Downsampler(core),
m_pipeline(), m_pipeline(),
m_descriptorSetLayout(m_core.createDescriptorSetLayout(getDescriptorBindings(sampler))), m_descriptorSetLayout(),
m_descriptorSets(), m_descriptorSets(),
m_globalCounter(m_core.createBuffer<uint32_t>( m_globalCounter(m_core.createBuffer<uint32_t>(
...@@ -155,6 +155,21 @@ namespace vkcv::algorithm { ...@@ -155,6 +155,21 @@ namespace vkcv::algorithm {
)), )),
m_sampler(sampler) { m_sampler(sampler) {
const auto& featureManager = m_core.getContext().getFeatureManager();
const bool partialBound = featureManager.checkFeatures<vk::PhysicalDeviceDescriptorIndexingFeatures>(
vk::StructureType::ePhysicalDeviceDescriptorIndexingFeatures,
[](const vk::PhysicalDeviceDescriptorIndexingFeatures& features) {
return features.descriptorBindingPartiallyBound;
}
);
if (!partialBound) {
return;
}
m_descriptorSetLayout = m_core.createDescriptorSetLayout(getDescriptorBindings(sampler));
vkcv::shader::GLSLCompiler compiler (vkcv::shader::GLSLCompileTarget::SUBGROUP_OP); vkcv::shader::GLSLCompiler compiler (vkcv::shader::GLSLCompileTarget::SUBGROUP_OP);
vk::PhysicalDeviceSubgroupProperties subgroupProperties; vk::PhysicalDeviceSubgroupProperties subgroupProperties;
...@@ -169,8 +184,6 @@ namespace vkcv::algorithm { ...@@ -169,8 +184,6 @@ namespace vkcv::algorithm {
compiler.setDefine("SPD_NO_WAVE_OPERATIONS", "1"); compiler.setDefine("SPD_NO_WAVE_OPERATIONS", "1");
} }
const auto& featureManager = m_core.getContext().getFeatureManager();
const bool float16Support = ( const bool float16Support = (
featureManager.checkFeatures<vk::PhysicalDeviceFloat16Int8FeaturesKHR>( featureManager.checkFeatures<vk::PhysicalDeviceFloat16Int8FeaturesKHR>(
vk::StructureType::ePhysicalDeviceShaderFloat16Int8FeaturesKHR, vk::StructureType::ePhysicalDeviceShaderFloat16Int8FeaturesKHR,
...@@ -229,13 +242,20 @@ namespace vkcv::algorithm { ...@@ -229,13 +242,20 @@ namespace vkcv::algorithm {
void SinglePassDownsampler::recordDownsampling(const CommandStreamHandle &cmdStream, void SinglePassDownsampler::recordDownsampling(const CommandStreamHandle &cmdStream,
const ImageHandle &image) { const ImageHandle &image) {
Downsampler& fallback = m_core.getDownsampler();
if (m_pipeline) {
fallback.recordDownsampling(cmdStream, image);
return;
}
const uint32_t mipLevels = m_core.getImageMipLevels(image); const uint32_t mipLevels = m_core.getImageMipLevels(image);
const uint32_t depth = m_core.getImageDepth(image); const uint32_t depth = m_core.getImageDepth(image);
m_core.prepareImageForSampling(cmdStream, image); m_core.prepareImageForSampling(cmdStream, image);
if ((mipLevels < 4) || (depth > 1) || (!m_core.isImageSupportingStorage(image))) { if ((mipLevels < 4) || (depth > 1) || (!m_core.isImageSupportingStorage(image))) {
m_core.getDownsampler().recordDownsampling(cmdStream, image); fallback.recordDownsampling(cmdStream, image);
return; return;
} }
......
...@@ -36,11 +36,6 @@ namespace vkcv::scene { ...@@ -36,11 +36,6 @@ namespace vkcv::scene {
*/ */
BufferHandle m_vertices; BufferHandle m_vertices;
/**
* The list of the used vertex buffer bindings.
*/
std::vector<VertexBufferBinding> m_vertexBindings;
/** /**
* The buffer handle of its index buffer. * The buffer handle of its index buffer.
*/ */
...@@ -50,6 +45,11 @@ namespace vkcv::scene { ...@@ -50,6 +45,11 @@ namespace vkcv::scene {
* The amount of indices in its index buffer. * The amount of indices in its index buffer.
*/ */
size_t m_indexCount; size_t m_indexCount;
/**
* The descriptor set handle of its vertex data.
*/
DescriptorSetHandle m_descriptorSet;
/** /**
* Axis aligned bounding box of the mesh part. * Axis aligned bounding box of the mesh part.
......
...@@ -54,6 +54,11 @@ namespace vkcv::scene { ...@@ -54,6 +54,11 @@ namespace vkcv::scene {
* A list of nodes in the first level of the scene graph. * A list of nodes in the first level of the scene graph.
*/ */
std::vector<Node> m_nodes; std::vector<Node> m_nodes;
/**
* A handle to the descriptor set layout used by meshes in this scene.
*/
DescriptorSetLayoutHandle m_descriptorSetLayout;
/** /**
* Constructor of a scene instance with a given Core instance. * Constructor of a scene instance with a given Core instance.
...@@ -152,6 +157,13 @@ namespace vkcv::scene { ...@@ -152,6 +157,13 @@ namespace vkcv::scene {
*/ */
[[nodiscard]] [[nodiscard]]
const material::Material& getMaterial(size_t index) const; const material::Material& getMaterial(size_t index) const;
/**
* Returns the descriptor set layout handle used by the meshes in the scene.
* @return Descriptor set layout handle
*/
[[nodiscard]]
const DescriptorSetLayoutHandle& getDescriptorSetLayout() const;
/** /**
* Record drawcalls of all meshes of this scene with CPU-side frustum culling. * Record drawcalls of all meshes of this scene with CPU-side frustum culling.
......
...@@ -4,12 +4,17 @@ ...@@ -4,12 +4,17 @@
namespace vkcv::scene { namespace vkcv::scene {
struct vertex_t {
float positionU [4];
float normalV [4];
};
MeshPart::MeshPart(Scene& scene) : MeshPart::MeshPart(Scene& scene) :
m_scene(scene), m_scene(scene),
m_vertices(), m_vertices(),
m_vertexBindings(),
m_indices(), m_indices(),
m_indexCount(0), m_indexCount(0),
m_descriptorSet(),
m_bounds(), m_bounds(),
m_materialIndex(std::numeric_limits<size_t>::max()) {} m_materialIndex(std::numeric_limits<size_t>::max()) {}
...@@ -18,23 +23,51 @@ namespace vkcv::scene { ...@@ -18,23 +23,51 @@ namespace vkcv::scene {
std::vector<DrawcallInfo>& drawcalls) { std::vector<DrawcallInfo>& drawcalls) {
Core& core = *(m_scene.m_core); Core& core = *(m_scene.m_core);
auto vertexBuffer = core.createBuffer<uint8_t>( auto vertexBuffer = core.createBuffer<vertex_t>(
BufferType::VERTEX, vertexGroup.vertexBuffer.data.size() BufferType::STORAGE, vertexGroup.numVertices
); );
vertexBuffer.fill(vertexGroup.vertexBuffer.data); std::vector<vertex_t> vertices;
m_vertices = vertexBuffer.getHandle(); vertices.reserve(vertexBuffer.getCount());
auto attributes = vertexGroup.vertexBuffer.attributes;
std::sort(attributes.begin(), attributes.end(), [](const vkcv::asset::VertexAttribute& x, const vkcv::asset::VertexAttribute& y) {
return static_cast<uint32_t>(x.type) < static_cast<uint32_t>(y.type);
});
for (const auto& attribute : attributes) { for (const auto& attribute : vertexGroup.vertexBuffer.attributes) {
m_vertexBindings.emplace_back(attribute.offset, vertexBuffer.getVulkanHandle()); if (attribute.componentType != vkcv::asset::ComponentType::FLOAT32) {
continue;
}
size_t offset = attribute.offset;
for (size_t i = 0; i < vertexBuffer.getCount(); i++) {
const auto *data = reinterpret_cast<const float*>(
vertexGroup.vertexBuffer.data.data() + offset
);
switch (attribute.type) {
case vkcv::asset::PrimitiveType::POSITION:
memcpy(vertices[i].positionU, data, sizeof(float) * attribute.componentCount);
break;
case vkcv::asset::PrimitiveType::NORMAL:
memcpy(vertices[i].normalV, data, sizeof(float) * attribute.componentCount);
break;
case vkcv::asset::PrimitiveType::TEXCOORD_0:
if (attribute.componentCount != 2) {
break;
}
vertices[i].positionU[3] = data[0];
vertices[i].normalV[3] = data[1];
break;
default:
break;
}
offset += attribute.stride;
}
} }
vertexBuffer.fill(vertices);
m_vertices = vertexBuffer.getHandle();
auto indexBuffer = core.createBuffer<uint8_t>( auto indexBuffer = core.createBuffer<uint8_t>(
BufferType::INDEX, vertexGroup.indexBuffer.data.size() BufferType::INDEX, vertexGroup.indexBuffer.data.size()
); );
...@@ -43,6 +76,12 @@ namespace vkcv::scene { ...@@ -43,6 +76,12 @@ namespace vkcv::scene {
m_indices = indexBuffer.getHandle(); m_indices = indexBuffer.getHandle();
m_indexCount = vertexGroup.numIndices; m_indexCount = vertexGroup.numIndices;
m_descriptorSet = core.createDescriptorSet(m_scene.getDescriptorSetLayout());
DescriptorWrites writes;
writes.writeStorageBuffer(0, m_vertices);
core.writeDescriptorSet(m_descriptorSet, writes);
m_bounds.setMin(glm::vec3( m_bounds.setMin(glm::vec3(
vertexGroup.min.x, vertexGroup.min.x,
vertexGroup.min.y, vertexGroup.min.y,
...@@ -74,6 +113,9 @@ namespace vkcv::scene { ...@@ -74,6 +113,9 @@ namespace vkcv::scene {
IndexBitCount indexBitCount; IndexBitCount indexBitCount;
switch (vertexGroup.indexBuffer.type) { switch (vertexGroup.indexBuffer.type) {
case asset::IndexType::UINT8:
indexBitCount = IndexBitCount::Bit8;
break;
case asset::IndexType::UINT16: case asset::IndexType::UINT16:
indexBitCount = IndexBitCount::Bit16; indexBitCount = IndexBitCount::Bit16;
break; break;
...@@ -87,8 +129,11 @@ namespace vkcv::scene { ...@@ -87,8 +129,11 @@ namespace vkcv::scene {
} }
drawcalls.push_back(DrawcallInfo( drawcalls.push_back(DrawcallInfo(
vkcv::Mesh(m_vertexBindings, indexBuffer.getVulkanHandle(), m_indexCount, indexBitCount), vkcv::Mesh(indexBuffer.getVulkanHandle(), m_indexCount, indexBitCount),
{ DescriptorSetUsage(0, material.getDescriptorSet()) } {
DescriptorSetUsage(0, m_descriptorSet),
DescriptorSetUsage(1, material.getDescriptorSet())
}
)); ));
} }
} }
...@@ -100,9 +145,9 @@ namespace vkcv::scene { ...@@ -100,9 +145,9 @@ namespace vkcv::scene {
MeshPart::MeshPart(const MeshPart &other) : MeshPart::MeshPart(const MeshPart &other) :
m_scene(other.m_scene), m_scene(other.m_scene),
m_vertices(other.m_vertices), m_vertices(other.m_vertices),
m_vertexBindings(other.m_vertexBindings),
m_indices(other.m_indices), m_indices(other.m_indices),
m_indexCount(other.m_indexCount), m_indexCount(other.m_indexCount),
m_descriptorSet(other.m_descriptorSet),
m_bounds(other.m_bounds), m_bounds(other.m_bounds),
m_materialIndex(other.m_materialIndex) { m_materialIndex(other.m_materialIndex) {
m_scene.increaseMaterialUsage(m_materialIndex); m_scene.increaseMaterialUsage(m_materialIndex);
...@@ -111,9 +156,9 @@ namespace vkcv::scene { ...@@ -111,9 +156,9 @@ namespace vkcv::scene {
MeshPart::MeshPart(MeshPart &&other) noexcept : MeshPart::MeshPart(MeshPart &&other) noexcept :
m_scene(other.m_scene), m_scene(other.m_scene),
m_vertices(other.m_vertices), m_vertices(other.m_vertices),
m_vertexBindings(other.m_vertexBindings),
m_indices(other.m_indices), m_indices(other.m_indices),
m_indexCount(other.m_indexCount), m_indexCount(other.m_indexCount),
m_descriptorSet(other.m_descriptorSet),
m_bounds(other.m_bounds), m_bounds(other.m_bounds),
m_materialIndex(other.m_materialIndex) { m_materialIndex(other.m_materialIndex) {
m_scene.increaseMaterialUsage(m_materialIndex); m_scene.increaseMaterialUsage(m_materialIndex);
...@@ -125,9 +170,9 @@ namespace vkcv::scene { ...@@ -125,9 +170,9 @@ namespace vkcv::scene {
} }
m_vertices = other.m_vertices; m_vertices = other.m_vertices;
m_vertexBindings = other.m_vertexBindings;
m_indices = other.m_indices; m_indices = other.m_indices;
m_indexCount = other.m_indexCount; m_indexCount = other.m_indexCount;
m_descriptorSet = other.m_descriptorSet;
m_bounds = other.m_bounds; m_bounds = other.m_bounds;
m_materialIndex = other.m_materialIndex; m_materialIndex = other.m_materialIndex;
...@@ -136,9 +181,9 @@ namespace vkcv::scene { ...@@ -136,9 +181,9 @@ namespace vkcv::scene {
MeshPart &MeshPart::operator=(MeshPart &&other) noexcept { MeshPart &MeshPart::operator=(MeshPart &&other) noexcept {
m_vertices = other.m_vertices; m_vertices = other.m_vertices;
m_vertexBindings = other.m_vertexBindings;
m_indices = other.m_indices; m_indices = other.m_indices;
m_indexCount = other.m_indexCount; m_indexCount = other.m_indexCount;
m_descriptorSet = other.m_descriptorSet;
m_bounds = other.m_bounds; m_bounds = other.m_bounds;
m_materialIndex = other.m_materialIndex; m_materialIndex = other.m_materialIndex;
......
...@@ -8,10 +8,28 @@ ...@@ -8,10 +8,28 @@
namespace vkcv::scene { namespace vkcv::scene {
static DescriptorBindings getDescriptorBindings() {
DescriptorBindings bindings = {};
auto binding_0 = DescriptorBinding {
0,
DescriptorType::STORAGE_BUFFER,
1,
ShaderStage::VERTEX,
false,
false
};
bindings.insert(std::make_pair(0, binding_0));
return bindings;
}
Scene::Scene(Core* core) : Scene::Scene(Core* core) :
m_core(core), m_core(core),
m_materials(), m_materials(),
m_nodes() {} m_nodes(),
m_descriptorSetLayout(core->createDescriptorSetLayout(getDescriptorBindings())) {}
Scene::~Scene() { Scene::~Scene() {
m_nodes.clear(); m_nodes.clear();
...@@ -21,7 +39,8 @@ namespace vkcv::scene { ...@@ -21,7 +39,8 @@ namespace vkcv::scene {
Scene::Scene(const Scene &other) : Scene::Scene(const Scene &other) :
m_core(other.m_core), m_core(other.m_core),
m_materials(other.m_materials), m_materials(other.m_materials),
m_nodes() { m_nodes(),
m_descriptorSetLayout(other.m_descriptorSetLayout) {
m_nodes.resize(other.m_nodes.size(), Node(*this)); m_nodes.resize(other.m_nodes.size(), Node(*this));
for (size_t i = 0; i < m_nodes.size(); i++) { for (size_t i = 0; i < m_nodes.size(); i++) {
...@@ -32,7 +51,8 @@ namespace vkcv::scene { ...@@ -32,7 +51,8 @@ namespace vkcv::scene {
Scene::Scene(Scene &&other) noexcept : Scene::Scene(Scene &&other) noexcept :
m_core(other.m_core), m_core(other.m_core),
m_materials(other.m_materials), m_materials(other.m_materials),
m_nodes() { m_nodes(),
m_descriptorSetLayout(other.m_descriptorSetLayout) {
m_nodes.resize(other.m_nodes.size(), Node(*this)); m_nodes.resize(other.m_nodes.size(), Node(*this));
for (size_t i = 0; i < m_nodes.size(); i++) { for (size_t i = 0; i < m_nodes.size(); i++) {
...@@ -54,6 +74,8 @@ namespace vkcv::scene { ...@@ -54,6 +74,8 @@ namespace vkcv::scene {
m_nodes[i] = other.m_nodes[i]; m_nodes[i] = other.m_nodes[i];
} }
m_descriptorSetLayout = other.m_descriptorSetLayout;
return *this; return *this;
} }
...@@ -67,6 +89,8 @@ namespace vkcv::scene { ...@@ -67,6 +89,8 @@ namespace vkcv::scene {
m_nodes[i] = std::move(other.m_nodes[i]); m_nodes[i] = std::move(other.m_nodes[i]);
} }
m_descriptorSetLayout = other.m_descriptorSetLayout;
return *this; return *this;
} }
...@@ -111,6 +135,10 @@ namespace vkcv::scene { ...@@ -111,6 +135,10 @@ namespace vkcv::scene {
return m_materials[index].m_data; return m_materials[index].m_data;
} }
const DescriptorSetLayoutHandle &Scene::getDescriptorSetLayout() const {
return m_descriptorSetLayout;
}
void Scene::recordDrawcalls(CommandStreamHandle &cmdStream, void Scene::recordDrawcalls(CommandStreamHandle &cmdStream,
const camera::Camera &camera, const camera::Camera &camera,
const PassHandle &pass, const PassHandle &pass,
...@@ -284,26 +312,12 @@ namespace vkcv::scene { ...@@ -284,26 +312,12 @@ namespace vkcv::scene {
); );
const vkcv::FeatureManager& featureManager = core.getContext().getFeatureManager(); const vkcv::FeatureManager& featureManager = core.getContext().getFeatureManager();
const bool partialBound = featureManager.checkFeatures<vk::PhysicalDeviceDescriptorIndexingFeatures>(
vk::StructureType::ePhysicalDeviceDescriptorIndexingFeatures,
[](const vk::PhysicalDeviceDescriptorIndexingFeatures& features) {
return features.descriptorBindingPartiallyBound;
}
);
vkcv::Downsampler& downsampler = core.getDownsampler();
vkcv::algorithm::SinglePassDownsampler spdDownsampler (core, sampler); vkcv::algorithm::SinglePassDownsampler spdDownsampler (core, sampler);
auto mipStream = core.createCommandStream(vkcv::QueueType::Graphics); auto mipStream = core.createCommandStream(vkcv::QueueType::Graphics);
if (partialBound) { for (auto& material : scene.m_materials) {
for (auto& material : scene.m_materials) { material.m_data.recordMipChainGeneration(mipStream, spdDownsampler);
material.m_data.recordMipChainGeneration(mipStream, spdDownsampler);
}
} else {
for (auto& material : scene.m_materials) {
material.m_data.recordMipChainGeneration(mipStream, downsampler);
}
} }
core.submitCommandStream(mipStream, false); core.submitCommandStream(mipStream, false);
......
...@@ -8,8 +8,8 @@ layout(location = 2) in flat int passTextureIndex; ...@@ -8,8 +8,8 @@ layout(location = 2) in flat int passTextureIndex;
layout(location = 0) out vec3 outColor; layout(location = 0) out vec3 outColor;
layout(set=0, binding=0) uniform sampler textureSampler; layout(set=0, binding=1) uniform sampler textureSampler;
layout(set=0, binding=1) uniform texture2D materialTextures[]; layout(set=0, binding=2) uniform texture2D materialTextures[];
void main() { void main() {
outColor = texture(sampler2D(materialTextures[nonuniformEXT(passTextureIndex)], textureSampler), passUV).rgb; outColor = texture(sampler2D(materialTextures[nonuniformEXT(passTextureIndex)], textureSampler), passUV).rgb;
......
#version 450 #version 450
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inPosition; struct vertex_t {
layout(location = 1) in vec3 inNormal; vec3 position;
layout(location = 2) in vec2 inUV; float u;
vec3 normal;
float v;
};
layout(std430, set=0, binding=0) readonly buffer buffer_vertexBuffer {
vertex_t vertices [];
};
layout(location = 0) out vec3 passNormal; layout(location = 0) out vec3 passNormal;
layout(location = 1) out vec2 passUV; layout(location = 1) out vec2 passUV;
...@@ -15,9 +22,9 @@ layout( push_constant ) uniform constants{ ...@@ -15,9 +22,9 @@ layout( push_constant ) uniform constants{
void main() void main()
{ {
gl_Position = mvp * vec4(inPosition, 1.0); gl_Position = mvp * vec4(vertices[gl_VertexIndex].position, 1.0);
passNormal = inNormal; passNormal = vertices[gl_VertexIndex].normal;
passUV = inUV; passUV = vec2(vertices[gl_VertexIndex].u, vertices[gl_VertexIndex].v);
passTextureIndex = (gl_VertexIndex / 4); passTextureIndex = (gl_VertexIndex / 4);
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
#include <vkcv/asset/asset_loader.hpp> #include <vkcv/asset/asset_loader.hpp>
#include <vkcv/shader/GLSLCompiler.hpp> #include <vkcv/shader/GLSLCompiler.hpp>
struct vertex_t {
float positionU [4];
float normalV [4];
};
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
const char* applicationName = "Bindless Textures"; const char* applicationName = "Bindless Textures";
...@@ -79,13 +84,51 @@ int main(int argc, const char** argv) { ...@@ -79,13 +84,51 @@ int main(int argc, const char** argv) {
} }
assert(!mesh.vertexGroups.empty()); assert(!mesh.vertexGroups.empty());
auto vertexBuffer = core.createBuffer<uint8_t>( auto vertexBuffer = core.createBuffer<vertex_t>(
vkcv::BufferType::VERTEX, vkcv::BufferType::STORAGE,
mesh.vertexGroups[0].vertexBuffer.data.size(), mesh.vertexGroups[0].numVertices,
vkcv::BufferMemoryType::DEVICE_LOCAL vkcv::BufferMemoryType::DEVICE_LOCAL
); );
vertexBuffer.fill(mesh.vertexGroups[0].vertexBuffer.data); std::vector<vertex_t> vertices;
vertices.reserve(vertexBuffer.getCount());
for (const auto& attribute : mesh.vertexGroups[0].vertexBuffer.attributes) {
if (attribute.componentType != vkcv::asset::ComponentType::FLOAT32) {
continue;
}
size_t offset = attribute.offset;
for (size_t i = 0; i < vertexBuffer.getCount(); i++) {
const auto *data = reinterpret_cast<const float*>(
mesh.vertexGroups[0].vertexBuffer.data.data() + offset
);
switch (attribute.type) {
case vkcv::asset::PrimitiveType::POSITION:
memcpy(vertices[i].positionU, data, sizeof(float) * attribute.componentCount);
break;
case vkcv::asset::PrimitiveType::NORMAL:
memcpy(vertices[i].normalV, data, sizeof(float) * attribute.componentCount);
break;
case vkcv::asset::PrimitiveType::TEXCOORD_0:
if (attribute.componentCount != 2) {
break;
}
vertices[i].positionU[3] = data[0];
vertices[i].normalV[3] = data[1];
break;
default:
break;
}
offset += attribute.stride;
}
}
vertexBuffer.fill(vertices);
auto indexBuffer = core.createBuffer<uint8_t>( auto indexBuffer = core.createBuffer<uint8_t>(
vkcv::BufferType::INDEX, vkcv::BufferType::INDEX,
...@@ -123,24 +166,11 @@ int main(int argc, const char** argv) { ...@@ -123,24 +166,11 @@ int main(int argc, const char** argv) {
{ vkcv::ShaderStage::VERTEX, "resources/shaders/shader.vert" }, { vkcv::ShaderStage::VERTEX, "resources/shaders/shader.vert" },
{ vkcv::ShaderStage::FRAGMENT, "resources/shaders/shader.frag" } { vkcv::ShaderStage::FRAGMENT, "resources/shaders/shader.frag" }
}, nullptr); }, nullptr);
auto& attributes = mesh.vertexGroups[0].vertexBuffer.attributes;
std::sort(attributes.begin(), attributes.end(), [](const vkcv::asset::VertexAttribute& x, const vkcv::asset::VertexAttribute& y) {
return static_cast<uint32_t>(x.type) < static_cast<uint32_t>(y.type);
});
const std::vector<vkcv::VertexAttachment> vertexAttachments = firstMeshProgram.getVertexAttachments();
std::vector<vkcv::VertexBinding> bindings;
for (size_t i = 0; i < vertexAttachments.size(); i++) {
bindings.push_back(vkcv::createVertexBinding(i, { vertexAttachments[i] }));
}
const vkcv::VertexLayout firstMeshLayout { bindings }; const vkcv::DescriptorBindings &descriptorBindings = firstMeshProgram.getReflectedDescriptors().at(0);
const std::unordered_map<uint32_t, vkcv::DescriptorBinding> &descriptorBindings = firstMeshProgram.getReflectedDescriptors().at(0);
std::unordered_map<uint32_t, vkcv::DescriptorBinding> adjustedBindings = descriptorBindings; vkcv::DescriptorBindings adjustedBindings = descriptorBindings;
adjustedBindings[1].descriptorCount = 6; adjustedBindings[2].descriptorCount = 6;
vkcv::DescriptorSetLayoutHandle descriptorSetLayout = core.createDescriptorSetLayout(adjustedBindings); vkcv::DescriptorSetLayoutHandle descriptorSetLayout = core.createDescriptorSetLayout(adjustedBindings);
vkcv::DescriptorSetHandle descriptorSet = core.createDescriptorSet(descriptorSetLayout); vkcv::DescriptorSetHandle descriptorSet = core.createDescriptorSet(descriptorSetLayout);
...@@ -150,7 +180,6 @@ int main(int argc, const char** argv) { ...@@ -150,7 +180,6 @@ int main(int argc, const char** argv) {
UINT32_MAX, UINT32_MAX,
UINT32_MAX, UINT32_MAX,
firstMeshPass, firstMeshPass,
{firstMeshLayout},
{ descriptorSetLayout }, { descriptorSetLayout },
true true
}; };
...@@ -188,18 +217,13 @@ int main(int argc, const char** argv) { ...@@ -188,18 +217,13 @@ int main(int argc, const char** argv) {
vkcv::SamplerAddressMode::REPEAT vkcv::SamplerAddressMode::REPEAT
); );
const std::vector<vkcv::VertexBufferBinding> vertexBufferBindings = {
vkcv::VertexBufferBinding(static_cast<vk::DeviceSize>(attributes[0].offset), vertexBuffer.getVulkanHandle()),
vkcv::VertexBufferBinding(static_cast<vk::DeviceSize>(attributes[1].offset), vertexBuffer.getVulkanHandle()),
vkcv::VertexBufferBinding(static_cast<vk::DeviceSize>(attributes[2].offset), vertexBuffer.getVulkanHandle()) };
vkcv::DescriptorWrites setWrites; vkcv::DescriptorWrites setWrites;
setWrites.writeStorageBuffer(0, vertexBuffer.getHandle());
for(uint32_t i = 0; i < 6; i++) for(uint32_t i = 0; i < 6; i++)
{ {
setWrites.writeSampledImage( setWrites.writeSampledImage(
1, 2,
texturesArray[i].getHandle(), texturesArray[i].getHandle(),
0, 0,
false, false,
...@@ -207,7 +231,7 @@ int main(int argc, const char** argv) { ...@@ -207,7 +231,7 @@ int main(int argc, const char** argv) {
); );
} }
setWrites.writeSampler(0, sampler); setWrites.writeSampler(1, sampler);
core.writeDescriptorSet(descriptorSet, setWrites); core.writeDescriptorSet(descriptorSet, setWrites);
...@@ -215,7 +239,7 @@ int main(int argc, const char** argv) { ...@@ -215,7 +239,7 @@ int main(int argc, const char** argv) {
const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle(); const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle();
const vkcv::Mesh renderMesh(vertexBufferBindings, indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices); const vkcv::Mesh renderMesh(indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices);
vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet); vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet);
vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage },1); vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage },1);
......
#version 450 #version 450
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inPosition; struct vertex_t {
layout(location = 1) in vec3 inNormal; vec3 position;
layout(location = 2) in vec2 inUV; float u;
vec3 normal;
float v;
};
layout(std430, set=0, binding=2) readonly buffer buffer_vertexBuffer {
vertex_t vertices [];
};
layout(location = 0) out vec3 passNormal; layout(location = 0) out vec3 passNormal;
layout(location = 1) out vec2 passUV; layout(location = 1) out vec2 passUV;
...@@ -13,7 +20,7 @@ layout( push_constant ) uniform constants{ ...@@ -13,7 +20,7 @@ layout( push_constant ) uniform constants{
}; };
void main() { void main() {
gl_Position = mvp * vec4(inPosition, 1.0); gl_Position = mvp * vec4(vertices[gl_VertexIndex].position, 1.0);
passNormal = inNormal; passNormal = vertices[gl_VertexIndex].normal;
passUV = inUV; passUV = vec2(vertices[gl_VertexIndex].u, vertices[gl_VertexIndex].v);
} }
\ No newline at end of file
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
#include <vkcv/asset/asset_loader.hpp> #include <vkcv/asset/asset_loader.hpp>
#include <vkcv/shader/GLSLCompiler.hpp> #include <vkcv/shader/GLSLCompiler.hpp>
struct vertex_t {
float positionU [4];
float normalV [4];
};
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
const char* applicationName = "First Mesh"; const char* applicationName = "First Mesh";
...@@ -30,13 +35,51 @@ int main(int argc, const char** argv) { ...@@ -30,13 +35,51 @@ int main(int argc, const char** argv) {
} }
assert(!mesh.vertexGroups.empty()); assert(!mesh.vertexGroups.empty());
auto vertexBuffer = core.createBuffer<uint8_t>( auto vertexBuffer = core.createBuffer<vertex_t>(
vkcv::BufferType::VERTEX, vkcv::BufferType::STORAGE,
mesh.vertexGroups[0].vertexBuffer.data.size(), mesh.vertexGroups[0].numVertices,
vkcv::BufferMemoryType::DEVICE_LOCAL vkcv::BufferMemoryType::DEVICE_LOCAL
); );
vertexBuffer.fill(mesh.vertexGroups[0].vertexBuffer.data); std::vector<vertex_t> vertices;
vertices.reserve(vertexBuffer.getCount());
for (const auto& attribute : mesh.vertexGroups[0].vertexBuffer.attributes) {
if (attribute.componentType != vkcv::asset::ComponentType::FLOAT32) {
continue;
}
size_t offset = attribute.offset;
for (size_t i = 0; i < vertexBuffer.getCount(); i++) {
const auto *data = reinterpret_cast<const float*>(
mesh.vertexGroups[0].vertexBuffer.data.data() + offset
);
switch (attribute.type) {
case vkcv::asset::PrimitiveType::POSITION:
memcpy(vertices[i].positionU, data, sizeof(float) * attribute.componentCount);
break;
case vkcv::asset::PrimitiveType::NORMAL:
memcpy(vertices[i].normalV, data, sizeof(float) * attribute.componentCount);
break;
case vkcv::asset::PrimitiveType::TEXCOORD_0:
if (attribute.componentCount != 2) {
break;
}
vertices[i].positionU[3] = data[0];
vertices[i].normalV[3] = data[1];
break;
default:
break;
}
offset += attribute.stride;
}
}
vertexBuffer.fill(vertices);
auto indexBuffer = core.createBuffer<uint8_t>( auto indexBuffer = core.createBuffer<uint8_t>(
vkcv::BufferType::INDEX, vkcv::BufferType::INDEX,
...@@ -78,20 +121,6 @@ int main(int argc, const char** argv) { ...@@ -78,20 +121,6 @@ int main(int argc, const char** argv) {
{ vkcv::ShaderStage::VERTEX, "assets/shaders/shader.vert" }, { vkcv::ShaderStage::VERTEX, "assets/shaders/shader.vert" },
{ vkcv::ShaderStage::FRAGMENT, "assets/shaders/shader.frag" } { vkcv::ShaderStage::FRAGMENT, "assets/shaders/shader.frag" }
}, nullptr); }, nullptr);
auto& attributes = mesh.vertexGroups[0].vertexBuffer.attributes;
std::sort(attributes.begin(), attributes.end(), [](const vkcv::asset::VertexAttribute& x, const vkcv::asset::VertexAttribute& y) {
return static_cast<uint32_t>(x.type) < static_cast<uint32_t>(y.type);
});
const std::vector<vkcv::VertexAttachment> vertexAttachments = firstMeshProgram.getVertexAttachments();
std::vector<vkcv::VertexBinding> bindings;
for (size_t i = 0; i < vertexAttachments.size(); i++) {
bindings.push_back(vkcv::createVertexBinding(i, { vertexAttachments[i] }));
}
const vkcv::VertexLayout firstMeshLayout { bindings };
// since we only use one descriptor set (namely, desc set 0), directly address it // since we only use one descriptor set (namely, desc set 0), directly address it
// recreate copies of the bindings and the handles (to check whether they are properly reused instead of actually recreated) // recreate copies of the bindings and the handles (to check whether they are properly reused instead of actually recreated)
...@@ -108,7 +137,6 @@ int main(int argc, const char** argv) { ...@@ -108,7 +137,6 @@ int main(int argc, const char** argv) {
UINT32_MAX, UINT32_MAX,
UINT32_MAX, UINT32_MAX,
firstMeshPass, firstMeshPass,
{firstMeshLayout},
{ setLayoutHandle }, { setLayoutHandle },
true true
}; };
...@@ -141,14 +169,10 @@ int main(int argc, const char** argv) { ...@@ -141,14 +169,10 @@ int main(int argc, const char** argv) {
vkcv::SamplerAddressMode::REPEAT vkcv::SamplerAddressMode::REPEAT
); );
const std::vector<vkcv::VertexBufferBinding> vertexBufferBindings = {
vkcv::VertexBufferBinding(static_cast<vk::DeviceSize>(attributes[0].offset), vertexBuffer.getVulkanHandle()),
vkcv::VertexBufferBinding(static_cast<vk::DeviceSize>(attributes[1].offset), vertexBuffer.getVulkanHandle()),
vkcv::VertexBufferBinding(static_cast<vk::DeviceSize>(attributes[2].offset), vertexBuffer.getVulkanHandle()) };
vkcv::DescriptorWrites setWrites; vkcv::DescriptorWrites setWrites;
setWrites.writeSampledImage(0, texture.getHandle()); setWrites.writeSampledImage(0, texture.getHandle());
setWrites.writeSampler(1, sampler); setWrites.writeSampler(1, sampler);
setWrites.writeStorageBuffer(2, vertexBuffer.getHandle());
core.writeDescriptorSet(descriptorSet, setWrites); core.writeDescriptorSet(descriptorSet, setWrites);
...@@ -156,7 +180,7 @@ int main(int argc, const char** argv) { ...@@ -156,7 +180,7 @@ int main(int argc, const char** argv) {
const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle(); const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle();
const vkcv::Mesh renderMesh(vertexBufferBindings, indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices); const vkcv::Mesh renderMesh(indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices);
vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet); vkcv::DescriptorSetUsage descriptorUsage(0, descriptorSet);
vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage },1); vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage },1);
......
...@@ -6,8 +6,8 @@ layout(location = 1) in vec2 passUV; ...@@ -6,8 +6,8 @@ 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=1, binding=0) uniform texture2D meshTexture;
layout(set=0, binding=1) uniform sampler textureSampler; layout(set=1, binding=1) uniform sampler textureSampler;
void main() { void main() {
outColor = texture(sampler2D(meshTexture, textureSampler), passUV).rgb; outColor = texture(sampler2D(meshTexture, textureSampler), passUV).rgb;
......
#version 450 #version 450
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inPosition; struct vertex_t {
layout(location = 1) in vec3 inNormal; vec3 position;
layout(location = 2) in vec2 inUV; float u;
vec3 normal;
float v;
};
layout(std430, set=0, binding=0) readonly buffer buffer_vertexBuffer {
vertex_t vertices [];
};
layout(location = 0) out vec3 passNormal; layout(location = 0) out vec3 passNormal;
layout(location = 1) out vec2 passUV; layout(location = 1) out vec2 passUV;
...@@ -13,7 +20,7 @@ layout( push_constant ) uniform constants{ ...@@ -13,7 +20,7 @@ layout( push_constant ) uniform constants{
}; };
void main() { void main() {
gl_Position = mvp * vec4(inPosition, 1.0); gl_Position = mvp * vec4(vertices[gl_VertexIndex].position, 1.0);
passNormal = inNormal; passNormal = vertices[gl_VertexIndex].normal;
passUV = inUV; passUV = vec2(vertices[gl_VertexIndex].u, vertices[gl_VertexIndex].v);
} }
\ No newline at end of file
...@@ -80,14 +80,6 @@ int main(int argc, const char** argv) { ...@@ -80,14 +80,6 @@ int main(int argc, const char** argv) {
{ vkcv::ShaderStage::FRAGMENT, "assets/shaders/shader.frag" } { vkcv::ShaderStage::FRAGMENT, "assets/shaders/shader.frag" }
}, nullptr); }, nullptr);
const std::vector<vkcv::VertexAttachment> vertexAttachments = sceneShaderProgram.getVertexAttachments();
std::vector<vkcv::VertexBinding> bindings;
for (size_t i = 0; i < vertexAttachments.size(); i++) {
bindings.push_back(vkcv::createVertexBinding(i, { vertexAttachments[i] }));
}
const vkcv::VertexLayout sceneLayout { bindings };
const auto& material0 = scene.getMaterial(0); const auto& material0 = scene.getMaterial(0);
const vkcv::GraphicsPipelineConfig scenePipelineDefinition{ const vkcv::GraphicsPipelineConfig scenePipelineDefinition{
...@@ -95,10 +87,10 @@ int main(int argc, const char** argv) { ...@@ -95,10 +87,10 @@ int main(int argc, const char** argv) {
UINT32_MAX, UINT32_MAX,
UINT32_MAX, UINT32_MAX,
scenePass, scenePass,
{sceneLayout}, { scene.getDescriptorSetLayout(), material0.getDescriptorSetLayout() },
{ material0.getDescriptorSetLayout() },
true true
}; };
vkcv::GraphicsPipelineHandle scenePipeline = core.createGraphicsPipeline(scenePipelineDefinition); vkcv::GraphicsPipelineHandle scenePipeline = core.createGraphicsPipeline(scenePipelineDefinition);
if (!scenePipeline) { if (!scenePipeline) {
......
...@@ -58,7 +58,6 @@ int main(int argc, const char** argv) { ...@@ -58,7 +58,6 @@ int main(int argc, const char** argv) {
UINT32_MAX, UINT32_MAX,
trianglePass, trianglePass,
{}, {},
{},
true true
}; };
...@@ -74,7 +73,7 @@ int main(int argc, const char** argv) { ...@@ -74,7 +73,7 @@ int main(int argc, const char** argv) {
auto start = std::chrono::system_clock::now(); auto start = std::chrono::system_clock::now();
const vkcv::Mesh renderMesh({}, triangleIndexBuffer.getVulkanHandle(), 3); const vkcv::Mesh renderMesh(triangleIndexBuffer.getVulkanHandle(), 3);
vkcv::DrawcallInfo drawcall(renderMesh, {},1); vkcv::DrawcallInfo drawcall(renderMesh, {},1);
const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle(); const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle();
......
...@@ -9,7 +9,7 @@ layout(location = 0) in vec3 geomNormal[]; ...@@ -9,7 +9,7 @@ layout(location = 0) in vec3 geomNormal[];
layout(location = 0) out vec3 passNormal; layout(location = 0) out vec3 passNormal;
layout(set=1, binding=0) uniform clipBuffer { layout(set=2, binding=0) uniform clipBuffer {
float clipLimit; float clipLimit;
float clipX; float clipX;
float clipY; float clipY;
......