mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
added debug label scopes and pipeline creation helpers
This commit is contained in:
parent
f4833d9c61
commit
490617de7a
13 changed files with 85 additions and 164 deletions
|
@ -128,33 +128,21 @@ void AccumDepthOfField::Init()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("DOF Accumulate");
|
GraphicsPipelineDesc desc("DOF Accumulate");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_accum_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);
|
desc.AddRenderTarget(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE, crp.renderTargetFormat);
|
||||||
accumPipeline = CreateGraphicsPipeline(desc);
|
accumPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("DOF Normalize");
|
GraphicsPipelineDesc desc("DOF Normalize");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_norm_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);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
normPipeline = CreateGraphicsPipeline(desc);
|
normPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("DOF Debug");
|
GraphicsPipelineDesc desc("DOF Debug");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_debug_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);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
debugPipeline = CreateGraphicsPipeline(desc);
|
debugPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,59 +143,22 @@ void GatherDepthOfField::Init()
|
||||||
tileTextureWidth = (uint32_t)(glConfig.vidWidth + 15) / 16;
|
tileTextureWidth = (uint32_t)(glConfig.vidWidth + 15) / 16;
|
||||||
tileTextureHeight = (uint32_t)(glConfig.vidHeight + 15) / 16;
|
tileTextureHeight = (uint32_t)(glConfig.vidHeight + 15) / 16;
|
||||||
|
|
||||||
{
|
splitPipeline = CreateComputePipeline("DOF split", ShaderByteCode(g_split_cs));
|
||||||
ComputePipelineDesc desc("DOF split");
|
nearCocTileGenPipeline = CreateComputePipeline("DOF near CoC tile generation", ShaderByteCode(g_coc_tile_gen_cs));
|
||||||
desc.shortLifeTime = true;
|
nearCocTileMaxPipeline = CreateComputePipeline("DOF near CoC tile dilation", ShaderByteCode(g_coc_tile_max_cs));
|
||||||
desc.shader = ShaderByteCode(g_split_cs);
|
blurPipeline = CreateComputePipeline("DOF blur", ShaderByteCode(g_blur_cs));
|
||||||
splitPipeline = CreateComputePipeline(desc);
|
fillPipeline = CreateComputePipeline("DOF fill", ShaderByteCode(g_fill_cs));
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ComputePipelineDesc desc("DOF near CoC tile generation");
|
|
||||||
desc.shortLifeTime = true;
|
|
||||||
desc.shader = ShaderByteCode(g_coc_tile_gen_cs);
|
|
||||||
nearCocTileGenPipeline = CreateComputePipeline(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ComputePipelineDesc desc("DOF near CoC tile dilation");
|
|
||||||
desc.shortLifeTime = true;
|
|
||||||
desc.shader = ShaderByteCode(g_coc_tile_max_cs);
|
|
||||||
nearCocTileMaxPipeline = CreateComputePipeline(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ComputePipelineDesc desc("DOF blur");
|
|
||||||
desc.shortLifeTime = true;
|
|
||||||
desc.shader = ShaderByteCode(g_blur_cs);
|
|
||||||
blurPipeline = CreateComputePipeline(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ComputePipelineDesc desc("DOF fill");
|
|
||||||
desc.shortLifeTime = true;
|
|
||||||
desc.shader = ShaderByteCode(g_fill_cs);
|
|
||||||
fillPipeline = CreateComputePipeline(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("DOF combine");
|
GraphicsPipelineDesc desc("DOF combine");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_combine_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);
|
desc.AddRenderTarget(0, renderTargetFormat);
|
||||||
combinePipeline = CreateGraphicsPipeline(desc);
|
combinePipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("DOF viz");
|
GraphicsPipelineDesc desc("DOF viz");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_debug_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);
|
desc.AddRenderTarget(0, renderTargetFormat);
|
||||||
debugPipeline = CreateGraphicsPipeline(desc);
|
debugPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
@ -244,6 +207,8 @@ void GatherDepthOfField::Draw()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCOPED_RENDER_PASS("Gather DOF", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
DrawSplit();
|
DrawSplit();
|
||||||
DrawNearCocTileGen();
|
DrawNearCocTileGen();
|
||||||
DrawNearCocTileMax();
|
DrawNearCocTileMax();
|
||||||
|
@ -260,7 +225,7 @@ void GatherDepthOfField::DrawDebug()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("DOF Debug", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Debug", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
crp.SwapRenderTargets();
|
crp.SwapRenderTargets();
|
||||||
|
|
||||||
|
@ -289,7 +254,7 @@ void GatherDepthOfField::DrawDebug()
|
||||||
|
|
||||||
void GatherDepthOfField::DrawSplit()
|
void GatherDepthOfField::DrawSplit()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DOF Split", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Split", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(crp.depthTexture, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(crp.depthTexture, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -321,7 +286,7 @@ void GatherDepthOfField::DrawSplit()
|
||||||
|
|
||||||
void GatherDepthOfField::DrawNearCocTileGen()
|
void GatherDepthOfField::DrawNearCocTileGen()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DOF Tile Gen", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Tile Gen", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(nearCocTexture, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(nearCocTexture, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -339,7 +304,7 @@ void GatherDepthOfField::DrawNearCocTileGen()
|
||||||
|
|
||||||
void GatherDepthOfField::DrawNearCocTileMax()
|
void GatherDepthOfField::DrawNearCocTileMax()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DOF Tile Max", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Tile Max", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(nearCocTileTexture, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(nearCocTileTexture, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -358,7 +323,7 @@ void GatherDepthOfField::DrawNearCocTileMax()
|
||||||
|
|
||||||
void GatherDepthOfField::DrawBlur()
|
void GatherDepthOfField::DrawBlur()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DOF Blur", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Blur", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(crp.renderTarget, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(crp.renderTarget, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -392,7 +357,7 @@ void GatherDepthOfField::DrawBlur()
|
||||||
|
|
||||||
void GatherDepthOfField::DrawFill()
|
void GatherDepthOfField::DrawFill()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DOF Fill", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Fill", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(nearBlurTexture, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(nearBlurTexture, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -415,7 +380,7 @@ void GatherDepthOfField::DrawFill()
|
||||||
|
|
||||||
void GatherDepthOfField::DrawCombine()
|
void GatherDepthOfField::DrawCombine()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DOF Combine", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("DOF Combine", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(nearColorTexture, ResourceStates::PixelShaderAccessBit);
|
CmdTextureBarrier(nearColorTexture, ResourceStates::PixelShaderAccessBit);
|
||||||
|
|
|
@ -52,22 +52,14 @@ void DynamicLights::Init()
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("Dynamic Lights");
|
GraphicsPipelineDesc desc("Dynamic Lights");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_dl_draw_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_dl_draw_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
pipeline = CreateGraphicsPipeline(desc);
|
pipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("Dynamic Lights Denoising");
|
GraphicsPipelineDesc desc("Dynamic Lights Denoising");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_dl_denoising_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_dl_denoising_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
denoisingPipeline = CreateGraphicsPipeline(desc);
|
denoisingPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +87,7 @@ void DynamicLights::Draw()
|
||||||
srp.renderMode = RenderMode::None;
|
srp.renderMode = RenderMode::None;
|
||||||
|
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("Dynamic Lights", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("DL Draw", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
@ -114,7 +106,7 @@ void DynamicLights::Draw()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("DL Denoising", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("DL Denoise", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
|
|
@ -63,44 +63,28 @@ void GBufferViz::Init()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("G-Buffer Depth");
|
GraphicsPipelineDesc desc("G-Buffer Depth");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_gbufferviz_depth_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_gbufferviz_depth_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
linearizeDepthPipeline = CreateGraphicsPipeline(desc);
|
linearizeDepthPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("G-Buffer Normal");
|
GraphicsPipelineDesc desc("G-Buffer Normal");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_gbufferviz_normal_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_gbufferviz_normal_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
decodeNormalsPipeline = CreateGraphicsPipeline(desc);
|
decodeNormalsPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("G-Buffer Position");
|
GraphicsPipelineDesc desc("G-Buffer Position");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_gbufferviz_position_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_gbufferviz_position_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
decodeShadingPositionPipeline = CreateGraphicsPipeline(desc);
|
decodeShadingPositionPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("G-Buffer Motion");
|
GraphicsPipelineDesc desc("G-Buffer Motion");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_gbufferviz_motion_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_gbufferviz_motion_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
motionVectorPipeline = CreateGraphicsPipeline(desc);
|
motionVectorPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +105,7 @@ void GBufferViz::DrawGUI()
|
||||||
{
|
{
|
||||||
srp.renderMode = RenderMode::None;
|
srp.renderMode = RenderMode::None;
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Debug Depth", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Debug Depth", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
@ -144,7 +128,7 @@ void GBufferViz::DrawGUI()
|
||||||
{
|
{
|
||||||
srp.renderMode = RenderMode::None;
|
srp.renderMode = RenderMode::None;
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Debug Normal", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Debug Normal", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
@ -165,7 +149,7 @@ void GBufferViz::DrawGUI()
|
||||||
{
|
{
|
||||||
srp.renderMode = RenderMode::None;
|
srp.renderMode = RenderMode::None;
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Debug Position", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Debug Position", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
@ -193,7 +177,7 @@ void GBufferViz::DrawGUI()
|
||||||
crp.motionVectorTexture :
|
crp.motionVectorTexture :
|
||||||
crp.motionVectorMBTexture;
|
crp.motionVectorMBTexture;
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Debug Motion", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Debug Motion", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
|
|
@ -561,4 +561,7 @@ struct CRP : IRenderPipeline
|
||||||
GBufferViz gbufferViz;
|
GBufferViz gbufferViz;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HPipeline CreateComputePipeline(const char* name, const ShaderByteCode& shader);
|
||||||
|
void MakeFullScreenPipeline(GraphicsPipelineDesc& desc, const ShaderByteCode& pixelShader);
|
||||||
|
|
||||||
extern CRP crp;
|
extern CRP crp;
|
||||||
|
|
|
@ -44,11 +44,7 @@ struct MagnifierRC
|
||||||
void Magnifier::Init()
|
void Magnifier::Init()
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("Magnifier");
|
GraphicsPipelineDesc desc("Magnifier");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_magnifier_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_magnifier_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
pipeline = CreateGraphicsPipeline(desc);
|
pipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,6 +246,22 @@ static HTexture LoadTexture(const char* name, int flags, textureWrap_t glWrapCla
|
||||||
return image->texture;
|
return image->texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HPipeline CreateComputePipeline(const char* name, const ShaderByteCode& shader)
|
||||||
|
{
|
||||||
|
ComputePipelineDesc desc(name);
|
||||||
|
desc.shortLifeTime = true;
|
||||||
|
desc.shader = shader;
|
||||||
|
|
||||||
|
return CreateComputePipeline(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeFullScreenPipeline(GraphicsPipelineDesc& desc, const ShaderByteCode& pixelShader)
|
||||||
|
{
|
||||||
|
desc.shortLifeTime = true;
|
||||||
|
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
||||||
|
desc.pixelShader = pixelShader;
|
||||||
|
desc.SetPostProcessState();
|
||||||
|
}
|
||||||
|
|
||||||
void PSOCache::Init(Entry* entries_, uint32_t maxEntryCount_)
|
void PSOCache::Init(Entry* entries_, uint32_t maxEntryCount_)
|
||||||
{
|
{
|
||||||
|
@ -485,11 +501,7 @@ void CRP::Init()
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("blit LDR");
|
GraphicsPipelineDesc desc("blit LDR");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_blit_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::R8G8B8A8_UNorm);
|
desc.AddRenderTarget(0, TextureFormat::R8G8B8A8_UNorm);
|
||||||
blitPipelineLDR = CreateGraphicsPipeline(desc);
|
blitPipelineLDR = CreateGraphicsPipeline(desc);
|
||||||
desc.name = "blit HDR";
|
desc.name = "blit HDR";
|
||||||
|
@ -609,7 +621,7 @@ void CRP::EndFrame()
|
||||||
|
|
||||||
void CRP::Blit(HTexture destination, HTexture source, const char* passName, bool hdr, const vec2_t tcScale, const vec2_t tcBias)
|
void CRP::Blit(HTexture destination, HTexture source, const char* passName, bool hdr, const vec2_t tcScale, const vec2_t tcBias)
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS(passName, 0.125f, 0.125f, 0.5f);
|
SCOPED_DEBUG_LABEL(passName, 0.125f, 0.125f, 0.5f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(source, ResourceStates::PixelShaderAccessBit);
|
CmdTextureBarrier(source, ResourceStates::PixelShaderAccessBit);
|
||||||
|
@ -909,7 +921,7 @@ void CRP::UploadSceneViewData()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Scene View Upload", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Scene View Upload", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
const trRefdef_t& refdef = backEnd.refdef;
|
const trRefdef_t& refdef = backEnd.refdef;
|
||||||
const viewParms_t& vp = backEnd.viewParms;
|
const viewParms_t& vp = backEnd.viewParms;
|
||||||
|
|
|
@ -70,36 +70,17 @@ void MotionBlur::Init()
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("MBlur velocity/depth packing");
|
GraphicsPipelineDesc desc("MBlur velocity/depth packing");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_pack_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_pack_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, TextureFormat::R32G32_UInt);
|
desc.AddRenderTarget(0, TextureFormat::R32G32_UInt);
|
||||||
packPipeline = CreateGraphicsPipeline(desc);
|
packPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
tileGenPipeline = CreateComputePipeline("MBlur tile generation", ShaderByteCode(g_tile_gen_cs));
|
||||||
ComputePipelineDesc desc("MBlur tile generation");
|
tileMaxPipeline = CreateComputePipeline("MBlur tile dilation", ShaderByteCode(g_tile_max_cs));
|
||||||
desc.shortLifeTime = true;
|
|
||||||
desc.shader = ShaderByteCode(g_tile_gen_cs);
|
|
||||||
tileGenPipeline = CreateComputePipeline(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ComputePipelineDesc desc("MBlur tile dilation");
|
|
||||||
desc.shortLifeTime = true;
|
|
||||||
desc.shader = ShaderByteCode(g_tile_max_cs);
|
|
||||||
tileMaxPipeline = CreateComputePipeline(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("MBlur reconstruction filter");
|
GraphicsPipelineDesc desc("MBlur reconstruction filter");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_blur_ps));
|
||||||
desc.vertexShader = ShaderByteCode(g_fullscreen_vs);
|
|
||||||
desc.pixelShader = ShaderByteCode(g_blur_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
blurPipeline = CreateGraphicsPipeline(desc);
|
blurPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
@ -136,6 +117,8 @@ void MotionBlur::Draw()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCOPED_RENDER_PASS("Motion Blur", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
DrawPack();
|
DrawPack();
|
||||||
DrawTileGen();
|
DrawTileGen();
|
||||||
DrawTileMax();
|
DrawTileMax();
|
||||||
|
@ -144,7 +127,7 @@ void MotionBlur::Draw()
|
||||||
|
|
||||||
void MotionBlur::DrawPack()
|
void MotionBlur::DrawPack()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("MBlur Pack", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("MBlur Pack", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(crp.motionVectorMBTexture, ResourceStates::PixelShaderAccessBit);
|
CmdTextureBarrier(crp.motionVectorMBTexture, ResourceStates::PixelShaderAccessBit);
|
||||||
|
@ -164,7 +147,7 @@ void MotionBlur::DrawPack()
|
||||||
|
|
||||||
void MotionBlur::DrawTileGen()
|
void MotionBlur::DrawTileGen()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("MBlur Tile Gen", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("MBlur Tile Gen", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(packedTexture, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(packedTexture, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -182,7 +165,7 @@ void MotionBlur::DrawTileGen()
|
||||||
|
|
||||||
void MotionBlur::DrawTileMax()
|
void MotionBlur::DrawTileMax()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("MBlur Tile Max", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("MBlur Tile Max", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
CmdBeginBarrier();
|
CmdBeginBarrier();
|
||||||
CmdTextureBarrier(tileTexture, ResourceStates::ComputeShaderAccessBit);
|
CmdTextureBarrier(tileTexture, ResourceStates::ComputeShaderAccessBit);
|
||||||
|
@ -201,7 +184,7 @@ void MotionBlur::DrawTileMax()
|
||||||
|
|
||||||
void MotionBlur::DrawBlur()
|
void MotionBlur::DrawBlur()
|
||||||
{
|
{
|
||||||
SCOPED_RENDER_PASS("MBlur Blur", 0.125f, 0.125f, 0.25f);
|
SCOPED_DEBUG_LABEL("MBlur Blur", 0.125f, 0.125f, 0.25f);
|
||||||
|
|
||||||
crp.SwapRenderTargets();
|
crp.SwapRenderTargets();
|
||||||
|
|
||||||
|
|
|
@ -147,11 +147,7 @@ void Prepass::Init()
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("Skybox Motion Vectors");
|
GraphicsPipelineDesc desc("Skybox Motion Vectors");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_skybox_motion_ps));
|
||||||
desc.vertexShader.Set(g_fullscreen_vs);
|
|
||||||
desc.pixelShader.Set(g_skybox_motion_ps);
|
|
||||||
desc.depthStencil.DisableDepth();
|
|
||||||
desc.rasterizer.cullMode = CT_TWO_SIDED;
|
|
||||||
desc.AddRenderTarget(0, TextureFormat::R16G16_Float);
|
desc.AddRenderTarget(0, TextureFormat::R16G16_Float);
|
||||||
skyboxMotionPipeline = CreateGraphicsPipeline(desc);
|
skyboxMotionPipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,22 +53,14 @@ void ToneMap::Init()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("Tone Map");
|
GraphicsPipelineDesc desc("Tone Map");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_tone_map_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);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
pipeline = CreateGraphicsPipeline(desc);
|
pipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("Inverse Tone Map");
|
GraphicsPipelineDesc desc("Inverse Tone Map");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_tone_map_inverse_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);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
pipeline = CreateGraphicsPipeline(desc);
|
pipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +70,7 @@ void ToneMap::DrawToneMap()
|
||||||
{
|
{
|
||||||
srp.renderMode = RenderMode::None;
|
srp.renderMode = RenderMode::None;
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Tone Map", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Tone Map", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
@ -106,7 +98,7 @@ void ToneMap::DrawInverseToneMap()
|
||||||
{
|
{
|
||||||
srp.renderMode = RenderMode::None;
|
srp.renderMode = RenderMode::None;
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Inverse Tone Map", 1.0f, 1.0f, 1.0f);
|
SCOPED_DEBUG_LABEL("Inverse Tone Map", 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,7 @@ struct TranspResolveRC
|
||||||
void TranspResolve::Init()
|
void TranspResolve::Init()
|
||||||
{
|
{
|
||||||
GraphicsPipelineDesc desc("OIT Resolve");
|
GraphicsPipelineDesc desc("OIT Resolve");
|
||||||
desc.shortLifeTime = true;
|
MakeFullScreenPipeline(desc, ShaderByteCode(g_transp_resolve_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);
|
desc.AddRenderTarget(0, crp.renderTargetFormat);
|
||||||
pipeline = CreateGraphicsPipeline(desc);
|
pipeline = CreateGraphicsPipeline(desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ void ImGUI::Draw(HTexture renderTarget)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_RENDER_PASS("Dear ImGUI", 0.5f, 0.5f, 1.0f);
|
SCOPED_DEBUG_LABEL("Dear ImGUI", 0.5f, 0.5f, 1.0f);
|
||||||
|
|
||||||
FrameResources* fr = &frameResources[GetFrameIndex()];
|
FrameResources* fr = &frameResources[GetFrameIndex()];
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,21 @@ struct ScopedRenderPass
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ScopedDebugLabel
|
||||||
|
{
|
||||||
|
ScopedDebugLabel(const char* name, float r, float g, float b)
|
||||||
|
{
|
||||||
|
CmdBeginDebugLabel(name, r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopedDebugLabel()
|
||||||
|
{
|
||||||
|
CmdEndDebugLabel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#define SCOPED_RENDER_PASS(Name, R, G, B) ScopedRenderPass CONCAT(rp_, __LINE__)(Name, R, G, B)
|
#define SCOPED_RENDER_PASS(Name, R, G, B) ScopedRenderPass CONCAT(rp_, __LINE__)(Name, R, G, B)
|
||||||
|
#define SCOPED_DEBUG_LABEL(Name, R, G, B) ScopedDebugLabel CONCAT(rp_, __LINE__)(Name, R, G, B)
|
||||||
|
|
||||||
#define BASE_SAMPLER_COUNT ((int)(TW_COUNT * TextureFilter::Count * MaxTextureMips))
|
#define BASE_SAMPLER_COUNT ((int)(TW_COUNT * TextureFilter::Count * MaxTextureMips))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue