improved shader IL inclusion from C++, simplified CRP shaders

This commit is contained in:
myT 2024-01-14 22:43:20 +01:00
parent c5bb9c7495
commit 9e5229a901
36 changed files with 321 additions and 577 deletions

View file

@ -22,21 +22,10 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace dof_accum
{
#include "compshaders/crp/accumdof_accum_vs.h"
#include "compshaders/crp/accumdof_accum_ps.h"
}
namespace dof_norm
{
#include "compshaders/crp/accumdof_norm_vs.h"
#include "compshaders/crp/accumdof_norm_ps.h"
}
namespace dof_debug
{
#include "compshaders/crp/accumdof_debug_vs.h"
#include "compshaders/crp/accumdof_debug_ps.h"
}
#include "compshaders/crp/fullscreen.h"
#include "compshaders/crp/accumdof_accum.h"
#include "compshaders/crp/accumdof_norm.h"
#include "compshaders/crp/accumdof_debug.h"
#pragma pack(push, 4)
@ -140,8 +129,8 @@ void AccumDepthOfField::Init()
{
GraphicsPipelineDesc desc("DOF Accumulate");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(dof_accum::g_vs);
desc.pixelShader = ShaderByteCode(dof_accum::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_accum_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE, crp.renderTargetFormat);
@ -151,8 +140,8 @@ void AccumDepthOfField::Init()
{
GraphicsPipelineDesc desc("DOF Normalize");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(dof_norm::g_vs);
desc.pixelShader = ShaderByteCode(dof_norm::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_norm_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, crp.renderTargetFormat);
@ -162,8 +151,8 @@ void AccumDepthOfField::Init()
{
GraphicsPipelineDesc desc("DOF Debug");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(dof_debug::g_vs);
desc.pixelShader = ShaderByteCode(dof_debug::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_debug_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, crp.renderTargetFormat);

View file

@ -22,36 +22,14 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace debug
{
#include "compshaders/crp/gatherdof_debug_vs.h"
#include "compshaders/crp/gatherdof_debug_ps.h"
}
namespace split
{
#include "compshaders/crp/fullscreen.h"
#include "compshaders/crp/gatherdof_debug.h"
#include "compshaders/crp/gatherdof_split.h"
}
namespace near_coc_tile_gen
{
#include "compshaders/crp/gatherdof_coc_tile_gen.h"
}
namespace near_coc_tile_max
{
#include "compshaders/crp/gatherdof_coc_tile_max.h"
}
namespace blur
{
#include "compshaders/crp/gatherdof_blur.h"
}
namespace fill
{
#include "compshaders/crp/gatherdof_fill.h"
}
namespace combine
{
#include "compshaders/crp/gatherdof_combine_vs.h"
#include "compshaders/crp/gatherdof_combine_ps.h"
}
#include "compshaders/crp/gatherdof_combine.h"
#pragma pack(push, 4)
@ -168,43 +146,43 @@ void GatherDepthOfField::Init()
{
ComputePipelineDesc desc("DOF split");
desc.shortLifeTime = true;
desc.shader = ShaderByteCode(split::g_cs);
desc.shader = ShaderByteCode(g_split_cs);
splitPipeline = CreateComputePipeline(desc);
}
{
ComputePipelineDesc desc("DOF near CoC tile generation");
desc.shortLifeTime = true;
desc.shader = ShaderByteCode(near_coc_tile_gen::g_cs);
desc.shader = ShaderByteCode(g_coc_tile_gen_cs);
nearCocTileGenPipeline = CreateComputePipeline(desc);
}
{
ComputePipelineDesc desc("DOF near CoC tile dilation");
desc.shortLifeTime = true;
desc.shader = ShaderByteCode(near_coc_tile_max::g_cs);
desc.shader = ShaderByteCode(g_coc_tile_max_cs);
nearCocTileMaxPipeline = CreateComputePipeline(desc);
}
{
ComputePipelineDesc desc("DOF blur");
desc.shortLifeTime = true;
desc.shader = ShaderByteCode(blur::g_cs);
desc.shader = ShaderByteCode(g_blur_cs);
blurPipeline = CreateComputePipeline(desc);
}
{
ComputePipelineDesc desc("DOF fill");
desc.shortLifeTime = true;
desc.shader = ShaderByteCode(fill::g_cs);
desc.shader = ShaderByteCode(g_fill_cs);
fillPipeline = CreateComputePipeline(desc);
}
{
GraphicsPipelineDesc desc("DOF combine");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(combine::g_vs);
desc.pixelShader = ShaderByteCode(combine::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_combine_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, renderTargetFormat);
@ -214,8 +192,8 @@ void GatherDepthOfField::Init()
{
GraphicsPipelineDesc desc("DOF viz");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(debug::g_vs);
desc.pixelShader = ShaderByteCode(debug::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_debug_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, renderTargetFormat);

View file

@ -22,16 +22,8 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace fog_outside
{
#include "compshaders/crp/fog_outside_vs.h"
#include "compshaders/crp/fog_outside_ps.h"
}
namespace fog_inside
{
#include "compshaders/crp/fog_inside_vs.h"
#include "compshaders/crp/fog_inside_ps.h"
}
#include "compshaders/crp/fog_outside.h"
#include "compshaders/crp/fog_inside.h"
#pragma pack(push, 4)
@ -95,8 +87,8 @@ void Fog::Init()
{
GraphicsPipelineDesc desc("fog outside");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(fog_outside::g_vs);
desc.pixelShader = ShaderByteCode(fog_outside::g_ps);
desc.vertexShader = ShaderByteCode(g_outside_vs);
desc.pixelShader = ShaderByteCode(g_outside_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_BACK_SIDED;
desc.rasterizer.polygonOffset = false;
@ -108,8 +100,8 @@ void Fog::Init()
{
GraphicsPipelineDesc desc("fog inside");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(fog_inside::g_vs);
desc.pixelShader = ShaderByteCode(fog_inside::g_ps);
desc.vertexShader = ShaderByteCode(g_inside_vs);
desc.pixelShader = ShaderByteCode(g_inside_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_FRONT_SIDED;
desc.rasterizer.polygonOffset = false;

View file

@ -24,38 +24,14 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
#include "../client/cl_imgui.h"
#include "shaders/crp/oit.h.hlsli"
namespace blit
{
#include "compshaders/crp/blit_vs.h"
#include "compshaders/crp/blit_ps.h"
}
namespace ui
{
#include "compshaders/crp/ui_vs.h"
#include "compshaders/crp/ui_ps.h"
}
namespace imgui
{
#include "compshaders/crp/imgui_vs.h"
#include "compshaders/crp/imgui_ps.h"
}
namespace nuklear
{
#include "compshaders/crp/nuklear_vs.h"
#include "compshaders/crp/nuklear_ps.h"
}
namespace mip_1
{
#include "compshaders/crp/mip_1_cs.h"
}
namespace mip_2
{
#include "compshaders/crp/mip_2_cs.h"
}
namespace mip_3
{
#include "compshaders/crp/mip_3_cs.h"
}
#include "compshaders/crp/fullscreen.h"
#include "compshaders/crp/blit.h"
#include "compshaders/crp/ui.h"
#include "compshaders/crp/imgui.h"
#include "compshaders/crp/nuklear.h"
#include "compshaders/crp/mip_1.h"
#include "compshaders/crp/mip_2.h"
#include "compshaders/crp/mip_3.h"
CRP crp;
@ -331,8 +307,8 @@ void CRP::Init()
{
GraphicsPipelineDesc desc("blit LDR");
desc.vertexShader = ShaderByteCode(blit::g_vs);
desc.pixelShader = ShaderByteCode(blit::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_blit_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, TextureFormat::RGBA32_UNorm);
@ -342,10 +318,10 @@ void CRP::Init()
blitPipelineHDR = CreateGraphicsPipeline(desc);
}
ui.Init(true, ShaderByteCode(ui::g_vs), ShaderByteCode(ui::g_ps), renderTargetFormat, RHI_MAKE_NULL_HANDLE(), NULL);
imgui.Init(true, ShaderByteCode(imgui::g_vs), ShaderByteCode(imgui::g_ps), renderTargetFormat, RHI_MAKE_NULL_HANDLE(), NULL);
nuklear.Init(true, ShaderByteCode(nuklear::g_vs), ShaderByteCode(nuklear::g_ps), renderTargetFormat, RHI_MAKE_NULL_HANDLE(), NULL);
mipMapGen.Init(true, ShaderByteCode(mip_1::g_cs), ShaderByteCode(mip_2::g_cs), ShaderByteCode(mip_3::g_cs));
ui.Init(true, ShaderByteCode(g_ui_vs), ShaderByteCode(g_ui_ps), renderTargetFormat, RHI_MAKE_NULL_HANDLE(), NULL);
imgui.Init(true, ShaderByteCode(g_imgui_vs), ShaderByteCode(g_imgui_ps), renderTargetFormat, RHI_MAKE_NULL_HANDLE(), NULL);
nuklear.Init(true, ShaderByteCode(g_nuklear_vs), ShaderByteCode(g_nuklear_ps), renderTargetFormat, RHI_MAKE_NULL_HANDLE(), NULL);
mipMapGen.Init(true, ShaderByteCode(g_mip_1_cs), ShaderByteCode(g_mip_2_cs), ShaderByteCode(g_mip_3_cs));
opaque.Init();
transp.Init();
transpResolve.Init();

View file

@ -22,11 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace opaque
{
#include "compshaders/crp/opaque_vs.h"
#include "compshaders/crp/opaque_ps.h"
}
#include "compshaders/crp/opaque.h"
#pragma pack(push, 4)
@ -207,8 +203,8 @@ void WorldOpaque::ProcessShader(shader_t& shader)
desc.name = "opaque";
desc.rootSignature = RHI_MAKE_NULL_HANDLE();
desc.shortLifeTime = true; // the PSO cache is only valid for this map!
desc.vertexShader = opaque::g_vs;
desc.pixelShader = opaque::g_ps;
desc.vertexShader = g_opaque_vs;
desc.pixelShader = g_opaque_ps;
desc.vertexLayout.AddAttribute(a++, ShaderSemantic::Position, DataType::Float32, 3, 0);
desc.vertexLayout.AddAttribute(a++, ShaderSemantic::Normal, DataType::Float32, 2, 0);
desc.vertexLayout.AddAttribute(a++, ShaderSemantic::TexCoord, DataType::Float32, 2, 0);

View file

@ -22,16 +22,9 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace tone_map
{
#include "compshaders/crp/tone_map_vs.h"
#include "compshaders/crp/tone_map_ps.h"
}
namespace inverse_tone_map
{
#include "compshaders/crp/tone_map_inverse_vs.h"
#include "compshaders/crp/tone_map_inverse_ps.h"
}
#include "compshaders/crp/fullscreen.h"
#include "compshaders/crp/tone_map.h"
#include "compshaders/crp/tone_map_inverse.h"
#pragma pack(push, 4)
@ -61,8 +54,8 @@ void ToneMap::Init()
{
GraphicsPipelineDesc desc("Tone Map");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(tone_map::g_vs);
desc.pixelShader = ShaderByteCode(tone_map::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_tone_map_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, crp.renderTargetFormat);
@ -72,8 +65,8 @@ void ToneMap::Init()
{
GraphicsPipelineDesc desc("Inverse Tone Map");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(tone_map::g_vs);
desc.pixelShader = ShaderByteCode(tone_map::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_tone_map_inverse_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, crp.renderTargetFormat);

View file

@ -22,11 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace transp_draw
{
#include "compshaders/crp/transp_draw_vs.h"
#include "compshaders/crp/transp_draw_ps.h"
}
#include "compshaders/crp/transp_draw.h"
#pragma pack(push, 4)
@ -236,8 +232,8 @@ void WorldTransp::ProcessShader(shader_t& shader)
desc.name = "transp";
desc.rootSignature = RHI_MAKE_NULL_HANDLE();
desc.shortLifeTime = true; // the PSO cache is only valid for this map!
desc.vertexShader = transp_draw::g_vs;
desc.pixelShader = transp_draw::g_ps;
desc.vertexShader = g_transp_draw_vs;
desc.pixelShader = g_transp_draw_ps;
desc.vertexLayout.AddAttribute(a++, ShaderSemantic::Position, DataType::Float32, 3, 0);
desc.vertexLayout.AddAttribute(a++, ShaderSemantic::Normal, DataType::Float32, 2, 0);
desc.vertexLayout.AddAttribute(a++, ShaderSemantic::TexCoord, DataType::Float32, 2, 0);

View file

@ -22,11 +22,8 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "crp_local.h"
namespace transp_resolve
{
#include "compshaders/crp/transp_resolve_vs.h"
#include "compshaders/crp/transp_resolve_ps.h"
}
#include "compshaders/crp/fullscreen.h"
#include "compshaders/crp/transp_resolve.h"
#pragma pack(push, 4)
@ -53,8 +50,8 @@ void TranspResolve::Init()
{
GraphicsPipelineDesc desc("OIT Resolve");
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(transp_resolve::g_vs);
desc.pixelShader = ShaderByteCode(transp_resolve::g_ps);
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
desc.pixelShader = ShaderByteCode(g_transp_resolve_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, crp.renderTargetFormat);

View file

@ -23,37 +23,16 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "grp_local.h"
#include "grp_uber_shaders.h"
#include "../client/cl_imgui.h"
#include "compshaders/grp/uber_shader.h"
#include "compshaders/grp/complete_uber_vs.h"
#include "compshaders/grp/complete_uber_ps.h"
#include "../client/cl_imgui.h"
namespace ui
{
#include "compshaders/grp/ui_vs.h"
#include "compshaders/grp/ui_ps.h"
}
namespace imgui
{
#include "compshaders/grp/imgui_vs.h"
#include "compshaders/grp/imgui_ps.h"
}
namespace nuklear
{
#include "compshaders/grp/nuklear_vs.h"
#include "compshaders/grp/nuklear_ps.h"
}
namespace mip_1
{
#include "compshaders/grp/mip_1_cs.h"
}
namespace mip_2
{
#include "compshaders/grp/mip_2_cs.h"
}
namespace mip_3
{
#include "compshaders/grp/mip_3_cs.h"
}
#include "compshaders/grp/ui.h"
#include "compshaders/grp/imgui.h"
#include "compshaders/grp/nuklear.h"
#include "compshaders/grp/mip_1.h"
#include "compshaders/grp/mip_2.h"
#include "compshaders/grp/mip_3.h"
GRP grp;
@ -223,13 +202,13 @@ void GRP::Init()
readbackRenderTarget = RHI::CreateTexture(desc);
}
ui.Init(false, ShaderByteCode(ui::g_vs), ShaderByteCode(ui::g_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
ui.Init(false, ShaderByteCode(g_ui_vs), ShaderByteCode(g_ui_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
world.Init();
mipMapGen.Init(false, ShaderByteCode(mip_1::g_cs), ShaderByteCode(mip_2::g_cs), ShaderByteCode(mip_3::g_cs));
const HTexture fontAtlas = imgui.Init(false, ShaderByteCode(imgui::g_vs), ShaderByteCode(imgui::g_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
mipMapGen.Init(false, ShaderByteCode(g_mip_1_cs), ShaderByteCode(g_mip_2_cs), ShaderByteCode(g_mip_3_cs));
const HTexture fontAtlas = imgui.Init(false, ShaderByteCode(g_imgui_vs), ShaderByteCode(g_imgui_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
const uint32_t fontAtlasSRV = RegisterTexture(fontAtlas);
imgui.RegisterFontAtlas(fontAtlasSRV);
nuklear.Init(false, ShaderByteCode(nuklear::g_vs), ShaderByteCode(nuklear::g_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
nuklear.Init(false, ShaderByteCode(g_nuklear_vs), ShaderByteCode(g_nuklear_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
post.Init();
post.SetToneMapInput(renderTarget);
smaa.Init(); // must be after post

View file

@ -22,16 +22,8 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "grp_local.h"
namespace tone_map
{
#include "compshaders/grp/post_gamma_vs.h"
#include "compshaders/grp/post_gamma_ps.h"
}
namespace inverse_tone_map
{
#include "compshaders/grp/post_inverse_gamma_vs.h"
#include "compshaders/grp/post_inverse_gamma_ps.h"
}
#include "compshaders/grp/post_gamma.h"
#include "compshaders/grp/post_inverse_gamma.h"
#pragma pack(push, 4)
@ -95,8 +87,8 @@ void PostProcess::Init()
}
{
GraphicsPipelineDesc desc("tone map", toneMapRootSignature);
desc.vertexShader = ShaderByteCode(tone_map::g_vs);
desc.pixelShader = ShaderByteCode(tone_map::g_ps);
desc.vertexShader = ShaderByteCode(g_post_vs);
desc.pixelShader = ShaderByteCode(g_post_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, TextureFormat::RGBA32_UNorm);
@ -125,8 +117,8 @@ void PostProcess::Init()
for(int i = 0; i < RTCF_COUNT; ++i)
{
GraphicsPipelineDesc desc("inverse tone map", inverseToneMapRootSignature);
desc.vertexShader = ShaderByteCode(inverse_tone_map::g_vs);
desc.pixelShader = ShaderByteCode(inverse_tone_map::g_ps);
desc.vertexShader = ShaderByteCode(g_post_inverse_vs);
desc.pixelShader = ShaderByteCode(g_post_inverse_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_TWO_SIDED;
desc.AddRenderTarget(0, rtFormats[i]);

View file

@ -26,28 +26,11 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "grp_local.h"
#include "../client/cl_imgui.h"
namespace zpp
{
#include "compshaders/grp/depth_pre_pass_vs.h"
#include "compshaders/grp/depth_pre_pass_ps.h"
}
namespace fog
{
#include "compshaders/grp/fog_vs.h"
}
namespace fog_inside
{
#include "compshaders/grp/fog_inside_ps.h"
}
namespace fog_outside
{
#include "compshaders/grp/fog_outside_ps.h"
}
namespace dyn_light
{
#include "compshaders/grp/dynamic_light_vs.h"
#include "compshaders/grp/dynamic_light_ps.h"
}
#include "compshaders/grp/depth_pre_pass.h"
#include "compshaders/grp/fog.h"
#include "compshaders/grp/fog_inside.h"
#include "compshaders/grp/fog_outside.h"
#include "compshaders/grp/dynamic_light.h"
#pragma pack(push, 4)
@ -179,8 +162,8 @@ void World::Init()
// we could handle all 3 cull mode modes and alpha testing, but we do a partial pre-pass
// it wouldn't make sense going any further instead of trying a visibility buffer approach
GraphicsPipelineDesc desc("Z pre-pass", zppRootSignature);
desc.vertexShader = ShaderByteCode(zpp::g_vs);
desc.pixelShader = ShaderByteCode(zpp::g_ps);
desc.vertexShader = ShaderByteCode(g_zpp_vs);
desc.pixelShader = ShaderByteCode(g_zpp_ps);
desc.vertexLayout.AddAttribute(0, ShaderSemantic::Position, DataType::Float32, 3, 0);
desc.depthStencil.depthComparison = ComparisonFunction::GreaterEqual;
desc.depthStencil.depthStencilFormat = TextureFormat::Depth32_Float;
@ -302,8 +285,8 @@ void World::Init()
{
GraphicsPipelineDesc desc("fog outside", fogRootSignature);
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(fog::g_vs);
desc.pixelShader = ShaderByteCode(fog_outside::g_ps);
desc.vertexShader = ShaderByteCode(g_fog_vs);
desc.pixelShader = ShaderByteCode(g_fog_outside_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_BACK_SIDED;
desc.rasterizer.polygonOffset = false;
@ -315,8 +298,8 @@ void World::Init()
{
GraphicsPipelineDesc desc("fog inside", fogRootSignature);
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(fog::g_vs);
desc.pixelShader = ShaderByteCode(fog_inside::g_ps);
desc.vertexShader = ShaderByteCode(g_fog_vs);
desc.pixelShader = ShaderByteCode(g_fog_inside_ps);
desc.depthStencil.DisableDepth();
desc.rasterizer.cullMode = CT_FRONT_SIDED;
desc.rasterizer.polygonOffset = false;
@ -332,8 +315,8 @@ void World::Init()
{
GraphicsPipelineDesc desc("dynamic light opaque", dlRootSignature);
desc.shortLifeTime = true;
desc.vertexShader = ShaderByteCode(dyn_light::g_vs);
desc.pixelShader = ShaderByteCode(dyn_light::g_ps);
desc.vertexShader = ShaderByteCode(g_dl_vs);
desc.pixelShader = ShaderByteCode(g_dl_ps);
desc.depthStencil.enableDepthWrites = false;
desc.rasterizer.clampDepth = r_depthClamp->integer != 0;
desc.AddRenderTarget(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE, grp.renderTargetFormat);

View file

@ -22,6 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
cbuffer RootConstants
@ -29,27 +30,6 @@ cbuffer RootConstants
uint textureIndex;
};
struct VOut
{
float4 position : SV_Position;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
@ -61,5 +41,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -22,6 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
#include "dof.hlsli"
@ -40,29 +41,6 @@ cbuffer RootConstants
float maxFarCocCS;
};
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
output.texCoords = FSTriangleTCFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D colorTexture = ResourceDescriptorHeap[colorTextureIndex];
@ -95,5 +73,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -22,6 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
cbuffer RootConstants
@ -29,27 +30,6 @@ cbuffer RootConstants
uint textureIndex;
};
struct VOut
{
float4 position : SV_Position;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
@ -61,5 +41,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2023 Gian 'myT' Schellenbaum
Copyright (C) 2023-2024 Gian 'myT' Schellenbaum
This file is part of Challenge Quake 3 (CNQ3).
@ -21,7 +21,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
// blit shader - unlike texture copies, it doesn't care about the specific formats used
#include "common.hlsli"
#include "fullscreen.hlsli"
cbuffer RootConstants : register(b0)
@ -32,29 +32,6 @@ cbuffer RootConstants : register(b0)
float2 tcBias;
};
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
output.texCoords = FSTriangleTCFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
@ -65,5 +42,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -21,12 +21,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
// fog volume (AABB) rendering - shared code
struct VOut
{
float4 position : SV_Position;
float depthVS : DEPTHVS;
};
cbuffer RootConstants
{
matrix modelViewMatrix;
@ -40,8 +34,11 @@ cbuffer RootConstants
uint depthTextureIndex;
};
#ifdef VERTEX_SHADER
struct VOut
{
float4 position : SV_Position;
float depthVS : DEPTHVS;
};
VOut vs(float3 positionOS : POSITION)
{
@ -54,5 +51,3 @@ VOut vs(float3 positionOS : POSITION)
return output;
}
#endif

View file

@ -25,8 +25,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "fog.hlsli"
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D<float> depthTexture = ResourceDescriptorHeap[depthTextureIndex];
@ -39,5 +37,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -25,8 +25,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "fog.hlsli"
#ifdef PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D<float> depthTexture = ResourceDescriptorHeap[depthTextureIndex];
@ -43,5 +41,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -0,0 +1,35 @@
/*
===========================================================================
Copyright (C) 2024 Gian 'myT' Schellenbaum
This file is part of Challenge Quake 3 (CNQ3).
Challenge Quake 3 is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Challenge Quake 3 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
===========================================================================
*/
// full-screen triangle vertex shader
#include "common.hlsli"
#include "fullscreen.hlsli"
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
output.texCoords = FSTriangleTCFromVertexId(id);
return output;
}

View file

@ -0,0 +1,28 @@
/*
===========================================================================
Copyright (C) 2024 Gian 'myT' Schellenbaum
This file is part of Challenge Quake 3 (CNQ3).
Challenge Quake 3 is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Challenge Quake 3 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
===========================================================================
*/
// full-screen triangle vertex shader struct
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};

View file

@ -22,6 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
#include "gatherdof.hlsli"
@ -29,47 +30,22 @@ cbuffer RootConstants : register(b0)
{
uint nearTextureIndex;
uint farTextureIndex;
uint nearCocTextureIndex;
uint nearCocTextureIndex; // @TODO: remove
uint farCocTextureIndex;
uint sharpTextureIndex;
uint samplerIndex; // point/clamp
};
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
output.texCoords = FSTriangleTCFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
SamplerState samplerState = SamplerDescriptorHeap[samplerIndex];
Texture2D nearColorTexture = ResourceDescriptorHeap[nearTextureIndex];
Texture2D farColorTexture = ResourceDescriptorHeap[farTextureIndex];
Texture2D<float> nearCocTexture = ResourceDescriptorHeap[nearCocTextureIndex];
Texture2D<float> farCocTexture = ResourceDescriptorHeap[farCocTextureIndex];
Texture2D sharpTexture = ResourceDescriptorHeap[sharpTextureIndex];
float4 nearColor = nearColorTexture.Sample(samplerState, input.texCoords);
float4 farColor = farColorTexture.Sample(samplerState, input.texCoords);
//float nearCoc = nearCocTexture.Sample(samplerState, input.texCoords);
float nearCoc = saturate(nearColor.a);
float farCoc = farCocTexture.Sample(samplerState, input.texCoords);
float4 sharp = sharpTexture.Sample(samplerState, input.texCoords);
@ -80,5 +56,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -22,6 +22,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
#include "gatherdof.hlsli"
#include "dof.hlsli"
@ -40,29 +41,6 @@ cbuffer RootConstants : register(b0)
float focusDist;
};
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
output.texCoords = FSTriangleTCFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D colorTexture = ResourceDescriptorHeap[colorTextureIndex];
@ -89,5 +67,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -21,13 +21,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
// Dear ImGui integration
struct VOut
{
float4 pos : SV_POSITION;
float4 col : COLOR0;
float2 uv : TEXCOORD0;
};
cbuffer RootConstants : register(b0)
{
float4x4 projectionMatrix;
@ -36,9 +29,6 @@ cbuffer RootConstants : register(b0)
float mipIndex;
};
#if VERTEX_SHADER
struct VIn
{
float2 pos : POSITION;
@ -46,6 +36,13 @@ struct VIn
float2 uv : TEXCOORD0;
};
struct VOut
{
float4 pos : SV_POSITION;
float4 col : COLOR0;
float2 uv : TEXCOORD0;
};
VOut vs(VIn input)
{
VOut output;
@ -56,11 +53,6 @@ VOut vs(VIn input)
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
@ -69,5 +61,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -21,13 +21,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
// Nuklear integration
struct VOut
{
float4 pos : SV_POSITION;
float4 col : COLOR0;
float2 uv : TEXCOORD0;
};
cbuffer RootConstants
{
float4x4 projectionMatrix;
@ -35,8 +28,12 @@ cbuffer RootConstants
uint samplerIndex;
};
#if VERTEX_SHADER
struct VOut
{
float4 pos : SV_POSITION;
float4 col : COLOR0;
float2 uv : TEXCOORD0;
};
struct VIn
{
@ -55,11 +52,6 @@ VOut vs(VIn input)
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
@ -68,5 +60,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -48,9 +48,6 @@ cbuffer RootConstants
// @TODO: Voronoi tiling
};
#if VERTEX_SHADER
struct VIn
{
float3 position : POSITION;
@ -59,8 +56,6 @@ struct VIn
float4 color : COLOR0;
};
#endif
struct VOut
{
float4 position : SV_Position;
@ -72,9 +67,6 @@ struct VOut
float depthVS : DEPTHVS;
};
#if VERTEX_SHADER
VOut vs(VIn input)
{
float4 positionVS = mul(modelViewMatrix, float4(input.position.xyz, 1));
@ -91,11 +83,6 @@ VOut vs(VIn input)
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
// @TODO: Voronoi tiling
@ -127,5 +114,3 @@ float4 ps(VOut input) : SV_Target
return dst;
}
#endif

View file

@ -23,14 +23,9 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
cbuffer RootConstants
{
uint textureIndex;
@ -40,9 +35,6 @@ cbuffer RootConstants
float greyscale;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
@ -52,11 +44,6 @@ VOut vs(uint id : SV_VertexID)
return output;
}
#endif
#if PIXEL_SHADER
// X3571: pow(f, e) won't work if f is negative
#pragma warning(disable : 3571)
@ -70,5 +57,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -22,14 +22,9 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "fullscreen.hlsli"
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
cbuffer RootConstants
{
uint textureIndex;
@ -38,9 +33,6 @@ cbuffer RootConstants
float invBrightness;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
@ -50,11 +42,6 @@ VOut vs(uint id : SV_VertexID)
return output;
}
#endif
#if PIXEL_SHADER
// X3571: pow(f, e) won't work if f is negative
#pragma warning(disable : 3571)
@ -68,5 +55,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -46,8 +46,6 @@ cbuffer RootConstants
uint depthFadeScaleBias; // enable: 1 - color bias: 4 - color scale: 4
};
#if VERTEX_SHADER
struct VIn
{
float3 position : POSITION;
@ -56,8 +54,6 @@ struct VIn
float4 color : COLOR0;
};
#endif
struct VOut
{
float4 position : SV_Position;
@ -69,9 +65,6 @@ struct VOut
float depthVS : DEPTHVS;
};
#if VERTEX_SHADER
VOut vs(VIn input)
{
float4 positionVS = mul(modelViewMatrix, float4(input.position.xyz, 1));
@ -88,11 +81,6 @@ VOut vs(VIn input)
return output;
}
#endif
#if PIXEL_SHADER
[earlydepthstencil]
void ps(VOut input)
{
@ -132,5 +120,3 @@ void ps(VOut input)
InterlockedAdd(counter[0].fragmentCount, -1, garbage);
}
}
#endif

View file

@ -23,6 +23,7 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
#include "common.hlsli"
#include "oit.h.hlsli"
#include "fullscreen.hlsli"
#include "../common/state_bits.h.hlsli"
@ -40,29 +41,6 @@ cbuffer RootConstants
float2 scissorRectMax;
};
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
};
#if VERTEX_SHADER
VOut vs(uint id : SV_VertexID)
{
VOut output;
output.position = FSTrianglePosFromVertexId(id);
output.texCoords = FSTriangleTCFromVertexId(id);
return output;
}
#endif
#if PIXEL_SHADER
uint GetShaderStage(uint stateBits)
{
return (stateBits & GLS_STAGEINDEX_BITS) >> GLS_STAGEINDEX_SHIFT;
@ -212,5 +190,3 @@ float4 ps(VOut input) : SV_Target
return color;
}
#endif

View file

@ -21,13 +21,6 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
// UI rendering
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
float4 color : COLOR0;
};
cbuffer RootConstants : register(b0)
{
float2 scale;
@ -35,8 +28,12 @@ cbuffer RootConstants : register(b0)
uint samplerIndex;
};
#if VERTEX_SHADER
struct VOut
{
float4 position : SV_Position;
float2 texCoords : TEXCOORD0;
float4 color : COLOR0;
};
struct VIn
{
@ -56,11 +53,6 @@ VOut vs(VIn input)
return output;
}
#endif
#if PIXEL_SHADER
float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
@ -69,5 +61,3 @@ float4 ps(VOut input) : SV_Target
return result;
}
#endif

View file

@ -80,6 +80,17 @@ struct ShaderArgs
const char* targetProfile;
};
const char* OutputPath(const char* path)
{
return va("%s\\%s", outputPath, path);
}
const char* HeaderVariable(const char* name)
{
// the output variable isn't declared static, polluting the global namespace...
return va("\"static %s\"", name);
}
void CompileShader(const ShaderArgs& args, int extraCount = 0, const char** extras = NULL)
{
static char temp[4096];
@ -119,7 +130,7 @@ void CompileSMAAShader(const SMAAArgs& smaaArgs)
{
const char* extras[] =
{
"-Vn", smaaArgs.variableName,
"-Vn", HeaderVariable(smaaArgs.variableName),
smaaArgs.presetMacro,
smaaArgs.vertexShader ? "-D SMAA_INCLUDE_VS=1" : "-D SMAA_INCLUDE_PS=1",
"-D SMAA_HLSL_5_1=1",
@ -159,9 +170,49 @@ void CompileSMAAShaders()
ProcessSMAAShadersForPreset("ultra", "-D SMAA_PRESET_ULTRA=1");
}
void CompileVS(const char* headerPath, const char* shaderPath)
void CompileGraphics(const char* headerPath, const char* shaderPath, const char* varName)
{
const char* extras[] = { "-D VERTEX_SHADER=1" };
const char* vsHeaderRelPath = va("%s.vs.h", shaderPath);
const char* psHeaderRelPath = va("%s.ps.h", shaderPath);
const char* vsHeaderPath = OutputPath(vsHeaderRelPath);
const char* psHeaderPath = OutputPath(psHeaderRelPath);
const char* vsExtras[] =
{
"-D", "VERTEX_SHADER=1",
"-Vn", HeaderVariable(va("g_%s_vs", varName))
};
const char* psExtras[] =
{
"-D", "PIXEL_SHADER=1",
"-Vn", HeaderVariable(va("g_%s_ps", varName))
};
ShaderArgs args;
args.entryPoint = "vs";
args.headerPath = vsHeaderRelPath;
args.shaderPath = shaderPath;
args.targetProfile = targetVS;
CompileShader(args, _countof(vsExtras), vsExtras);
args.entryPoint = "ps";
args.headerPath = psHeaderRelPath;
args.shaderPath = shaderPath;
args.targetProfile = targetPS;
CompileShader(args, _countof(psExtras), psExtras);
const char* outHeaderPath = OutputPath(headerPath);
system(va("type %s %s > %s", vsHeaderPath, psHeaderPath, outHeaderPath));
system(va("del %s", vsHeaderPath));
system(va("del %s", psHeaderPath));
}
void CompileVertexShader(const char* headerPath, const char* shaderPath, const char* varName)
{
const char* extras[] =
{
"-D", "VERTEX_SHADER=1",
"-Vn", HeaderVariable(va("g_%s_vs", varName))
};
ShaderArgs args;
args.entryPoint = "vs";
@ -171,9 +222,13 @@ void CompileVS(const char* headerPath, const char* shaderPath)
CompileShader(args, _countof(extras), extras);
}
void CompilePS(const char* headerPath, const char* shaderPath)
void CompilePixelShader(const char* headerPath, const char* shaderPath, const char* varName)
{
const char* extras[] = { "-D PIXEL_SHADER=1" };
const char* extras[] =
{
"-D", "PIXEL_SHADER=1",
"-Vn", HeaderVariable(va("g_%s_ps", varName))
};
ShaderArgs args;
args.entryPoint = "ps";
@ -183,9 +238,13 @@ void CompilePS(const char* headerPath, const char* shaderPath)
CompileShader(args, _countof(extras), extras);
}
void CompileCS(const char* headerPath, const char* shaderPath)
void CompileCompute(const char* headerPath, const char* shaderPath, const char* varName)
{
const char* extras[] = { "-D COMPUTE_SHADER=1" };
const char* extras[] =
{
"-D", "COMPUTE_SHADER=1",
"-Vn", HeaderVariable(va("g_%s_cs", varName))
};
ShaderArgs args;
args.entryPoint = "cs";
@ -195,19 +254,13 @@ void CompileCS(const char* headerPath, const char* shaderPath)
CompileShader(args, _countof(extras), extras);
}
void CompileVSAndPS(const char* headerPathPrefix, const char* shaderPath)
{
CompileVS(va("%s_vs.h", headerPathPrefix), shaderPath);
CompilePS(va("%s_ps.h", headerPathPrefix), shaderPath);
}
void CompileUberVS(const char* headerPath, const char* shaderPath, int stageCount)
{
const char* extras[] =
{
"-D VERTEX_SHADER=1",
va("-D STAGE_COUNT=%d", stageCount),
va("-Vn g_vs_%d", stageCount)
"-D", "VERTEX_SHADER=1",
"-D", va("STAGE_COUNT=%d", stageCount),
"-Vn", HeaderVariable(va("g_vs_%d", stageCount))
};
ShaderArgs args;
@ -229,7 +282,7 @@ void CompileUberPS(const char* stateString)
const char* extras[16];
int extraCount = 0;
extras[extraCount++] = va("-Vn g_ps_%s", stateString);
extras[extraCount++] = va("-Vn %s", HeaderVariable(va("g_ps_%s", stateString)));
extras[extraCount++] = "-D USE_INCLUDES=1";
extras[extraCount++] = "-D PIXEL_SHADER=1";
if(state.globalState & UBERPS_DITHER_BIT)
@ -283,19 +336,19 @@ void ProcessGRP()
targetPS = "ps_6_0";
targetCS = "cs_6_0";
CompileVSAndPS("post_gamma", "post_gamma.hlsl");
CompileVSAndPS("post_inverse_gamma", "post_inverse_gamma.hlsl");
CompileVSAndPS("imgui", "imgui.hlsl");
CompileVSAndPS("nuklear", "nuklear.hlsl");
CompileVSAndPS("ui", "ui.hlsl");
CompileVSAndPS("depth_pre_pass", "depth_pre_pass.hlsl");
CompileVSAndPS("dynamic_light", "dynamic_light.hlsl");
CompileVS("fog_vs.h", "fog_inside.hlsl");
CompilePS("fog_inside_ps.h", "fog_inside.hlsl");
CompilePS("fog_outside_ps.h", "fog_outside.hlsl");
CompileCS("mip_1_cs.h", "mip_1.hlsl");
CompileCS("mip_2_cs.h", "mip_2.hlsl");
CompileCS("mip_3_cs.h", "mip_3.hlsl");
CompileGraphics("post_gamma.h", "post_gamma.hlsl", "post");
CompileGraphics("post_inverse_gamma.h", "post_inverse_gamma.hlsl", "post_inverse");
CompileGraphics("imgui.h", "imgui.hlsl", "imgui");
CompileGraphics("nuklear.h", "nuklear.hlsl", "nuklear");
CompileGraphics("ui.h", "ui.hlsl", "ui");
CompileGraphics("depth_pre_pass.h", "depth_pre_pass.hlsl", "zpp");
CompileGraphics("dynamic_light.h", "dynamic_light.hlsl", "dl");
CompileVertexShader("fog.h", "fog_inside.hlsl", "fog");
CompilePixelShader("fog_inside.h", "fog_inside.hlsl", "fog_inside");
CompilePixelShader("fog_outside.h", "fog_outside.hlsl", "fog_outside");
CompileCompute("mip_1.h", "mip_1.hlsl", "mip_1");
CompileCompute("mip_2.h", "mip_2.hlsl", "mip_2");
CompileCompute("mip_3.h", "mip_3.hlsl", "mip_3");
CompileSMAAShaders();
system(va("type %s\\smaa*.h > %s\\complete_smaa.h", outputPath, outputPath));
@ -327,31 +380,31 @@ void ProcessCRP()
targetPS = "ps_6_6";
targetCS = "cs_6_6";
CompileVSAndPS("blit", "blit.hlsl");
CompileVSAndPS("ui", "ui.hlsl");
CompileVSAndPS("imgui", "imgui.hlsl");
CompileVSAndPS("nuklear", "nuklear.hlsl");
CompileCS("mip_1_cs.h", "mip_1.hlsl");
CompileCS("mip_2_cs.h", "mip_2.hlsl");
CompileCS("mip_3_cs.h", "mip_3.hlsl");
CompileVSAndPS("opaque", "opaque.hlsl");
CompileVSAndPS("transp_draw", "transp_draw.hlsl");
CompileVSAndPS("transp_resolve", "transp_resolve.hlsl");
CompileVSAndPS("tone_map", "tone_map.hlsl");
CompileVSAndPS("tone_map_inverse", "tone_map_inverse.hlsl");
CompileVSAndPS("accumdof_accum", "accumdof_accum.hlsl");
CompileVSAndPS("accumdof_norm", "accumdof_norm.hlsl");
CompileVSAndPS("accumdof_debug", "accumdof_debug.hlsl");
CompileCS("gatherdof_split.h", "gatherdof_split.hlsl");
CompileCS("gatherdof_coc_tile_gen.h", "gatherdof_coc_tile_gen.hlsl");
CompileCS("gatherdof_coc_tile_max.h", "gatherdof_coc_tile_max.hlsl");
CompileCS("gatherdof_blur.h", "gatherdof_blur.hlsl");
CompileCS("gatherdof_fill.h", "gatherdof_fill.hlsl");
CompileVSAndPS("gatherdof_combine", "gatherdof_combine.hlsl");
CompileVSAndPS("gatherdof_debug", "gatherdof_debug.hlsl");
CompileVSAndPS("fog_inside", "fog_inside.hlsl");
CompileVSAndPS("fog_outside", "fog_outside.hlsl");
CompileVertexShader("fullscreen.h", "fullscreen.hlsl", "fullscreen");
CompilePixelShader("blit.h", "blit.hlsl", "blit");
CompileGraphics("ui.h", "ui.hlsl", "ui");
CompileGraphics("imgui.h", "imgui.hlsl", "imgui");
CompileGraphics("nuklear.h", "nuklear.hlsl", "nuklear");
CompileCompute("mip_1.h", "mip_1.hlsl", "mip_1");
CompileCompute("mip_2.h", "mip_2.hlsl", "mip_2");
CompileCompute("mip_3.h", "mip_3.hlsl", "mip_3");
CompileGraphics("opaque.h", "opaque.hlsl", "opaque");
CompileGraphics("transp_draw.h", "transp_draw.hlsl", "transp_draw");
CompilePixelShader("transp_resolve.h", "transp_resolve.hlsl", "transp_resolve");
CompilePixelShader("tone_map.h", "tone_map.hlsl", "tone_map");
CompilePixelShader("tone_map_inverse.h", "tone_map_inverse.hlsl", "tone_map_inverse");
CompilePixelShader("accumdof_accum.h", "accumdof_accum.hlsl", "accum");
CompilePixelShader("accumdof_norm.h", "accumdof_norm.hlsl", "norm");
CompilePixelShader("accumdof_debug.h", "accumdof_debug.hlsl", "debug");
CompileCompute("gatherdof_split.h", "gatherdof_split.hlsl", "split");
CompileCompute("gatherdof_coc_tile_gen.h", "gatherdof_coc_tile_gen.hlsl", "coc_tile_gen");
CompileCompute("gatherdof_coc_tile_max.h", "gatherdof_coc_tile_max.hlsl", "coc_tile_max");
CompileCompute("gatherdof_blur.h", "gatherdof_blur.hlsl", "blur");
CompileCompute("gatherdof_fill.h", "gatherdof_fill.hlsl", "fill");
CompilePixelShader("gatherdof_combine.h", "gatherdof_combine.hlsl", "combine");
CompilePixelShader("gatherdof_debug.h", "gatherdof_debug.hlsl", "debug");
CompileGraphics("fog_inside.h", "fog_inside.hlsl", "inside");
CompileGraphics("fog_outside.h", "fog_outside.hlsl", "outside");
}
int main(int /*argc*/, const char** argv)

View file

@ -656,6 +656,12 @@ solution "cnq3"
if os.istarget("windows") then
files { string.format("%s/renderer/shaders/**.hlsl", path_src) }
files { string.format("%s/renderer/shaders/**.hlsli", path_src) }
--[[ remap file paths to not have a top-level "shaders" filter
vpaths { ["shaders_common"] = string.format("%s/renderer/shaders/common", path_src) }
vpaths { ["shaders_grp"] = string.format("%s/renderer/shaders/grp", path_src) }
vpaths { ["shaders_crp"] = string.format("%s/renderer/shaders/crp", path_src) }
vpaths { [""] = string.format("%s/renderer", path_src) }
--]]
filter "files:**.hlsl"
flags { "ExcludeFromBuild" }
filter { }

View file

@ -190,6 +190,9 @@
<FxCompile Include="..\..\code\renderer\shaders\crp\fog_outside.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\fullscreen.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\gatherdof_blur.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
@ -300,6 +303,7 @@
<None Include="..\..\code\renderer\shaders\crp\common.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\dof.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\fog.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\fullscreen.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\gatherdof.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\oit.h.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\world.h.hlsli" />

View file

@ -94,6 +94,9 @@
<FxCompile Include="..\..\code\renderer\shaders\crp\fog_outside.hlsl">
<Filter>shaders\crp</Filter>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\fullscreen.hlsl">
<Filter>shaders\crp</Filter>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\gatherdof_blur.hlsl">
<Filter>shaders\crp</Filter>
</FxCompile>
@ -216,6 +219,9 @@
<None Include="..\..\code\renderer\shaders\crp\fog.hlsli">
<Filter>shaders\crp</Filter>
</None>
<None Include="..\..\code\renderer\shaders\crp\fullscreen.hlsli">
<Filter>shaders\crp</Filter>
</None>
<None Include="..\..\code\renderer\shaders\crp\gatherdof.hlsli">
<Filter>shaders\crp</Filter>
</None>

View file

@ -192,6 +192,9 @@
<FxCompile Include="..\..\code\renderer\shaders\crp\fog_outside.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\fullscreen.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\gatherdof_blur.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
@ -302,6 +305,7 @@
<None Include="..\..\code\renderer\shaders\crp\common.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\dof.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\fog.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\fullscreen.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\gatherdof.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\oit.h.hlsli" />
<None Include="..\..\code\renderer\shaders\crp\world.h.hlsli" />

View file

@ -94,6 +94,9 @@
<FxCompile Include="..\..\code\renderer\shaders\crp\fog_outside.hlsl">
<Filter>shaders\crp</Filter>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\fullscreen.hlsl">
<Filter>shaders\crp</Filter>
</FxCompile>
<FxCompile Include="..\..\code\renderer\shaders\crp\gatherdof_blur.hlsl">
<Filter>shaders\crp</Filter>
</FxCompile>
@ -216,6 +219,9 @@
<None Include="..\..\code\renderer\shaders\crp\fog.hlsli">
<Filter>shaders\crp</Filter>
</None>
<None Include="..\..\code\renderer\shaders\crp\fullscreen.hlsli">
<Filter>shaders\crp</Filter>
</None>
<None Include="..\..\code\renderer\shaders\crp\gatherdof.hlsli">
<Filter>shaders\crp</Filter>
</None>