Skip to content

Commit

Permalink
[WIP] Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmNotHanni committed Jul 12, 2024
1 parent 7613930 commit 8832357
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 615 deletions.
4 changes: 2 additions & 2 deletions include/inexor/vulkan-renderer/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Application {
std::shared_ptr<render_graph::Buffer> m_index_buffer;
std::shared_ptr<render_graph::Buffer> m_vertex_buffer;
std::shared_ptr<render_graph::Buffer> m_uniform_buffer;
std::shared_ptr<render_graph::Shader> m_octree_vert;
std::shared_ptr<render_graph::Shader> m_octree_frag;
std::shared_ptr<wrapper::Shader> m_octree_vert;
std::shared_ptr<wrapper::Shader> m_octree_frag;

VkDescriptorSetLayout m_descriptor_set_layout{VK_NULL_HANDLE};
VkDescriptorSet m_descriptor_set{VK_NULL_HANDLE};
Expand Down
243 changes: 0 additions & 243 deletions include/inexor/vulkan-renderer/render-graph/pipeline_builder.hpp

This file was deleted.

19 changes: 0 additions & 19 deletions include/inexor/vulkan-renderer/render-graph/render_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "inexor/vulkan-renderer/render-graph/buffer.hpp"
#include "inexor/vulkan-renderer/render-graph/graphics_pass.hpp"
#include "inexor/vulkan-renderer/render-graph/graphics_pass_builder.hpp"
#include "inexor/vulkan-renderer/render-graph/shader.hpp"
#include "inexor/vulkan-renderer/render-graph/texture.hpp"
#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor_set_allocator.hpp"
#include "inexor/vulkan-renderer/wrapper/descriptors/descriptor_set_layout_builder.hpp"
Expand Down Expand Up @@ -118,12 +117,6 @@ class RenderGraph {
// Note that we must keep the data as std::vector of std::unique_ptr in order to keep entries consistent
std::vector<std::shared_ptr<Buffer>> m_buffers;

// TODO: Shaders should not be in rendergraph! They should be part of the renderer which uses them!
// ---------------------------------------------------------------------------------------------------------
// SHADERS
// ---------------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<Shader>> m_shaders;

// ---------------------------------------------------------------------------------------------------------
// TEXTURES
// ---------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -218,18 +211,6 @@ class RenderGraph {
[[nodiscard]] std::shared_ptr<Buffer>
add_buffer(std::string buffer_name, BufferType buffer_type, std::function<void()> on_update);

// TODO: Use a SPIR-V library like spirv-cross to deduce shader type from the SPIR-V file automatically!
// TODO: Shaders should not be part of rendergraph!

/// Load a SPIR-V shader from a file
/// @param name The internal debug name of the shader (not the file name)
/// @param shader_stage The shader stage
/// @param file_name The shader file name
/// @note We do not check if ``file_name`` is empty because this is done in the Shader wrapper
/// @return A shared pointer to the shader that was loaded from the SPIR-V file
[[nodiscard]] std::shared_ptr<Shader>
add_shader(std::string shader_name, VkShaderStageFlagBits shader_stage, std::string file_name);

/// Add a texture which will be initialized inside of rendergraph (not outside of it)
/// @param texture_name The name of the texture
/// @param usage
Expand Down
4 changes: 2 additions & 2 deletions include/inexor/vulkan-renderer/renderers/imgui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class ImGuiRenderer {
std::shared_ptr<render_graph::Buffer> m_index_buffer;
std::shared_ptr<render_graph::Buffer> m_vertex_buffer;
std::shared_ptr<render_graph::Texture> m_imgui_texture;
std::shared_ptr<render_graph::Shader> m_vertex_shader;
std::shared_ptr<render_graph::Shader> m_fragment_shader;
std::shared_ptr<wrapper::Shader> m_vertex_shader;
std::shared_ptr<wrapper::Shader> m_fragment_shader;
std::shared_ptr<wrapper::pipelines::GraphicsPipeline> m_imgui_pipeline;
std::shared_ptr<render_graph::GraphicsPass> m_imgui_pass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <vulkan/vulkan_core.h>

#include "inexor/vulkan-renderer/render-graph/shader.hpp"
#include "inexor/vulkan-renderer/wrapper/make_info.hpp"
#include "inexor/vulkan-renderer/wrapper/pipelines/pipeline.hpp"
#include "inexor/vulkan-renderer/wrapper/shader.hpp"

#include <spdlog/spdlog.h>

Expand Down Expand Up @@ -122,10 +122,10 @@ class GraphicsPipelineBuilder {
/// Add a shader to the graphics pipeline
/// @param shader The shader
/// @return A reference to the dereferenced this pointer (allows method calls to be chained)
[[nodiscard]] auto &uses_shader(std::shared_ptr<render_graph::Shader> shader) {
[[nodiscard]] auto &uses_shader(std::weak_ptr<wrapper::Shader> shader) {
m_shader_stages.push_back(make_info<VkPipelineShaderStageCreateInfo>({
.stage = shader->m_shader_stage,
.module = shader->m_shader_module,
.stage = shader.lock()->m_shader_stage,
.module = shader.lock()->m_shader_module,
.pName = "main",

}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace inexor::vulkan_renderer::wrapper::pipelines {
class GraphicsPipelineBuilder;
} // namespace inexor::vulkan_renderer::wrapper::pipelines

namespace inexor::vulkan_renderer::render_graph {
namespace inexor::vulkan_renderer::wrapper {

// Forward declaration
class RenderGraph;
Expand All @@ -26,8 +26,6 @@ class RenderGraph;
using inexor::vulkan_renderer::wrapper::Device;
using inexor::vulkan_renderer::wrapper::pipelines::GraphicsPipelineBuilder;

// TODO: This should not be in rendergraph!

/// RAII wrapper class for VkShaderModule
class Shader {
private:
Expand Down Expand Up @@ -60,4 +58,4 @@ class Shader {
Shader &operator=(Shader &&) = delete;
};

} // namespace inexor::vulkan_renderer::render_graph
} // namespace inexor::vulkan_renderer::wrapper
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ set(INEXOR_SOURCE_FILES
vulkan-renderer/render-graph/graphics_pass.cpp
vulkan-renderer/render-graph/graphics_pass_builder.cpp
vulkan-renderer/render-graph/render_graph.cpp
vulkan-renderer/render-graph/shader.cpp
vulkan-renderer/render-graph/texture.cpp

vulkan-renderer/tools/cla_parser.cpp
Expand All @@ -30,6 +29,7 @@ set(INEXOR_SOURCE_FILES
vulkan-renderer/wrapper/instance.cpp
vulkan-renderer/wrapper/make_info.cpp
vulkan-renderer/wrapper/sampler.cpp
vulkan-renderer/wrapper/shader.cpp
vulkan-renderer/wrapper/swapchain.cpp
vulkan-renderer/wrapper/window.cpp
vulkan-renderer/wrapper/window_surface.cpp
Expand Down
Loading

0 comments on commit 8832357

Please sign in to comment.