Remove some old and unused render pipelines
This commit is contained in:
parent
833046aed0
commit
9ee41d01b6
2 changed files with 0 additions and 134 deletions
|
@ -15,10 +15,6 @@
|
||||||
#include "rendertarget.hpp"
|
#include "rendertarget.hpp"
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
|
|
||||||
namespace ui {
|
|
||||||
class Screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
class GFX;
|
class GFX;
|
||||||
class GFXBuffer;
|
class GFXBuffer;
|
||||||
class GFXCommandBuffer;
|
class GFXCommandBuffer;
|
||||||
|
@ -122,12 +118,8 @@ namespace prism {
|
||||||
|
|
||||||
void create_post_pipelines();
|
void create_post_pipelines();
|
||||||
|
|
||||||
void create_font_texture();
|
|
||||||
|
|
||||||
void create_sky_pipeline();
|
void create_sky_pipeline();
|
||||||
|
|
||||||
void create_ui_pipelines();
|
|
||||||
|
|
||||||
void generate_brdf();
|
void generate_brdf();
|
||||||
|
|
||||||
void create_histogram_resources();
|
void create_histogram_resources();
|
||||||
|
@ -136,28 +128,18 @@ namespace prism {
|
||||||
|
|
||||||
std::vector<RenderTarget*> render_targets;
|
std::vector<RenderTarget*> render_targets;
|
||||||
|
|
||||||
ui::Screen* current_screen = nullptr;
|
|
||||||
|
|
||||||
// sky
|
// sky
|
||||||
GFXPipeline* sky_pipeline = nullptr;
|
GFXPipeline* sky_pipeline = nullptr;
|
||||||
|
|
||||||
// post
|
// post
|
||||||
GFXPipeline* post_pipeline = nullptr;
|
GFXPipeline* post_pipeline = nullptr;
|
||||||
|
|
||||||
// font
|
|
||||||
GFXTexture* font_texture = nullptr;
|
|
||||||
GFXPipeline* text_pipeline, *world_text_pipeline = nullptr;
|
|
||||||
int instance_alignment = 0;
|
|
||||||
|
|
||||||
// brdf
|
// brdf
|
||||||
GFXPipeline* brdf_pipeline = nullptr;
|
GFXPipeline* brdf_pipeline = nullptr;
|
||||||
GFXTexture* brdf_texture = nullptr;
|
GFXTexture* brdf_texture = nullptr;
|
||||||
GFXFramebuffer* brdf_framebuffer = nullptr;
|
GFXFramebuffer* brdf_framebuffer = nullptr;
|
||||||
GFXRenderPass* brdf_render_pass = nullptr;
|
GFXRenderPass* brdf_render_pass = nullptr;
|
||||||
|
|
||||||
// general ui
|
|
||||||
GFXPipeline* general_pipeline, *world_general_pipeline = nullptr;
|
|
||||||
|
|
||||||
// histogram compute
|
// histogram compute
|
||||||
GFXPipeline* histogram_pipeline = nullptr, *histogram_average_pipeline = nullptr;
|
GFXPipeline* histogram_pipeline = nullptr, *histogram_average_pipeline = nullptr;
|
||||||
GFXBuffer* histogram_buffer = nullptr;
|
GFXBuffer* histogram_buffer = nullptr;
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
#include "math.hpp"
|
#include "math.hpp"
|
||||||
#include "file.hpp"
|
#include "file.hpp"
|
||||||
#include "scene.hpp"
|
#include "scene.hpp"
|
||||||
#include "font.hpp"
|
|
||||||
#include "vector.hpp"
|
#include "vector.hpp"
|
||||||
#include "imguipass.hpp"
|
#include "imguipass.hpp"
|
||||||
#include "gfx.hpp"
|
#include "gfx.hpp"
|
||||||
#include "log.hpp"
|
|
||||||
#include "pass.hpp"
|
#include "pass.hpp"
|
||||||
#include "shadowpass.hpp"
|
#include "shadowpass.hpp"
|
||||||
#include "smaapass.hpp"
|
#include "smaapass.hpp"
|
||||||
|
@ -22,20 +20,6 @@
|
||||||
|
|
||||||
using prism::renderer;
|
using prism::renderer;
|
||||||
|
|
||||||
struct ElementInstance {
|
|
||||||
prism::float4 color;
|
|
||||||
uint32_t position = 0, size = 0;
|
|
||||||
uint32_t padding[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GlyphInstance {
|
|
||||||
uint32_t position = 0, index = 0, instance = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct StringInstance {
|
|
||||||
uint32_t xy;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SceneMaterial {
|
struct SceneMaterial {
|
||||||
prism::float4 color, info;
|
prism::float4 color, info;
|
||||||
};
|
};
|
||||||
|
@ -67,11 +51,6 @@ struct PostPushConstants {
|
||||||
prism::float4 viewport, options, transform_ops;
|
prism::float4 viewport, options, transform_ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UIPushConstant {
|
|
||||||
prism::float2 screenSize;
|
|
||||||
Matrix4x4 mvp;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SkyPushConstant {
|
struct SkyPushConstant {
|
||||||
Matrix4x4 view;
|
Matrix4x4 view;
|
||||||
prism::float4 sun_position_fov;
|
prism::float4 sun_position_fov;
|
||||||
|
@ -108,7 +87,6 @@ renderer::renderer(GFX* gfx, const bool enable_imgui) : gfx(gfx) {
|
||||||
|
|
||||||
unorm_render_pass = gfx->create_render_pass(renderPassInfo);
|
unorm_render_pass = gfx->create_render_pass(renderPassInfo);
|
||||||
|
|
||||||
create_font_texture();
|
|
||||||
create_sky_pipeline();
|
create_sky_pipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,42 +109,6 @@ void renderer::resize_render_target(RenderTarget& target, const prism::Extent ex
|
||||||
smaa_pass->create_render_target_resources(target);
|
smaa_pass->create_render_target_resources(target);
|
||||||
create_post_pipelines();
|
create_post_pipelines();
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
|
||||||
pipelineInfo.label = "Text";
|
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("text.vert"));
|
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("text.frag"));
|
|
||||||
|
|
||||||
pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip;
|
|
||||||
|
|
||||||
pipelineInfo.blending.enable_blending = true;
|
|
||||||
pipelineInfo.blending.src_rgb = GFXBlendFactor::SrcAlpha;
|
|
||||||
pipelineInfo.blending.dst_rgb = GFXBlendFactor::OneMinusSrcColor;
|
|
||||||
|
|
||||||
pipelineInfo.shader_input.bindings = {
|
|
||||||
{4, GFXBindingType::PushConstant},
|
|
||||||
{0, GFXBindingType::StorageBuffer},
|
|
||||||
{1, GFXBindingType::StorageBuffer},
|
|
||||||
{2, GFXBindingType::StorageBuffer},
|
|
||||||
{3, GFXBindingType::Texture}
|
|
||||||
};
|
|
||||||
|
|
||||||
pipelineInfo.shader_input.push_constants = {
|
|
||||||
{sizeof(UIPushConstant), 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
text_pipeline = gfx->create_graphics_pipeline(pipelineInfo);
|
|
||||||
|
|
||||||
if(world_text_pipeline == nullptr) {
|
|
||||||
pipelineInfo.render_pass = offscreen_render_pass;
|
|
||||||
pipelineInfo.label = "Text World";
|
|
||||||
pipelineInfo.depth.depth_mode = GFXDepthMode::LessOrEqual;
|
|
||||||
|
|
||||||
world_text_pipeline = gfx->create_graphics_pipeline(pipelineInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
create_ui_pipelines();
|
|
||||||
|
|
||||||
for(auto& pass : passes)
|
for(auto& pass : passes)
|
||||||
pass->create_render_target_resources(target);
|
pass->create_render_target_resources(target);
|
||||||
}
|
}
|
||||||
|
@ -674,32 +616,6 @@ void renderer::create_post_pipelines() {
|
||||||
post_pipeline = gfx->create_graphics_pipeline(pipelineInfo);
|
post_pipeline = gfx->create_graphics_pipeline(pipelineInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderer::create_font_texture() {
|
|
||||||
auto file = prism::open_file(prism::app_domain / "font.fp", true);
|
|
||||||
if(file == std::nullopt) {
|
|
||||||
prism::log("Failed to load font file!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
file->read(&font);
|
|
||||||
|
|
||||||
std::vector<unsigned char> bitmap(font.width * font.height);
|
|
||||||
file->read(bitmap.data(), font.width * font.height);
|
|
||||||
|
|
||||||
instance_alignment = (int)gfx->get_alignment(sizeof(GlyphInstance) * maxInstances);
|
|
||||||
|
|
||||||
GFXTextureCreateInfo textureInfo = {};
|
|
||||||
textureInfo.label = "UI Font";
|
|
||||||
textureInfo.width = font.width;
|
|
||||||
textureInfo.height = font.height;
|
|
||||||
textureInfo.format = GFXPixelFormat::R8_UNORM;
|
|
||||||
textureInfo.usage = GFXTextureUsage::Sampled | GFXTextureUsage::TransferDst;
|
|
||||||
|
|
||||||
font_texture = gfx->create_texture(textureInfo);
|
|
||||||
|
|
||||||
gfx->copy_texture(font_texture, bitmap.data(), font.width * font.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void renderer::create_sky_pipeline() {
|
void renderer::create_sky_pipeline() {
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Sky";
|
pipelineInfo.label = "Sky";
|
||||||
|
@ -729,38 +645,6 @@ void renderer::create_sky_pipeline() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderer::create_ui_pipelines() {
|
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
|
||||||
pipelineInfo.label = "UI";
|
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("ui.vert"));
|
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("ui.frag"));
|
|
||||||
|
|
||||||
pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip;
|
|
||||||
|
|
||||||
pipelineInfo.blending.enable_blending = true;
|
|
||||||
pipelineInfo.blending.src_rgb = GFXBlendFactor::SrcAlpha;
|
|
||||||
pipelineInfo.blending.dst_rgb = GFXBlendFactor::OneMinusSrcAlpha;
|
|
||||||
|
|
||||||
pipelineInfo.shader_input.bindings = {
|
|
||||||
{1, GFXBindingType::PushConstant},
|
|
||||||
{0, GFXBindingType::StorageBuffer},
|
|
||||||
{2, GFXBindingType::Texture}
|
|
||||||
};
|
|
||||||
|
|
||||||
pipelineInfo.shader_input.push_constants = {
|
|
||||||
{sizeof(UIPushConstant), 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
general_pipeline = gfx->create_graphics_pipeline(pipelineInfo);
|
|
||||||
|
|
||||||
pipelineInfo.label = "UI World";
|
|
||||||
pipelineInfo.render_pass = offscreen_render_pass;
|
|
||||||
pipelineInfo.depth.depth_mode = GFXDepthMode::LessOrEqual;
|
|
||||||
|
|
||||||
world_general_pipeline = gfx->create_graphics_pipeline(pipelineInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
void renderer::generate_brdf() {
|
void renderer::generate_brdf() {
|
||||||
GFXRenderPassCreateInfo renderPassInfo = {};
|
GFXRenderPassCreateInfo renderPassInfo = {};
|
||||||
renderPassInfo.label = "BRDF Gen";
|
renderPassInfo.label = "BRDF Gen";
|
||||||
|
|
Reference in a new issue