1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-25 21:27:45 +00:00

Move getShaderModuleResources to ShaderManager

This commit is contained in:
Joshua Goins 2024-05-10 16:16:21 -04:00
parent 1aa7c8c6ee
commit a812b37413
4 changed files with 18 additions and 17 deletions

View file

@ -64,7 +64,6 @@ private:
physis_Shader &vertexShader,
physis_Shader &pixelShader,
std::string_view shaderName);
spirv_cross::CompilerGLSL getShaderModuleResources(const physis_Shader &shader);
void createImageResources();

View file

@ -8,6 +8,7 @@
#include <glslang/Public/ShaderLang.h>
#include <spirv.hpp>
#include <spirv_glsl.hpp>
#include <vulkan/vulkan.h>
struct physis_Shader;
@ -18,6 +19,7 @@ class ShaderManager
public:
explicit ShaderManager(Device &device);
spirv_cross::CompilerGLSL getShaderModuleResources(const physis_Shader &shader);
VkShaderModule convertShaderModule(const physis_Shader &shader, spv::ExecutionModel executionModel);
private:

View file

@ -842,10 +842,10 @@ GameRenderer::CachedPipeline &GameRenderer::bindPipeline(VkCommandBuffer command
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 fragment_glsl = getShaderModuleResources(pixelShader);
auto fragment_glsl = m_shaderManager.getShaderModuleResources(pixelShader);
auto fragment_resources = fragment_glsl.get_shader_resources();
std::vector<RequestedSet> requestedSets;
@ -1131,20 +1131,6 @@ GameRenderer::CachedPipeline &GameRenderer::bindPipeline(VkCommandBuffer command
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
GameRenderer::createDescriptorFor(const DrawObject *object, const CachedPipeline &pipeline, int i, const RenderMaterial *material, std::string_view pass)
{

View file

@ -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)
{
dxvk::DxbcReader reader(reinterpret_cast<const char *>(shader.bytecode), shader.len);