working mesh shader
This commit is contained in:
parent
97ca634108
commit
27ba32cdf5
11 changed files with 175 additions and 30 deletions
|
|
@ -6,6 +6,7 @@ module;
|
|||
#include <fstream>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
export module Crafter.Graphics:VulkanShader;
|
||||
import :VulkanDevice;
|
||||
|
|
@ -20,13 +21,26 @@ namespace Crafter {
|
|||
char value[N];
|
||||
};
|
||||
|
||||
export template <StringLiteral path, StringLiteral entrypoint, VkShaderStageFlagBits stage>
|
||||
export struct DescriptorBinding {
|
||||
VkDescriptorType type;
|
||||
std::uint32_t slot;
|
||||
};
|
||||
|
||||
export template <
|
||||
StringLiteral path,
|
||||
StringLiteral entrypoint,
|
||||
VkShaderStageFlagBits stage,
|
||||
std::uint32_t DescriptorCount,
|
||||
std::array<DescriptorBinding, DescriptorCount> Descriptors
|
||||
>
|
||||
class VulkanShader {
|
||||
public:
|
||||
inline static VkShaderModule shader;
|
||||
constexpr static StringLiteral _entrypoint = entrypoint;
|
||||
constexpr static VkShaderStageFlagBits _stage = stage;
|
||||
static void CreateShader() {
|
||||
inline static VkShaderModule shader;
|
||||
constexpr static std::uint32_t descriptorCount = DescriptorCount;
|
||||
constexpr static std::array<DescriptorBinding, DescriptorCount> descriptors = Descriptors;
|
||||
constexpr static StringLiteral _entrypoint = entrypoint;
|
||||
constexpr static VkShaderStageFlagBits _stage = stage;
|
||||
static void CreateShader() {
|
||||
std::ifstream file(path.value, std::ios::binary);
|
||||
if (!file) {
|
||||
std::cerr << "Error: Could not open file " << path.value << std::endl;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue