Run spirv-opt when compiling shaders

This commit is contained in:
Patrick Nicolas
2025-09-04 17:06:19 +02:00
parent c80ba550eb
commit cc5990a513
7 changed files with 62 additions and 17 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ file(GLOB LOCAL_SOURCE CONFIGURE_DEPENDS
file(GLOB_RECURSE VULKAN_SHADERS CONFIGURE_DEPENDS "*.glsl")
target_sources(wivrn PRIVATE ${LOCAL_SOURCE} ${VULKAN_SHADERS})
wivrn_compile_glsl(wivrn ${VULKAN_SHADERS})
wivrn_compile_glsl(wivrn SHADERS ${VULKAN_SHADERS})
target_link_libraries(wivrn
Boost::locale
-3
View File
@@ -35,7 +35,6 @@
#include <glm/gtc/matrix_access.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/quaternion.hpp>
#include <map>
#include <memory>
#include <ranges>
#include <spdlog/spdlog.h>
@@ -43,8 +42,6 @@
#include <vulkan/vulkan_enums.hpp>
#include <vulkan/vulkan_structs.hpp>
extern const std::map<std::string, std::vector<uint32_t>> shaders;
// TODO move in lobby?
vk::Format scene_renderer::find_usable_image_format(
vk::raii::PhysicalDevice physical_device,
+2 -1
View File
@@ -18,12 +18,13 @@
*/
#include "shader.h"
#include "wivrn_shaders.h"
vk::raii::ShaderModule load_shader(vk::raii::Device & device, const std::vector<uint32_t> & spirv)
{
vk::ShaderModuleCreateInfo create_info{
.codeSize = spirv.size() * sizeof(uint32_t),
.pCode = data(spirv),
.pCode = spirv.data(),
};
return vk::raii::ShaderModule{device, create_info};
-3
View File
@@ -19,12 +19,9 @@
#pragma once
#include <map>
#include <string>
#include <vector>
#include <vulkan/vulkan_raii.hpp>
extern const std::map<std::string, std::vector<uint32_t>> shaders;
vk::raii::ShaderModule load_shader(vk::raii::Device & device, const std::vector<uint32_t> & spirv);
vk::raii::ShaderModule load_shader(vk::raii::Device & device, const std::string & name);