Skip to content

Commit

Permalink
Add new SMAA binding layout types to push constant subset mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
SRSaunders committed Nov 27, 2024
1 parent 370d969 commit 7f4fcc2
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
10 changes: 4 additions & 6 deletions neo/renderer/NVRHI/RenderBackend_NVRHI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1572,14 +1572,13 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
{
desc[0].bindings =
{
nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ),
uniformsBindingSetItem,
nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() )
};
}
else
{
desc[0].bindings[0].resourceHandle = paramCb;
desc[0].bindings[0].range = range;
desc[0].bindings[0] = uniformsBindingSetItem;
desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID();
}

Expand All @@ -1603,16 +1602,15 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
{
desc[0].bindings =
{
nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ),
uniformsBindingSetItem,
nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ),
nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ),
nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() )
};
}
else
{
desc[0].bindings[0].resourceHandle = paramCb;
desc[0].bindings[0].range = range;
desc[0].bindings[0] = uniformsBindingSetItem;
desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID();
desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID();
desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID();
Expand Down
2 changes: 1 addition & 1 deletion neo/renderer/RenderProgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ const idList<bindingLayoutType_t, TAG_RENDER> rpMinimalSet1LayoutTypes = { BINDI

const idList<renderParm_t, TAG_RENDER> rpMinimalSet2 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET };

const idList<bindingLayoutType_t, TAG_RENDER> rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_POST_PROCESS_CRT };
const idList<bindingLayoutType_t, TAG_RENDER> rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_POST_PROCESS_CRT, BINDING_LAYOUT_SMAA_EDGE_DETECTION, BINDING_LAYOUT_SMAA_WEIGHT_CALC };

// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan
const idList<renderParm_t, TAG_RENDER> rpNominalSet3 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_PROJMATRIX_W, RENDERPARM_PSX_DISTORTIONS };
Expand Down
4 changes: 2 additions & 2 deletions neo/shaders/builtin/post/SMAA.inc.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Copyright (C) 2013 Jorge Jimenez ([email protected])
* Copyright (C) 2013 Jose I. Echevarria ([email protected])
* Copyright (C) 2013 Belen Masia ([email protected])
Expand Down Expand Up @@ -296,7 +296,7 @@
*/

// RB begin
#define SMAA_RT_METRICS rpScreenCorrectionFactor
#define SMAA_RT_METRICS pc.rpScreenCorrectionFactor
#define SMAA_PRESET_HIGH
// RB end

Expand Down
2 changes: 1 addition & 1 deletion neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "global_inc.hlsl"
#include "renderParmSet1.inc.hlsl"
#include "renderParmSet2.inc.hlsl"


#define SMAA_INCLUDE_VS 0
Expand Down
2 changes: 1 addition & 1 deletion neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "global_inc.hlsl"
#include "renderParmSet1.inc.hlsl"
#include "renderParmSet2.inc.hlsl"


#define SMAA_INCLUDE_VS 1
Expand Down
2 changes: 1 addition & 1 deletion neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "global_inc.hlsl"
#include "renderParmSet1.inc.hlsl"
#include "renderParmSet2.inc.hlsl"


#define SMAA_INCLUDE_VS 0
Expand Down
2 changes: 1 addition & 1 deletion neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "global_inc.hlsl"
#include "renderParmSet1.inc.hlsl"
#include "renderParmSet2.inc.hlsl"


#define SMAA_INCLUDE_VS 1
Expand Down
2 changes: 1 addition & 1 deletion neo/shaders/builtin/post/SMAA_final.ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "global_inc.hlsl"
#include "renderParmSet1.inc.hlsl"
#include "renderParmSet2.inc.hlsl"


#define SMAA_INCLUDE_VS 0
Expand Down
2 changes: 1 addition & 1 deletion neo/shaders/builtin/post/SMAA_final.vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "global_inc.hlsl"
#include "renderParmSet1.inc.hlsl"
#include "renderParmSet2.inc.hlsl"


#define SMAA_INCLUDE_VS 1
Expand Down

0 comments on commit 7f4fcc2

Please sign in to comment.