Skip to content
Snippets Groups Projects
Verified Commit 1a1677cc authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Merge branch 'develop' into 79-rework-asset-loader-api

parents 52ee61f0 ab528a93
No related branches found
No related tags found
1 merge request!69Resolve "Rework Asset Loader API"
Pipeline #26857 passed
Showing
with 298 additions and 64 deletions
...@@ -18,3 +18,8 @@ cmake-build-release/ ...@@ -18,3 +18,8 @@ cmake-build-release/
# GUI configuration files # GUI configuration files
imgui.ini imgui.ini
# Generated source and header files for shaders
*.hxx
*.cxx
variables: variables:
RUN: RUN:
value: "all" value: "all"
description: "The tests that should run. Possible values: ubuntu, win, all." description: "The tests that should run. Possible values: ubuntu, win-msvc, win-mingw, mac, all."
GIT_DEPTH: 1 GIT_DEPTH: 15
stages: stages:
- build - build
...@@ -17,7 +17,7 @@ build_ubuntu_gcc: ...@@ -17,7 +17,7 @@ build_ubuntu_gcc:
- ubuntu-gcc-cached - ubuntu-gcc-cached
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
timeout: 10m timeout: 15m
retry: 1 retry: 1
script: script:
- mkdir debug - mkdir debug
...@@ -34,13 +34,13 @@ build_ubuntu_gcc: ...@@ -34,13 +34,13 @@ build_ubuntu_gcc:
build_win10_msvc: build_win10_msvc:
only: only:
variables: variables:
- $RUN =~ /\bwin.*/i || $RUN =~ /\ball.*/i - $RUN =~ /\bwin-msvc.*/i || $RUN =~ /\ball.*/i
stage: build stage: build
tags: tags:
- win10-msvc-cached - win10-msvc-cached
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
timeout: 10m timeout: 15m
retry: 0 retry: 0
script: script:
- cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\' - cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\'
...@@ -51,6 +51,42 @@ build_win10_msvc: ...@@ -51,6 +51,42 @@ build_win10_msvc:
- cmake -DCMAKE_BUILD_TYPE=Debug .. - cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build . - cmake --build .
build_win10_mingw:
only:
variables:
- $RUN =~ /\bwin-mingw.*/i || $RUN =~ /\ball.*/i
stage: build
tags:
- win10-mingw-cached
variables:
GIT_SUBMODULE_STRATEGY: recursive
timeout: 15m
retry: 0
script:
- mkdir debug
- cd debug
- cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe .. -G "Unix Makefiles"
- cmake --build . -j 8
build_mac_clang:
only:
variables:
- $RUN =~ /\bmac.*/i || $RUN =~ /\ball.*/i
stage: build
tags:
- catalina-clang-cached
variables:
GIT_SUBMODULE_STRATEGY: recursive
timeout: 15m
retry: 1
script:
- mkdir debug
- cd debug
- export LDFLAGS="-L/usr/local/opt/llvm/lib"
- export CPPFLAGS="-I/usr/local/opt/llvm/include"
- cmake -DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build .
deploy_doc_develop: deploy_doc_develop:
only: only:
variables: variables:
......
...@@ -25,3 +25,6 @@ ...@@ -25,3 +25,6 @@
[submodule "lib/VulkanMemoryAllocator-Hpp"] [submodule "lib/VulkanMemoryAllocator-Hpp"]
path = lib/VulkanMemoryAllocator-Hpp path = lib/VulkanMemoryAllocator-Hpp
url = https://github.com/malte-v/VulkanMemoryAllocator-Hpp.git url = https://github.com/malte-v/VulkanMemoryAllocator-Hpp.git
[submodule "modules/upscaling/lib/FidelityFX-FSR"]
path = modules/upscaling/lib/FidelityFX-FSR
url = https://github.com/GPUOpen-Effects/FidelityFX-FSR.git
...@@ -33,7 +33,8 @@ set(vkcv_flags ${CMAKE_CXX_FLAGS}) ...@@ -33,7 +33,8 @@ set(vkcv_flags ${CMAKE_CXX_FLAGS})
# enabling warnings in the debug build # enabling warnings in the debug build
if (vkcv_build_debug) if (vkcv_build_debug)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(vkcv_flags ${vkcv_flags} " -Weverything") #set(vkcv_flags ${vkcv_flags} " -Weverything")
set(vkcv_flags ${vkcv_flags} " -Wextra -Wall")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(vkcv_flags ${vkcv_flags} " -Wextra -Wall -pedantic") set(vkcv_flags ${vkcv_flags} " -Wextra -Wall -pedantic")
else() else()
......
...@@ -3,7 +3,13 @@ set(vkcv_config_lib ${vkcv_config}/lib) ...@@ -3,7 +3,13 @@ set(vkcv_config_lib ${vkcv_config}/lib)
set(vkcv_lib_path ${PROJECT_SOURCE_DIR}/${vkcv_lib}) set(vkcv_lib_path ${PROJECT_SOURCE_DIR}/${vkcv_lib})
if(NOT WIN32) if(NOT WIN32)
set(vkcv_libraries stdc++fs) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(vkcv_libraries stdc++fs)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
list(APPEND vkcv_flags -Xpreprocessor)
endif()
# optimization for loading times # optimization for loading times
list(APPEND vkcv_flags -pthread) list(APPEND vkcv_flags -pthread)
...@@ -34,6 +40,9 @@ endif () ...@@ -34,6 +40,9 @@ endif ()
# fix dependencies for different Linux distros (looking at you Ubuntu) # fix dependencies for different Linux distros (looking at you Ubuntu)
include(${vkcv_config_ext}/CheckLibraries.cmake) include(${vkcv_config_ext}/CheckLibraries.cmake)
# add custom function to include a file like a shader as string
include(${vkcv_config_ext}/IncludeShader.cmake)
# cleanup of compiler definitions aka preprocessor variables # cleanup of compiler definitions aka preprocessor variables
if (vkcv_definitions) if (vkcv_definitions)
list(REMOVE_DUPLICATES vkcv_definitions) list(REMOVE_DUPLICATES vkcv_definitions)
......
...@@ -6,6 +6,9 @@ set(vkcv_sources ...@@ -6,6 +6,9 @@ set(vkcv_sources
${vkcv_include}/vkcv/Core.hpp ${vkcv_include}/vkcv/Core.hpp
${vkcv_source}/vkcv/Core.cpp ${vkcv_source}/vkcv/Core.cpp
${vkcv_include}/vkcv/File.hpp
${vkcv_source}/vkcv/File.cpp
${vkcv_include}/vkcv/PassConfig.hpp ${vkcv_include}/vkcv/PassConfig.hpp
${vkcv_source}/vkcv/PassConfig.cpp ${vkcv_source}/vkcv/PassConfig.cpp
......
function(include_shader shader include_dir source_dir)
if (NOT EXISTS ${shader})
message(WARNING "Shader file does not exist: ${shader}")
else()
get_filename_component(filename ${shader} NAME)
file(SIZE ${shader} filesize)
set(include_target_file ${include_dir}/${filename}.hxx)
set(source_target_file ${source_dir}/${filename}.cxx)
if ((EXISTS ${source_target_file}) AND (EXISTS ${include_target_file}))
file(TIMESTAMP ${shader} shader_timestamp "%Y-%m-%dT%H:%M:%S")
file(TIMESTAMP ${source_target_file} source_timestamp "%Y-%m-%dT%H:%M:%S")
string(COMPARE GREATER ${shader_timestamp} ${source_timestamp} shader_update)
else()
set(shader_update true)
endif()
if (shader_update)
string(TOUPPER ${filename} varname)
string(REPLACE "." "_" varname ${varname})
set(shader_header "#pragma once\n")
string(APPEND shader_header "// This file is auto-generated via cmake, so don't touch it!\n")
string(APPEND shader_header "extern unsigned char ${varname} [${filesize}]\;\n")
string(APPEND shader_header "extern unsigned int ${varname}_LEN\;\n")
string(APPEND shader_header "const std::string ${varname}_SHADER (reinterpret_cast<const char*>(${varname}), ${varname}_LEN)\;")
file(WRITE ${include_target_file} ${shader_header})
find_program(xxd_program "xxd")
if (EXISTS ${xxd_program})
get_filename_component(shader_directory ${shader} DIRECTORY)
add_custom_command(
OUTPUT ${source_target_file}
WORKING_DIRECTORY "${shader_directory}"
COMMAND xxd -i -C "${filename}" "${source_target_file}"
COMMENT "Processing shader into source files: ${shader}"
)
else()
set(shader_source "// This file is auto-generated via cmake, so don't touch it!\n")
string(APPEND shader_source "unsigned char ${varname}[] = {")
math(EXPR max_fileoffset "${filesize} - 1" OUTPUT_FORMAT DECIMAL)
message(STATUS "Processing shader into source files: ${shader}")
foreach(fileoffset RANGE ${max_fileoffset})
file(READ ${shader} shader_source_byte OFFSET ${fileoffset} LIMIT 1 HEX)
math(EXPR offset_modulo "${fileoffset} % 12" OUTPUT_FORMAT DECIMAL)
if (${offset_modulo} EQUAL 0)
string(APPEND shader_source "\n ")
endif()
if (${fileoffset} LESS ${max_fileoffset})
string(APPEND shader_source "0x${shader_source_byte}, ")
else()
string(APPEND shader_source "0x${shader_source_byte}\n")
endif()
endforeach()
string(APPEND shader_source "}\;\n")
string(APPEND shader_source "unsigned int ${varname}_LEN = ${filesize}\;")
file(WRITE ${source_target_file} ${shader_source})
endif()
endif()
endif()
endfunction()
...@@ -4,24 +4,54 @@ ...@@ -4,24 +4,54 @@
#endif #endif
#ifndef _MSVC_LANG #ifndef _MSVC_LANG
#ifdef __MINGW32__
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef __MINGW32__
class VmaMutex { class VmaMutex {
public: public:
void Lock() {} // TODO: This should actually lock! VmaMutex() : m_locked(false) {}
void Unlock() {} // TODO: This should actually unlock!
void Lock() {
while (m_locked);
m_locked = true;
}
void Unlock() {
m_locked = false;
}
private:
bool m_locked;
}; };
#define VMA_MUTEX VmaMutex #define VMA_MUTEX VmaMutex
// TODO: This is not actually a valid way to do aligned allocations! template <typename T>
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (malloc(size)) T* custom_overestimate_malloc(size_t size) {
#else return new T[size + (sizeof(T) - 1) / sizeof(T)];
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (aligned_alloc((alignment), (size))) }
#endif
#define VMA_SYSTEM_FREE(ptr) free(ptr) void* custom_aligned_malloc(size_t alignment, size_t size) {
if (alignment > 4) {
return custom_overestimate_malloc<uint64_t>(size);
} else
if (alignment > 2) {
return custom_overestimate_malloc<uint32_t>(size);
} else
if (alignment > 1) {
return custom_overestimate_malloc<uint16_t>(size);
} else {
return custom_overestimate_malloc<uint8_t>(size);
}
}
void custom_free(void *ptr) {
delete[] reinterpret_cast<uint8_t*>(ptr);
}
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (custom_aligned_malloc(alignment, size))
#define VMA_SYSTEM_FREE(ptr) (custom_free(ptr))
#endif
#endif #endif
#define VMA_IMPLEMENTATION #define VMA_IMPLEMENTATION
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <vk_mem_alloc.hpp> #include <vk_mem_alloc.hpp>
#include "QueueManager.hpp" #include "QueueManager.hpp"
#include "DrawcallRecording.hpp"
namespace vkcv namespace vkcv
{ {
...@@ -39,9 +40,9 @@ namespace vkcv ...@@ -39,9 +40,9 @@ namespace vkcv
static Context create(const char *applicationName, static Context create(const char *applicationName,
uint32_t applicationVersion, uint32_t applicationVersion,
std::vector<vk::QueueFlagBits> queueFlags, const std::vector<vk::QueueFlagBits>& queueFlags,
std::vector<const char *> instanceExtensions, const std::vector<const char *>& instanceExtensions,
std::vector<const char *> deviceExtensions); const std::vector<const char *>& deviceExtensions);
private: private:
/** /**
......
...@@ -138,9 +138,9 @@ namespace vkcv ...@@ -138,9 +138,9 @@ namespace vkcv
static Core create(Window &window, static Core create(Window &window,
const char *applicationName, const char *applicationName,
uint32_t applicationVersion, uint32_t applicationVersion,
std::vector<vk::QueueFlagBits> queueFlags = {}, const std::vector<vk::QueueFlagBits>& queueFlags = {},
std::vector<const char*> instanceExtensions = {}, const std::vector<const char*>& instanceExtensions = {},
std::vector<const char*> deviceExtensions = {}); const std::vector<const char*>& deviceExtensions = {});
/** /**
* Creates a basic vulkan graphics pipeline using @p config from the pipeline config class and returns it using the @p handle. * Creates a basic vulkan graphics pipeline using @p config from the pipeline config class and returns it using the @p handle.
...@@ -163,7 +163,7 @@ namespace vkcv ...@@ -163,7 +163,7 @@ namespace vkcv
*/ */
[[nodiscard]] [[nodiscard]]
PipelineHandle createComputePipeline( PipelineHandle createComputePipeline(
const ShaderProgram &config, const ShaderProgram &shaderProgram,
const std::vector<vk::DescriptorSetLayout> &descriptorSetLayouts); const std::vector<vk::DescriptorSetLayout> &descriptorSetLayouts);
/** /**
...@@ -196,11 +196,13 @@ namespace vkcv ...@@ -196,11 +196,13 @@ namespace vkcv
* @param minFilter Minimizing filter * @param minFilter Minimizing filter
* @param mipmapMode Mipmapping filter * @param mipmapMode Mipmapping filter
* @param addressMode Address mode * @param addressMode Address mode
* @param mipLodBias Mip level of detail bias
* @return Sampler handle * @return Sampler handle
*/ */
[[nodiscard]] [[nodiscard]]
SamplerHandle createSampler(SamplerFilterType magFilter, SamplerFilterType minFilter, SamplerHandle createSampler(SamplerFilterType magFilter, SamplerFilterType minFilter,
SamplerMipmapMode mipmapMode, SamplerAddressMode addressMode); SamplerMipmapMode mipmapMode, SamplerAddressMode addressMode,
float mipLodBias = 0.0f);
/** /**
* Creates an #Image with a given format, width, height and depth. * Creates an #Image with a given format, width, height and depth.
...@@ -223,9 +225,13 @@ namespace vkcv ...@@ -223,9 +225,13 @@ namespace vkcv
Multisampling multisampling = Multisampling::None); Multisampling multisampling = Multisampling::None);
[[nodiscard]] [[nodiscard]]
uint32_t getImageWidth(ImageHandle imageHandle); uint32_t getImageWidth(const ImageHandle& image);
[[nodiscard]] [[nodiscard]]
uint32_t getImageHeight(ImageHandle imageHandle); uint32_t getImageHeight(const ImageHandle& image);
[[nodiscard]]
vk::Format getImageFormat(const ImageHandle& image);
/** TODO: /** TODO:
* @param setDescriptions * @param setDescriptions
...@@ -243,13 +249,21 @@ namespace vkcv ...@@ -243,13 +249,21 @@ namespace vkcv
bool beginFrame(uint32_t& width, uint32_t& height); bool beginFrame(uint32_t& width, uint32_t& height);
void recordDrawcallsToCmdStream( void recordDrawcallsToCmdStream(
const CommandStreamHandle cmdStreamHandle, const CommandStreamHandle cmdStreamHandle,
const PassHandle renderpassHandle, const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle, const PipelineHandle pipelineHandle,
const PushConstants &pushConstants, const PushConstants &pushConstants,
const std::vector<DrawcallInfo> &drawcalls, const std::vector<DrawcallInfo> &drawcalls,
const std::vector<ImageHandle> &renderTargets); const std::vector<ImageHandle> &renderTargets);
void recordMeshShaderDrawcalls(
const CommandStreamHandle cmdStreamHandle,
const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle,
const PushConstants& pushConstantData,
const std::vector<MeshShaderDrawcall>& drawcalls,
const std::vector<ImageHandle>& renderTargets);
void recordComputeDispatchToCmdStream( void recordComputeDispatchToCmdStream(
CommandStreamHandle cmdStream, CommandStreamHandle cmdStream,
PipelineHandle computePipeline, PipelineHandle computePipeline,
...@@ -283,15 +297,21 @@ namespace vkcv ...@@ -283,15 +297,21 @@ namespace vkcv
const RecordCommandFunction &record, const RecordCommandFunction &record,
const FinishCommandFunction &finish); const FinishCommandFunction &finish);
void submitCommandStream(const CommandStreamHandle handle); void submitCommandStream(const CommandStreamHandle& handle);
void prepareSwapchainImageForPresent(const CommandStreamHandle handle); void prepareSwapchainImageForPresent(const CommandStreamHandle& handle);
void prepareImageForSampling(const CommandStreamHandle cmdStream, const ImageHandle image); void prepareImageForSampling(const CommandStreamHandle& cmdStream, const ImageHandle& image);
void prepareImageForStorage(const CommandStreamHandle cmdStream, const ImageHandle image); void prepareImageForStorage(const CommandStreamHandle& cmdStream, const ImageHandle& image);
void recordImageMemoryBarrier(const CommandStreamHandle cmdStream, const ImageHandle image); void recordImageMemoryBarrier(const CommandStreamHandle& cmdStream, const ImageHandle& image);
void recordBufferMemoryBarrier(const CommandStreamHandle cmdStream, const BufferHandle buffer); void recordBufferMemoryBarrier(const CommandStreamHandle& cmdStream, const BufferHandle& buffer);
void resolveMSAAImage(CommandStreamHandle cmdStream, ImageHandle src, ImageHandle dst); void resolveMSAAImage(const CommandStreamHandle& cmdStream, const ImageHandle& src, const ImageHandle& dst);
[[nodiscard]]
vk::ImageView getSwapchainImageView() const; vk::ImageView getSwapchainImageView() const;
void recordMemoryBarrier(const CommandStreamHandle& cmdStream);
void recordBlitImage(const CommandStreamHandle& cmdStream, const ImageHandle& src, const ImageHandle& dst,
SamplerFilterType filterType);
}; };
} }
...@@ -23,7 +23,9 @@ namespace vkcv ...@@ -23,7 +23,9 @@ namespace vkcv
STORAGE_BUFFER, STORAGE_BUFFER,
SAMPLER, SAMPLER,
IMAGE_SAMPLED, IMAGE_SAMPLED,
IMAGE_STORAGE IMAGE_STORAGE,
UNIFORM_BUFFER_DYNAMIC,
STORAGE_BUFFER_DYNAMIC
}; };
/* /*
......
...@@ -20,16 +20,15 @@ namespace vkcv { ...@@ -20,16 +20,15 @@ namespace vkcv {
uint32_t mipLevel; uint32_t mipLevel;
}; };
struct UniformBufferDescriptorWrite { struct BufferDescriptorWrite {
inline UniformBufferDescriptorWrite(uint32_t binding, BufferHandle buffer) : binding(binding), buffer(buffer) {}; inline BufferDescriptorWrite(uint32_t binding, BufferHandle buffer, bool dynamic = false,
uint32_t binding; uint32_t offset = 0, uint32_t size = 0) :
BufferHandle buffer; binding(binding), buffer(buffer), dynamic(dynamic), offset(offset), size(size) {};
};
struct StorageBufferDescriptorWrite {
inline StorageBufferDescriptorWrite(uint32_t binding, BufferHandle buffer) : binding(binding), buffer(buffer) {};
uint32_t binding; uint32_t binding;
BufferHandle buffer; BufferHandle buffer;
bool dynamic;
uint32_t offset;
uint32_t size;
}; };
struct SamplerDescriptorWrite { struct SamplerDescriptorWrite {
...@@ -41,8 +40,8 @@ namespace vkcv { ...@@ -41,8 +40,8 @@ namespace vkcv {
struct DescriptorWrites { struct DescriptorWrites {
std::vector<SampledImageDescriptorWrite> sampledImageWrites; std::vector<SampledImageDescriptorWrite> sampledImageWrites;
std::vector<StorageImageDescriptorWrite> storageImageWrites; std::vector<StorageImageDescriptorWrite> storageImageWrites;
std::vector<UniformBufferDescriptorWrite> uniformBufferWrites; std::vector<BufferDescriptorWrite> uniformBufferWrites;
std::vector<StorageBufferDescriptorWrite> storageBufferWrites; std::vector<BufferDescriptorWrite> storageBufferWrites;
std::vector<SamplerDescriptorWrite> samplerWrites; std::vector<SamplerDescriptorWrite> samplerWrites;
}; };
} }
\ No newline at end of file
...@@ -13,21 +13,30 @@ namespace vkcv { ...@@ -13,21 +13,30 @@ namespace vkcv {
vk::Buffer buffer; vk::Buffer buffer;
}; };
enum class IndexBitCount{
Bit16,
Bit32
};
struct DescriptorSetUsage { struct DescriptorSetUsage {
inline DescriptorSetUsage(uint32_t setLocation, vk::DescriptorSet vulkanHandle) noexcept inline DescriptorSetUsage(uint32_t setLocation, vk::DescriptorSet vulkanHandle,
: setLocation(setLocation), vulkanHandle(vulkanHandle) {} const std::vector<uint32_t>& dynamicOffsets = {}) noexcept
: setLocation(setLocation), vulkanHandle(vulkanHandle), dynamicOffsets(dynamicOffsets) {}
const uint32_t setLocation; const uint32_t setLocation;
const vk::DescriptorSet vulkanHandle; const vk::DescriptorSet vulkanHandle;
const std::vector<uint32_t> dynamicOffsets;
}; };
struct Mesh { struct Mesh {
inline Mesh(std::vector<VertexBufferBinding> vertexBufferBindings, vk::Buffer indexBuffer, size_t indexCount) noexcept inline Mesh(std::vector<VertexBufferBinding> vertexBufferBindings, vk::Buffer indexBuffer, size_t indexCount, IndexBitCount indexBitCount = IndexBitCount::Bit16) noexcept
: vertexBufferBindings(vertexBufferBindings), indexBuffer(indexBuffer), indexCount(indexCount){} : vertexBufferBindings(vertexBufferBindings), indexBuffer(indexBuffer), indexCount(indexCount), indexBitCount(indexBitCount){}
std::vector<VertexBufferBinding> vertexBufferBindings; std::vector<VertexBufferBinding> vertexBufferBindings;
vk::Buffer indexBuffer; vk::Buffer indexBuffer;
size_t indexCount; size_t indexCount;
IndexBitCount indexBitCount;
}; };
struct DrawcallInfo { struct DrawcallInfo {
...@@ -46,4 +55,21 @@ namespace vkcv { ...@@ -46,4 +55,21 @@ namespace vkcv {
const PushConstants &pushConstants, const PushConstants &pushConstants,
const size_t drawcallIndex); const size_t drawcallIndex);
} void InitMeshShaderDrawFunctions(vk::Device device);
\ No newline at end of file
struct MeshShaderDrawcall {
inline MeshShaderDrawcall(const std::vector<DescriptorSetUsage> descriptorSets, uint32_t taskCount)
: descriptorSets(descriptorSets), taskCount(taskCount) {}
std::vector<DescriptorSetUsage> descriptorSets;
uint32_t taskCount;
};
void recordMeshShaderDrawcall(
vk::CommandBuffer cmdBuffer,
vk::PipelineLayout pipelineLayout,
const PushConstants& pushConstantData,
const uint32_t pushConstantOffset,
const MeshShaderDrawcall& drawcall,
const uint32_t firstTask);
}
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <mutex> #include <mutex>
#endif #endif
#include <vector>
namespace vkcv { namespace vkcv {
template<typename... T> template<typename... T>
......
#pragma once
#include <filesystem>
namespace vkcv {
std::filesystem::path generateTemporaryFilePath();
std::filesystem::path generateTemporaryDirectoryPath();
}
...@@ -53,9 +53,10 @@ namespace vkcv { ...@@ -53,9 +53,10 @@ namespace vkcv {
VKCV_DEBUG_MESSAGE_LEN, \ VKCV_DEBUG_MESSAGE_LEN, \
__VA_ARGS__ \ __VA_ARGS__ \
); \ ); \
auto output = getLogOutput(level); \
if (level != vkcv::LogLevel::RAW_INFO) { \ if (level != vkcv::LogLevel::RAW_INFO) { \
fprintf( \ fprintf( \
getLogOutput(level), \ output, \
"[%s]: %s [%s, line %d: %s]\n", \ "[%s]: %s [%s, line %d: %s]\n", \
vkcv::getLogName(level), \ vkcv::getLogName(level), \
output_message, \ output_message, \
...@@ -65,12 +66,13 @@ namespace vkcv { ...@@ -65,12 +66,13 @@ namespace vkcv {
); \ ); \
} else { \ } else { \
fprintf( \ fprintf( \
getLogOutput(level), \ output, \
"[%s]: %s\n", \ "[%s]: %s\n", \
vkcv::getLogName(level), \ vkcv::getLogName(level), \
output_message \ output_message \
); \ ); \
} \ } \
fflush(output); \
} }
#else #else
......
...@@ -32,8 +32,8 @@ namespace vkcv { ...@@ -32,8 +32,8 @@ namespace vkcv {
const std::vector<Queue> &getTransferQueues() const; const std::vector<Queue> &getTransferQueues() const;
static void queueCreateInfosQueueHandles(vk::PhysicalDevice &physicalDevice, static void queueCreateInfosQueueHandles(vk::PhysicalDevice &physicalDevice,
std::vector<float> &queuePriorities, const std::vector<float> &queuePriorities,
std::vector<vk::QueueFlagBits> &queueFlags, const std::vector<vk::QueueFlagBits> &queueFlags,
std::vector<vk::DeviceQueueCreateInfo> &queueCreateInfos, std::vector<vk::DeviceQueueCreateInfo> &queueCreateInfos,
std::vector<std::pair<int, int>> &queuePairsGraphics, std::vector<std::pair<int, int>> &queuePairsGraphics,
std::vector<std::pair<int, int>> &queuePairsCompute, std::vector<std::pair<int, int>> &queuePairsCompute,
......
...@@ -9,7 +9,11 @@ namespace vkcv { ...@@ -9,7 +9,11 @@ namespace vkcv {
TESS_EVAL, TESS_EVAL,
GEOMETRY, GEOMETRY,
FRAGMENT, FRAGMENT,
COMPUTE COMPUTE,
TASK,
MESH
}; };
} }
...@@ -4,6 +4,8 @@ add_subdirectory(asset_loader) ...@@ -4,6 +4,8 @@ add_subdirectory(asset_loader)
add_subdirectory(camera) add_subdirectory(camera)
add_subdirectory(gui) add_subdirectory(gui)
add_subdirectory(material) add_subdirectory(material)
add_subdirectory(meshlet)
add_subdirectory(scene) add_subdirectory(scene)
add_subdirectory(shader_compiler) add_subdirectory(shader_compiler)
add_subdirectory(testing) add_subdirectory(testing)
add_subdirectory(upscaling)
...@@ -565,19 +565,22 @@ namespace vkcv::asset { ...@@ -565,19 +565,22 @@ namespace vkcv::asset {
scene.textures.reserve(sceneObjects.textures.size()); scene.textures.reserve(sceneObjects.textures.size());
for (const auto& textureObject : sceneObjects.textures) { for (const auto& textureObject : sceneObjects.textures) {
if ((textureObject.sampler < 0) || Texture texture;
(static_cast<size_t>(textureObject.sampler) >= scene.samplers.size())) {
vkcv_log(LogLevel::WARNING, "Sampler of texture '%s' missing (%s)", if (textureObject.sampler < 0) {
texture.sampler = -1;
} else
if (static_cast<size_t>(textureObject.sampler) >= scene.samplers.size()) {
vkcv_log(LogLevel::ERROR, "Sampler of texture '%s' missing (%s) %d",
textureObject.name.c_str(), path.c_str()); textureObject.name.c_str(), path.c_str());
return ASSET_ERROR; return ASSET_ERROR;
} else {
texture.sampler = textureObject.sampler;
} }
Texture texture;
texture.sampler = textureObject.sampler;
if ((textureObject.source < 0) || if ((textureObject.source < 0) ||
(static_cast<size_t>(textureObject.source) >= sceneObjects.images.size())) { (static_cast<size_t>(textureObject.source) >= sceneObjects.images.size())) {
vkcv_log(LogLevel::WARNING, "Failed to load texture '%s' (%s)", vkcv_log(LogLevel::ERROR, "Failed to load texture '%s' (%s)",
textureObject.name.c_str(), path.c_str()); textureObject.name.c_str(), path.c_str());
return ASSET_ERROR; return ASSET_ERROR;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment