working mesh shader
This commit is contained in:
parent
97ca634108
commit
27ba32cdf5
11 changed files with 175 additions and 30 deletions
15
Crafter.Graphics-VulkanElement.cpp
Normal file
15
Crafter.Graphics-VulkanElement.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
module Crafter.Graphics;
|
||||||
|
using namespace Crafter;
|
||||||
|
|
||||||
|
VulkanElement::VulkanElement(VkPipelineLayout pipelineLayout, VkDescriptorSet* descriptorSet, VkPipeline pipeline) : pipelineLayout(pipelineLayout), descriptorSet(descriptorSet), pipeline(pipeline) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VulkanElement::VulkanElement(VkPipelineLayout pipelineLayout, VkDescriptorSet* descriptorSet, VkPipeline pipeline, std::uint32_t sizeX, std::uint32_t sizeY, std::uint32_t sizeZ) : pipelineLayout(pipelineLayout), descriptorSet(descriptorSet), pipeline(pipeline), sizeX(sizeX), sizeY(sizeY), sizeZ(sizeZ) {
|
||||||
|
|
||||||
|
}
|
||||||
31
Crafter.Graphics-VulkanElement.cppm
Normal file
31
Crafter.Graphics-VulkanElement.cppm
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
export module Crafter.Graphics:VulkanElement;
|
||||||
|
import Crafter.Component;
|
||||||
|
|
||||||
|
namespace Crafter {
|
||||||
|
export class VulkanElement : public Component {
|
||||||
|
public:
|
||||||
|
VkPipelineLayout pipelineLayout;
|
||||||
|
VkDescriptorSet* descriptorSet;
|
||||||
|
VkPipeline pipeline;
|
||||||
|
std::uint32_t sizeX;
|
||||||
|
std::uint32_t sizeY;
|
||||||
|
std::uint32_t sizeZ;
|
||||||
|
VulkanElement(VkPipelineLayout pipelineLayout, VkDescriptorSet* descriptorSet, VkPipeline pipeline);
|
||||||
|
VulkanElement(VkPipelineLayout pipelineLayout, VkDescriptorSet* descriptorSet, VkPipeline pipeline, std::uint32_t sizeX, std::uint32_t sizeY, std::uint32_t sizeZ);
|
||||||
|
|
||||||
|
template<typename Pipeline>
|
||||||
|
static VulkanElement FromPipeline() {
|
||||||
|
return VulkanElement(Pipeline::pipelineLayout, &Pipeline::descriptorSet, Pipeline::pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Pipeline>
|
||||||
|
static VulkanElement FromPipeline(std::uint32_t sizeX, std::uint32_t sizeY, std::uint32_t sizeZ) {
|
||||||
|
return VulkanElement(Pipeline::pipelineLayout, &Pipeline::descriptorSet, Pipeline::pipeline, sizeX, sizeY, sizeZ);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ module;
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
#include "VulkanBuffer.h"
|
#include "VulkanBuffer.h"
|
||||||
#include "camera.hpp"
|
#include "camera.hpp"
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
export module Crafter.Graphics:VulkanPipeline;
|
export module Crafter.Graphics:VulkanPipeline;
|
||||||
import :VulkanDevice;
|
import :VulkanDevice;
|
||||||
|
|
@ -20,8 +21,88 @@ import :VulkanShader;
|
||||||
import :WindowWaylandVulkan;
|
import :WindowWaylandVulkan;
|
||||||
|
|
||||||
namespace Crafter {
|
namespace Crafter {
|
||||||
|
struct DescriptorEntry {
|
||||||
|
VkDescriptorType type;
|
||||||
|
std::uint32_t occurrences = 0;
|
||||||
|
};
|
||||||
|
|
||||||
export template <typename MeshShader, typename FragmentShader>
|
export template <typename MeshShader, typename FragmentShader>
|
||||||
class VulkanPipeline {
|
class VulkanPipeline {
|
||||||
|
private:
|
||||||
|
constexpr static std::uint32_t totalDescriptorCount = MeshShader::descriptorCount+FragmentShader::descriptorCount;
|
||||||
|
consteval static std::uint32_t GetUniqueDiscriptorCount() {
|
||||||
|
DescriptorEntry types[] = {{VK_DESCRIPTOR_TYPE_SAMPLER, 0},{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 0},{VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 0},{VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 0},{VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 0},{VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 0},{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0},{VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 0},{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 0},{VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 0},{VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 0},{VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK, 0},{VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 0},{VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV, 0},{VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM, 0},{VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM, 0},{VK_DESCRIPTOR_TYPE_MUTABLE_EXT, 0},{VK_DESCRIPTOR_TYPE_PARTITIONED_ACCELERATION_STRUCTURE_NV, 0},{VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT, 0},{VK_DESCRIPTOR_TYPE_MUTABLE_VALVE, 0}};
|
||||||
|
|
||||||
|
for(const DescriptorBinding& binding : MeshShader::descriptors) {
|
||||||
|
for(DescriptorEntry& type : types) {
|
||||||
|
if(type.type == binding.type) {
|
||||||
|
type.occurrences++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const DescriptorBinding& binding : FragmentShader::descriptors) {
|
||||||
|
for(DescriptorEntry& type : types) {
|
||||||
|
if(type.type == binding.type) {
|
||||||
|
type.occurrences++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint32_t size = 0;
|
||||||
|
for(DescriptorEntry& type : types) {
|
||||||
|
size+=type.occurrences;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
constexpr static std::uint32_t uniqueDescriptorCount = GetUniqueDiscriptorCount();
|
||||||
|
consteval static std::array<VkDescriptorPoolSize, uniqueDescriptorCount> GetPoolSizes() {
|
||||||
|
std::array<VkDescriptorPoolSize, uniqueDescriptorCount> types = {};
|
||||||
|
std::uint32_t i = 0;
|
||||||
|
|
||||||
|
for(const DescriptorBinding& binding : MeshShader::descriptors) {
|
||||||
|
for(VkDescriptorPoolSize& type : types) {
|
||||||
|
if(type.type == binding.type) {
|
||||||
|
type.descriptorCount++;
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types[i].type = binding.type;
|
||||||
|
types[i].descriptorCount = 1;
|
||||||
|
next:;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const DescriptorBinding& binding : FragmentShader::descriptors) {
|
||||||
|
for(VkDescriptorPoolSize& type : types) {
|
||||||
|
if(type.type == binding.type) {
|
||||||
|
type.descriptorCount++;
|
||||||
|
goto next2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types[i].type = binding.type;
|
||||||
|
types[i].descriptorCount = 1;
|
||||||
|
next2:;
|
||||||
|
}
|
||||||
|
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
consteval static std::array<VkDescriptorSetLayoutBinding, totalDescriptorCount> GetDescriptorSet() {
|
||||||
|
std::array<VkDescriptorSetLayoutBinding, totalDescriptorCount> set;
|
||||||
|
|
||||||
|
std::uint32_t i = 0;
|
||||||
|
for(const DescriptorBinding& binding : MeshShader::descriptors) {
|
||||||
|
set[i] = {binding.slot, binding.type, 1, VK_SHADER_STAGE_MESH_BIT_EXT, nullptr};
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const DescriptorBinding& binding : FragmentShader::descriptors) {
|
||||||
|
set[i] = {binding.slot, binding.type, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr};
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
inline static VkPipeline pipeline;
|
inline static VkPipeline pipeline;
|
||||||
inline static VkPipelineLayout pipelineLayout;
|
inline static VkPipelineLayout pipelineLayout;
|
||||||
|
|
@ -51,34 +132,31 @@ namespace Crafter {
|
||||||
memcpy(uniformBuffer.mapped, &uniformData, sizeof(UniformData));
|
memcpy(uniformBuffer.mapped, &uniformData, sizeof(UniformData));
|
||||||
|
|
||||||
// Pool
|
// Pool
|
||||||
std::vector<VkDescriptorPoolSize> poolSizes = {
|
std::array<VkDescriptorPoolSize, uniqueDescriptorCount> poolSizes = GetPoolSizes();
|
||||||
vks::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1),
|
VkDescriptorPoolCreateInfo descriptorPoolInfo = vks::initializers::descriptorPoolCreateInfo(uniqueDescriptorCount, poolSizes.data(), 1);
|
||||||
};
|
|
||||||
VkDescriptorPoolCreateInfo descriptorPoolInfo = vks::initializers::descriptorPoolCreateInfo(static_cast<uint32_t>(poolSizes.size()), poolSizes.data(), 1);
|
|
||||||
VulkanDevice::CHECK_VK_RESULT(vkCreateDescriptorPool(VulkanDevice::device, &descriptorPoolInfo, nullptr, &descriptorPool));
|
VulkanDevice::CHECK_VK_RESULT(vkCreateDescriptorPool(VulkanDevice::device, &descriptorPoolInfo, nullptr, &descriptorPool));
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
|
constexpr std::array<VkDescriptorSetLayoutBinding, totalDescriptorCount> setLayoutBindings = GetDescriptorSet();
|
||||||
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_MESH_BIT_EXT, 0),
|
VkDescriptorSetLayoutCreateInfo descriptorLayoutInfo = vks::initializers::descriptorSetLayoutCreateInfo(setLayoutBindings.data(), totalDescriptorCount);
|
||||||
};
|
|
||||||
VkDescriptorSetLayoutCreateInfo descriptorLayoutInfo = vks::initializers::descriptorSetLayoutCreateInfo(setLayoutBindings);
|
|
||||||
VulkanDevice::CHECK_VK_RESULT(vkCreateDescriptorSetLayout(VulkanDevice::device, &descriptorLayoutInfo, nullptr, &descriptorSetLayout));
|
VulkanDevice::CHECK_VK_RESULT(vkCreateDescriptorSetLayout(VulkanDevice::device, &descriptorLayoutInfo, nullptr, &descriptorSetLayout));
|
||||||
|
|
||||||
// Set
|
// Set
|
||||||
VkDescriptorSetAllocateInfo allocInfo = vks::initializers::descriptorSetAllocateInfo(descriptorPool, &descriptorSetLayout, 1);
|
VkDescriptorSetAllocateInfo allocInfo = vks::initializers::descriptorSetAllocateInfo(descriptorPool, &descriptorSetLayout, 1);
|
||||||
VulkanDevice::CHECK_VK_RESULT(vkAllocateDescriptorSets(VulkanDevice::device, &allocInfo, &descriptorSet));
|
VulkanDevice::CHECK_VK_RESULT(vkAllocateDescriptorSets(VulkanDevice::device, &allocInfo, &descriptorSet));
|
||||||
|
|
||||||
std::vector<VkWriteDescriptorSet> modelWriteDescriptorSets = {
|
std::vector<VkWriteDescriptorSet> modelWriteDescriptorSets = {
|
||||||
vks::initializers::writeDescriptorSet(descriptorSet, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, &uniformBuffer.descriptor),
|
vks::initializers::writeDescriptorSet(descriptorSet, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, &uniformBuffer.descriptor),
|
||||||
};
|
};
|
||||||
|
|
||||||
vkUpdateDescriptorSets(VulkanDevice::device, static_cast<uint32_t>(modelWriteDescriptorSets.size()), modelWriteDescriptorSets.data(), 0, nullptr);
|
vkUpdateDescriptorSets(VulkanDevice::device, static_cast<uint32_t>(modelWriteDescriptorSets.size()), modelWriteDescriptorSets.data(), 0, nullptr);
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
VkPipelineLayoutCreateInfo pipelineLayoutInfo = vks::initializers::pipelineLayoutCreateInfo(&descriptorSetLayout, 1);
|
VkPipelineLayoutCreateInfo pipelineLayoutInfo = vks::initializers::pipelineLayoutCreateInfo(&descriptorSetLayout, 1);
|
||||||
VulkanDevice::CHECK_VK_RESULT(vkCreatePipelineLayout(VulkanDevice::device, &pipelineLayoutInfo, nullptr, &pipelineLayout));
|
VulkanDevice::CHECK_VK_RESULT(vkCreatePipelineLayout(VulkanDevice::device, &pipelineLayoutInfo, nullptr, &pipelineLayout));
|
||||||
|
|
||||||
// Pipeline
|
// Pipeline
|
||||||
VkPipelineInputAssemblyStateCreateInfo inputAssemblyState = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
|
VkPipelineInputAssemblyStateCreateInfo inputAssemblyState = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
|
||||||
VkPipelineRasterizationStateCreateInfo rasterizationState = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_NONE, VK_FRONT_FACE_CLOCKWISE, 0);
|
VkPipelineRasterizationStateCreateInfo rasterizationState = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
|
||||||
VkPipelineColorBlendAttachmentState blendAttachmentState = vks::initializers::pipelineColorBlendAttachmentState(0xf, VK_FALSE);
|
VkPipelineColorBlendAttachmentState blendAttachmentState = vks::initializers::pipelineColorBlendAttachmentState(0xf, VK_FALSE);
|
||||||
VkPipelineColorBlendStateCreateInfo colorBlendState = vks::initializers::pipelineColorBlendStateCreateInfo(1, &blendAttachmentState);
|
VkPipelineColorBlendStateCreateInfo colorBlendState = vks::initializers::pipelineColorBlendStateCreateInfo(1, &blendAttachmentState);
|
||||||
VkPipelineDepthStencilStateCreateInfo depthStencilState = vks::initializers::pipelineDepthStencilStateCreateInfo(VK_TRUE, VK_TRUE, VK_COMPARE_OP_LESS_OR_EQUAL);
|
VkPipelineDepthStencilStateCreateInfo depthStencilState = vks::initializers::pipelineDepthStencilStateCreateInfo(VK_TRUE, VK_TRUE, VK_COMPARE_OP_LESS_OR_EQUAL);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ module;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
export module Crafter.Graphics:VulkanShader;
|
export module Crafter.Graphics:VulkanShader;
|
||||||
import :VulkanDevice;
|
import :VulkanDevice;
|
||||||
|
|
@ -20,10 +21,23 @@ namespace Crafter {
|
||||||
char value[N];
|
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 {
|
class VulkanShader {
|
||||||
public:
|
public:
|
||||||
inline static VkShaderModule shader;
|
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 StringLiteral _entrypoint = entrypoint;
|
||||||
constexpr static VkShaderStageFlagBits _stage = stage;
|
constexpr static VkShaderStageFlagBits _stage = stage;
|
||||||
static void CreateShader() {
|
static void CreateShader() {
|
||||||
|
|
|
||||||
|
|
@ -418,14 +418,12 @@ void WindowWaylandVulkan::Start() {
|
||||||
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
||||||
|
|
||||||
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, VulkanPipeline<VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT>, VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT>>::pipelineLayout, 0, 1, &VulkanPipeline<VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT>, VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT>>::descriptorSet, 0, NULL);
|
for(VulkanElement* element : vulkanElements.components) {
|
||||||
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, element->pipelineLayout, 0, 1, element->descriptorSet, 0, NULL);
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, VulkanPipeline<VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT>, VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT>>::pipeline);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, element->pipeline);
|
||||||
|
VulkanDevice::vkCmdDrawMeshTasksEXTProc(drawCmdBuffers[i], element->sizeX, element->sizeY, element->sizeZ);
|
||||||
// Use mesh and task shader to draw the scene
|
|
||||||
VulkanDevice::vkCmdDrawMeshTasksEXTProc(drawCmdBuffers[i], 3, 1, 1);
|
|
||||||
|
|
||||||
VulkanDevice::vkCmdEndRenderingKHRProc(drawCmdBuffers[i]);
|
VulkanDevice::vkCmdEndRenderingKHRProc(drawCmdBuffers[i]);
|
||||||
|
}
|
||||||
|
|
||||||
image_layout_transition(drawCmdBuffers[i],
|
image_layout_transition(drawCmdBuffers[i],
|
||||||
images[i],
|
images[i],
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ module;
|
||||||
export module Crafter.Graphics:WindowWaylandVulkan;
|
export module Crafter.Graphics:WindowWaylandVulkan;
|
||||||
import Crafter.Event;
|
import Crafter.Event;
|
||||||
import :WindowWayland;
|
import :WindowWayland;
|
||||||
|
import :VulkanElement;
|
||||||
import Crafter.Component;
|
import Crafter.Component;
|
||||||
|
|
||||||
namespace Crafter {
|
namespace Crafter {
|
||||||
|
|
@ -28,6 +29,7 @@ namespace Crafter {
|
||||||
|
|
||||||
export class WindowWaylandVulkan : public WindowWayland {
|
export class WindowWaylandVulkan : public WindowWayland {
|
||||||
public:
|
public:
|
||||||
|
ComponentRefVector<VulkanElement> vulkanElements;
|
||||||
WindowWaylandVulkan(std::string name, std::uint32_t width, std::uint32_t height);
|
WindowWaylandVulkan(std::string name, std::uint32_t width, std::uint32_t height);
|
||||||
~WindowWaylandVulkan();
|
~WindowWaylandVulkan();
|
||||||
void Start();
|
void Start();
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,4 @@ export import :Types;
|
||||||
export import :VulkanDevice;
|
export import :VulkanDevice;
|
||||||
export import :VulkanPipeline;
|
export import :VulkanPipeline;
|
||||||
export import :VulkanShader;
|
export import :VulkanShader;
|
||||||
|
export import :VulkanElement;
|
||||||
14
main.cpp
14
main.cpp
|
|
@ -5,6 +5,10 @@
|
||||||
import Crafter.Graphics;
|
import Crafter.Graphics;
|
||||||
using namespace Crafter;
|
using namespace Crafter;
|
||||||
|
|
||||||
|
typedef VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT, 1, {{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0}}> MeshShader;
|
||||||
|
typedef VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT, 0, {}> FragmentShader;
|
||||||
|
typedef VulkanPipeline<VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT, 1, {{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0}}>, VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT, 0, {}>> Pipeline;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
// WindowWaylandWayland window("test", 128, 128);
|
// WindowWaylandWayland window("test", 128, 128);
|
||||||
// UiElement test(
|
// UiElement test(
|
||||||
|
|
@ -28,10 +32,12 @@ int main() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
VulkanDevice::CreateDevice();
|
VulkanDevice::CreateDevice();
|
||||||
WindowWaylandVulkan window("bruh", 128, 128);
|
WindowWaylandVulkan window("Crafter.Graphics", 128, 128);
|
||||||
VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT>::CreateShader();
|
MeshShader::CreateShader();
|
||||||
VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT>::CreateShader();
|
FragmentShader::CreateShader();
|
||||||
VulkanPipeline<VulkanShader<"test.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT>, VulkanShader<"test2.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT>>::CreatePipeline();
|
Pipeline::CreatePipeline();
|
||||||
|
VulkanElement test = VulkanElement::FromPipeline<Pipeline>(3, 1, 1);
|
||||||
|
window.vulkanElements.AddComponent(&test);
|
||||||
window.Start();
|
window.Start();
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
{
|
{
|
||||||
"name": "base",
|
"name": "base",
|
||||||
"standard": "c++26",
|
"standard": "c++26",
|
||||||
"source_files": ["Crafter.Graphics-Window","Crafter.Graphics-WindowWayland","Crafter.Graphics-WindowWaylandWayland", "Crafter.Graphics-UiElement", "Crafter.Graphics-VulkanDevice", "Crafter.Graphics-WindowWaylandVulkan", "VulkanBuffer", "VulkanTools"],
|
"source_files": ["Crafter.Graphics-Window","Crafter.Graphics-WindowWayland","Crafter.Graphics-WindowWaylandWayland", "Crafter.Graphics-UiElement", "Crafter.Graphics-VulkanDevice", "Crafter.Graphics-WindowWaylandVulkan", "VulkanBuffer", "VulkanTools", "Crafter.Graphics-VulkanElement"],
|
||||||
"c_files": ["wayland-xdg-decoration-unstable-v1-client-protocol", "xdg-shell-protocol", "shm"],
|
"c_files": ["wayland-xdg-decoration-unstable-v1-client-protocol", "xdg-shell-protocol", "shm"],
|
||||||
"module_files": ["Crafter.Graphics-Window","Crafter.Graphics-WindowWayland","Crafter.Graphics-WindowWaylandWayland", "Crafter.Graphics", "Crafter.Graphics-UiElement", "Crafter.Graphics-Types", "Crafter.Graphics-VulkanDevice", "Crafter.Graphics-VulkanPipeline", "Crafter.Graphics-VulkanShader", "Crafter.Graphics-WindowWaylandVulkan"],
|
"module_files": ["Crafter.Graphics-Window","Crafter.Graphics-WindowWayland","Crafter.Graphics-WindowWaylandWayland", "Crafter.Graphics", "Crafter.Graphics-UiElement", "Crafter.Graphics-Types", "Crafter.Graphics-VulkanDevice", "Crafter.Graphics-VulkanPipeline", "Crafter.Graphics-VulkanShader", "Crafter.Graphics-WindowWaylandVulkan", "Crafter.Graphics-VulkanElement"],
|
||||||
"build_dir": "./build",
|
"build_dir": "./build",
|
||||||
"output_dir": "./bin",
|
"output_dir": "./bin",
|
||||||
"type":"library",
|
"type":"library",
|
||||||
|
|
|
||||||
BIN
test.spirv
BIN
test.spirv
Binary file not shown.
BIN
test2.spirv
BIN
test2.spirv
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue