mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Vulcan Nightmare
Experimentally bringing up vulcan support
This commit is contained in:
parent
863a786c48
commit
83b576e8d9
189 changed files with 12147 additions and 7820 deletions
45
include/rendering/vk_shader.hpp
Normal file
45
include/rendering/vk_shader.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace rendering {
|
||||
|
||||
class VkShaderModule {
|
||||
public:
|
||||
VkShaderModule() = default;
|
||||
~VkShaderModule();
|
||||
|
||||
VkShaderModule(const VkShaderModule&) = delete;
|
||||
VkShaderModule& operator=(const VkShaderModule&) = delete;
|
||||
VkShaderModule(VkShaderModule&& other) noexcept;
|
||||
VkShaderModule& operator=(VkShaderModule&& other) noexcept;
|
||||
|
||||
// Load a SPIR-V file from disk
|
||||
bool loadFromFile(VkDevice device, const std::string& path);
|
||||
|
||||
// Load from raw SPIR-V bytes
|
||||
bool loadFromMemory(VkDevice device, const uint32_t* code, size_t sizeBytes);
|
||||
|
||||
void destroy();
|
||||
|
||||
::VkShaderModule getModule() const { return module_; }
|
||||
bool isValid() const { return module_ != VK_NULL_HANDLE; }
|
||||
|
||||
// Create a VkPipelineShaderStageCreateInfo for this module
|
||||
VkPipelineShaderStageCreateInfo stageInfo(VkShaderStageFlagBits stage,
|
||||
const char* entryPoint = "main") const;
|
||||
|
||||
private:
|
||||
VkDevice device_ = VK_NULL_HANDLE;
|
||||
::VkShaderModule module_ = VK_NULL_HANDLE;
|
||||
};
|
||||
|
||||
// Convenience: load a shader stage directly from a .spv file
|
||||
VkPipelineShaderStageCreateInfo loadShaderStage(VkDevice device,
|
||||
const std::string& path, VkShaderStageFlagBits stage);
|
||||
|
||||
} // namespace rendering
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue