|
@@ -2,8 +2,6 @@
|
|
|
|
|
|
#include "Graphics.h"
|
|
#include "Graphics.h"
|
|
|
|
|
|
-#include <shaderc/shaderc.hpp>
|
|
|
|
-
|
|
|
|
#include <iostream>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <fstream>
|
|
|
|
|
|
@@ -11,28 +9,12 @@
|
|
namespace love {
|
|
namespace love {
|
|
namespace graphics {
|
|
namespace graphics {
|
|
namespace vulkan {
|
|
namespace vulkan {
|
|
- static shaderc_shader_kind getShaderStage(ShaderStageType stage) {
|
|
|
|
- switch (stage) {
|
|
|
|
- case SHADERSTAGE_VERTEX: return shaderc_vertex_shader;
|
|
|
|
- case SHADERSTAGE_PIXEL: return shaderc_fragment_shader;
|
|
|
|
- case SHADERSTAGE_COMPUTE: return shaderc_compute_shader;
|
|
|
|
- default:
|
|
|
|
- throw love::Exception("unknown exception");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
ShaderStage::ShaderStage(love::graphics::Graphics* gfx, ShaderStageType stage, const std::string& glsl, bool gles, const std::string& cachekey)
|
|
ShaderStage::ShaderStage(love::graphics::Graphics* gfx, ShaderStageType stage, const std::string& glsl, bool gles, const std::string& cachekey)
|
|
: love::graphics::ShaderStage(gfx, stage, glsl, gles, cachekey) {
|
|
: love::graphics::ShaderStage(gfx, stage, glsl, gles, cachekey) {
|
|
- using namespace shaderc;
|
|
|
|
-
|
|
|
|
- Compiler compiler{};
|
|
|
|
- auto result = compiler.CompileGlslToSpv(glsl, shaderc_vertex_shader, "shader.glsl");
|
|
|
|
- std::vector<uint32_t> code(result.begin(), result.end());
|
|
|
|
-
|
|
|
|
VkShaderModuleCreateInfo createInfo{};
|
|
VkShaderModuleCreateInfo createInfo{};
|
|
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
|
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
|
- createInfo.codeSize = code.size() * sizeof(unsigned int);
|
|
|
|
- createInfo.pCode = reinterpret_cast<const uint32_t*>(code.data());
|
|
|
|
|
|
+ createInfo.codeSize = 0;
|
|
|
|
+ createInfo.pCode = nullptr;
|
|
|
|
|
|
Graphics* vkGfx = (Graphics*)gfx;
|
|
Graphics* vkGfx = (Graphics*)gfx;
|
|
device = vkGfx->getDevice();
|
|
device = vkGfx->getDevice();
|