mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-29 06:57:46 +00:00
Move getShaderModuleResources to ShaderManager
This commit is contained in:
parent
1aa7c8c6ee
commit
a812b37413
4 changed files with 18 additions and 17 deletions
|
@ -64,7 +64,6 @@ private:
|
||||||
physis_Shader &vertexShader,
|
physis_Shader &vertexShader,
|
||||||
physis_Shader &pixelShader,
|
physis_Shader &pixelShader,
|
||||||
std::string_view shaderName);
|
std::string_view shaderName);
|
||||||
spirv_cross::CompilerGLSL getShaderModuleResources(const physis_Shader &shader);
|
|
||||||
|
|
||||||
void createImageResources();
|
void createImageResources();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <glslang/Public/ShaderLang.h>
|
#include <glslang/Public/ShaderLang.h>
|
||||||
#include <spirv.hpp>
|
#include <spirv.hpp>
|
||||||
|
#include <spirv_glsl.hpp>
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
struct physis_Shader;
|
struct physis_Shader;
|
||||||
|
@ -18,6 +19,7 @@ class ShaderManager
|
||||||
public:
|
public:
|
||||||
explicit ShaderManager(Device &device);
|
explicit ShaderManager(Device &device);
|
||||||
|
|
||||||
|
spirv_cross::CompilerGLSL getShaderModuleResources(const physis_Shader &shader);
|
||||||
VkShaderModule convertShaderModule(const physis_Shader &shader, spv::ExecutionModel executionModel);
|
VkShaderModule convertShaderModule(const physis_Shader &shader, spv::ExecutionModel executionModel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -842,10 +842,10 @@ GameRenderer::CachedPipeline &GameRenderer::bindPipeline(VkCommandBuffer command
|
||||||
binding.stride = sizeof(glm::vec4);
|
binding.stride = sizeof(glm::vec4);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vertex_glsl = getShaderModuleResources(vertexShader);
|
auto vertex_glsl = m_shaderManager.getShaderModuleResources(vertexShader);
|
||||||
auto vertex_resources = vertex_glsl.get_shader_resources();
|
auto vertex_resources = vertex_glsl.get_shader_resources();
|
||||||
|
|
||||||
auto fragment_glsl = getShaderModuleResources(pixelShader);
|
auto fragment_glsl = m_shaderManager.getShaderModuleResources(pixelShader);
|
||||||
auto fragment_resources = fragment_glsl.get_shader_resources();
|
auto fragment_resources = fragment_glsl.get_shader_resources();
|
||||||
|
|
||||||
std::vector<RequestedSet> requestedSets;
|
std::vector<RequestedSet> requestedSets;
|
||||||
|
@ -1131,20 +1131,6 @@ GameRenderer::CachedPipeline &GameRenderer::bindPipeline(VkCommandBuffer command
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
spirv_cross::CompilerGLSL GameRenderer::getShaderModuleResources(const physis_Shader &shader)
|
|
||||||
{
|
|
||||||
dxvk::DxbcReader reader(reinterpret_cast<const char *>(shader.bytecode), shader.len);
|
|
||||||
|
|
||||||
dxvk::DxbcModule module(reader);
|
|
||||||
|
|
||||||
dxvk::DxbcModuleInfo info;
|
|
||||||
auto result = module.compile(info, "test");
|
|
||||||
|
|
||||||
// glsl.build_combined_image_samplers();
|
|
||||||
|
|
||||||
return spirv_cross::CompilerGLSL(result.code.data(), result.code.dwords());
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorSet
|
VkDescriptorSet
|
||||||
GameRenderer::createDescriptorFor(const DrawObject *object, const CachedPipeline &pipeline, int i, const RenderMaterial *material, std::string_view pass)
|
GameRenderer::createDescriptorFor(const DrawObject *object, const CachedPipeline &pipeline, int i, const RenderMaterial *material, std::string_view pass)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,20 @@ ShaderManager::ShaderManager(Device &device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spirv_cross::CompilerGLSL ShaderManager::getShaderModuleResources(const physis_Shader &shader)
|
||||||
|
{
|
||||||
|
dxvk::DxbcReader reader(reinterpret_cast<const char *>(shader.bytecode), shader.len);
|
||||||
|
|
||||||
|
dxvk::DxbcModule module(reader);
|
||||||
|
|
||||||
|
dxvk::DxbcModuleInfo info;
|
||||||
|
auto result = module.compile(info, "test");
|
||||||
|
|
||||||
|
// glsl.build_combined_image_samplers();
|
||||||
|
|
||||||
|
return spirv_cross::CompilerGLSL(result.code.data(), result.code.dwords());
|
||||||
|
}
|
||||||
|
|
||||||
VkShaderModule ShaderManager::convertShaderModule(const physis_Shader &shader, spv::ExecutionModel executionModel)
|
VkShaderModule ShaderManager::convertShaderModule(const physis_Shader &shader, spv::ExecutionModel executionModel)
|
||||||
{
|
{
|
||||||
dxvk::DxbcReader reader(reinterpret_cast<const char *>(shader.bytecode), shader.len);
|
dxvk::DxbcReader reader(reinterpret_cast<const char *>(shader.bytecode), shader.len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue