Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
18b9e73
Remove incorrect ResourceFlags.
overdesigned Jan 28, 2024
c4c93a6
Allow non-zero terminated nodeDecl name.
overdesigned Jan 28, 2024
5387875
Allow multiple compatible accesses by the same node.
overdesigned Jan 28, 2024
30c511f
Add result checks.
overdesigned Jan 28, 2024
5a8af94
Fix incorrect cmd batch cmd printing.
overdesigned Feb 22, 2024
fe8c411
Add an isAccessed flag to avoid transitioning unaccessed persistent r…
overdesigned Feb 22, 2024
64399b8
Visualizer: fix crash when graph is empty.
overdesigned Feb 22, 2024
bb2c6a5
Fix vk validation errors with SDK 1.3.275:
overdesigned Feb 22, 2024
d4e6f9f
Update dx agility sdk to 1.613.0.
overdesigned Mar 15, 2024
e2eaf97
Fix validation error with SDK 1.3.283.
overdesigned May 17, 2024
777cae4
Add rps_rs source.
overdesigned Jan 23, 2024
aec0c4a
Generate blockId internally.
overdesigned Jan 28, 2024
e61e0ff
Support non-inlined function calls.
overdesigned Jan 28, 2024
ae697af
Use mod instead of struct for wrapping render_graph definition.
overdesigned Jan 28, 2024
176a46c
Allow node parameter passing Texture/Buffer by value.
overdesigned Jan 28, 2024
a1517b1
Fix index generator in subprogram calls.
overdesigned Feb 12, 2024
17e68ad
rps_rs: Fix separated depth/stencil rw access flags.
overdesigned Feb 22, 2024
aadc094
rps_rs: Fix built-in clear node signature.
overdesigned Feb 22, 2024
5e90415
rps_rs: Add README, update compiler driver binary, minor clean up.
overdesigned Feb 22, 2024
4ce9183
Add a few rps_rs test files.
overdesigned Feb 22, 2024
50ac319
rpsl_explorer: Support loading pre-compiled dll in addition to rpsl f…
overdesigned Feb 22, 2024
4afdac0
rps_rs: CMake support.
overdesigned Feb 22, 2024
27eb185
Remove dead code.
overdesigned Mar 9, 2024
923482b
Re-export macro_utils from rps_rs.
overdesigned Mar 16, 2024
b02b80e
Add rpsProgramBindNodeDynamicProgram.
overdesigned Mar 19, 2024
17b5a47
Expose ___rps_dyn_lib_init.
overdesigned Mar 21, 2024
d14ea8a
Allow null subprogram to be returned from dynamic subprogram selectio…
overdesigned Mar 21, 2024
0bab760
Add rpsCmdGetNodeDeclIndex.
overdesigned Mar 31, 2024
890ad81
Temporary fix for duplicated node decl names.
overdesigned May 2, 2024
7df475a
Add error check on non-compatible node decls with the same name.
overdesigned May 2, 2024
713ebea
Allow items other than node or export functions (e.g. use declaration…
overdesigned May 4, 2024
8b8b001
Use default callback for unknown node decl type.
overdesigned May 4, 2024
04e3cd5
Add uint2/float2 helpers.
overdesigned May 4, 2024
ebdbd45
Remove unused macro.
overdesigned May 5, 2024
9f703ae
Allow passing pointers across rpsl ffi.
overdesigned May 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ else ( )
endif ( )

set( NugetPackagesRoot "${CMAKE_BINARY_DIR}/rps_nuget_packages" )
set( DXAgilitySDK_VERSION_STRING "1.608.3" )
set( DXAgilitySDK_VERSION 608 ) # to set D3D12SDKVersion
set( DXAgilitySDK_VERSION_STRING "1.613.0" )
set( DXAgilitySDK_VERSION 613 ) # to set D3D12SDKVersion
set( DXAgilitySDK_INSTALL_DIR "${NugetPackagesRoot}/DXAgilitySDK.${DXAgilitySDK_VERSION_STRING}" )
set( RpsDXAgilitySDK_DIR "${DXAgilitySDK_INSTALL_DIR}" CACHE STRING "DX12 Agility SDK directory" )

Expand Down Expand Up @@ -225,6 +225,12 @@ function( CompileRpslDxc TargetName RpslFileName GeneratedSource OutDirPrefix )
set( ${GeneratedSource} "${OutputSource}" PARENT_SCOPE )
endfunction()

if ( WIN32 )
set( RpsRustCompilerBinaryDir "${PROJECT_SOURCE_DIR}/tools/rps_rustc/bin/win-x64/" )
elseif ( RpsOsLinux )
set( RpsRustCompilerBinaryDir "${PROJECT_SOURCE_DIR}/tools/rps_rustc/bin/linux-x64/" )
endif ( )

# Copy assets
function( CopyShaders TargetName ShaderFiles SrcFolder )
foreach( Shader ${ShaderFiles} )
Expand Down
16 changes: 16 additions & 0 deletions include/rps/runtime/common/rps_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ typedef RpsResult (*PFN_rpsRenderGraphBuild)(RpsRenderGraphBuilder hBuilder,
const RpsConstant* pArgs,
uint32_t numArgs);


typedef RpsSubprogram (*PFN_rpsSelectDynamicSubprogram)(void* pContext, const RpsConstant* pArgs, uint32_t numArgs);

typedef struct RpsSelectDynamicSubprogramCallback
{
PFN_rpsSelectDynamicSubprogram pfnSelectDynamicSubprogram;
void* pUserContext;
} RpsSelectDynamicSubprogramCallback;

/// @brief Parameters for updating a render graph.
///
/// @relates RpsRenderGraph
Expand Down Expand Up @@ -583,6 +592,11 @@ RpsResult rpsProgramBindNodeCallback(RpsSubprogram hProgram, const char* name, c
/// @returns Result code of the operation. See <c><i>RpsResult</i></c> for more info.
RpsResult rpsProgramBindNodeSubprogram(RpsSubprogram hProgram, const char* name, RpsSubprogram hSubprogram);


RpsResult rpsProgramBindNodeDynamicProgram(RpsSubprogram hProgram,
const char* name,
const RpsSelectDynamicSubprogramCallback* pCallback);

/// @} end addtogroup RpsSubprogram

/// @addtogroup RpsRenderGraphRuntime
Expand Down Expand Up @@ -1089,6 +1103,8 @@ RpsResult rpsCmdSetCommandBuffer(const RpsCmdCallbackContext* pContext, RpsRunti
/// @return Result code of the operation. See <c><i>RpsResult</i></c> for more info.
RpsResult rpsCmdGetNodeName(const RpsCmdCallbackContext* pContext, const char** ppNodeName, size_t* pNodeNameLength);

RpsResult rpsCmdGetNodeDeclIndex(const RpsCmdCallbackContext* pContext, uint32_t* pNodeDeclIndex);

/// @brief Gets the description of a node argument.
///
/// @param pContext Pointer to the current command callback context. Must not be NULL.
Expand Down
88 changes: 71 additions & 17 deletions src/core/rps_persistent_index_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ namespace rps
uint32_t numResources[NumResourceKinds];
uint32_t localIndex;
uint32_t numChildren;
uint32_t childrenIdBase;

BlockInfo()
: localIndex(RPS_INDEX_NONE_U32)
: numResources{}
, localIndex(RPS_INDEX_NONE_U32)
, numChildren(0)
, childrenIdBase(RPS_INDEX_NONE_U32)
{
}

Expand Down Expand Up @@ -55,18 +58,20 @@ namespace rps
: m_numIndicesTotal{}
, m_blocks(&allocator)
, m_blockStack(&allocator)
, m_blockInstanceStack(&allocator)
, m_blockInstances(&allocator)
{
}

RpsResult EnterFunction(uint32_t blockId,
ConstArrayRef<uint32_t> resourceCounts,
RpsResult EnterFunction(ConstArrayRef<uint32_t> resourceCounts,
uint32_t localLoopIndex,
uint32_t numChildren)
{
RPS_ASSERT(m_blockStack.empty()); // Currently everything is inlined.
uint32_t blockId = RPS_INDEX_NONE_U32;

RPS_V_RETURN(InitBlockInfo(&blockId, resourceCounts, localLoopIndex, numChildren));

InitBlockInfo(blockId, resourceCounts, localLoopIndex, numChildren);
RPS_CHECK_ALLOC(m_blockStack.push_back(blockId));

RPS_ASSERT(m_blockInstances.empty() || (m_blockInstances.front().blockId == 0));

Expand All @@ -87,36 +92,51 @@ namespace rps
return RPS_OK;
}

RpsResult EnterLoop(uint32_t blockId,
ConstArrayRef<uint32_t> resourceCounts,
void BeginCallEntry()
{
m_blockStack.clear();
}

RpsResult EnterLoop(ConstArrayRef<uint32_t> resourceCounts,
uint32_t localLoopIndex,
uint32_t numChildren)
{
RPS_V_RETURN(InitBlockInfo(blockId, resourceCounts, localLoopIndex, numChildren));
uint32_t blockId = RPS_INDEX_NONE_U32;

RPS_V_RETURN(InitBlockInfo(&blockId, resourceCounts, localLoopIndex, numChildren));

RPS_CHECK_ALLOC(m_blockStack.push_back(m_currentBlockInstanceId));
RPS_CHECK_ALLOC(m_blockStack.push_back(blockId));

RPS_CHECK_ALLOC(m_blockInstanceStack.push_back(m_currentBlockInstanceId));

return RPS_OK;
}

RpsResult ExitLoop(uint32_t blockId)
RpsResult ExitLoop()
{
const uint32_t parentBlockInstance = m_blockStack.back();
RPS_RETURN_ERROR_IF(m_blockStack.empty(), RPS_ERROR_INVALID_PROGRAM);

m_blockStack.pop_back();

const uint32_t parentBlockInstance = m_blockInstanceStack.back();
m_blockInstanceStack.pop_back();

m_currentBlockInstanceId = parentBlockInstance;

return RPS_OK;
}

RpsResult LoopIteration(uint32_t blockId)
RpsResult LoopIteration()
{
RPS_ASSERT(!m_blockStack.empty());
RPS_RETURN_ERROR_IF(m_blockStack.empty(), RPS_ERROR_INVALID_PROGRAM);

const uint32_t parentId = m_blockStack.back();
RPS_ASSERT(!m_blockInstanceStack.empty());

const uint32_t parentId = m_blockInstanceStack.back();
const bool bFirstIteration = (parentId == m_currentBlockInstanceId);

const uint32_t blockId = m_blockStack.back();

const BlockInfo& currBlockInfo = m_blocks[blockId];

uint32_t currBlockInstanceId = RPS_INDEX_NONE_U32;
Expand Down Expand Up @@ -157,6 +177,7 @@ namespace rps

m_blocks.reset();
m_blockStack.reset();
m_blockInstanceStack.reset();
m_blockInstances.reset();

m_currentBlockInstanceId = RPS_INDEX_NONE_U32;
Expand All @@ -168,6 +189,7 @@ namespace rps

m_blocks.clear();
m_blockStack.clear();
m_blockInstanceStack.clear();
m_blockInstances.clear();

m_currentBlockInstanceId = RPS_INDEX_NONE_U32;
Expand All @@ -187,14 +209,43 @@ namespace rps
}

private:
RpsResult InitBlockInfo(uint32_t blockId,

RpsResult InitBlockInfo(uint32_t* pBlockId,
ConstArrayRef<uint32_t> resourceCounts,
uint32_t localLoopIndex,
uint32_t numChildren)
{
if (blockId >= m_blocks.size())
uint32_t blockId = 0;

if (m_blockStack.empty())
{
RPS_RETURN_ERROR_IF(localLoopIndex != RPS_INDEX_NONE_U32, RPS_ERROR_INVALID_PROGRAM);

localLoopIndex = 0;

if (m_blocks.empty())
{
m_blocks.reserve(1 + numChildren);
m_blocks.resize(1, BlockInfo());
}
}
else
{
m_blocks.resize(blockId + 1, BlockInfo());
const uint32_t parentBlockId = m_blockStack.back();

// Lazily alloc block range for children of the parent:

if (m_blocks[parentBlockId].childrenIdBase == RPS_INDEX_NONE_U32)
{
const uint32_t numChildrenOfParent = m_blocks[parentBlockId].numChildren;

m_blocks[parentBlockId].childrenIdBase = uint32_t(m_blocks.size());
m_blocks.resize(m_blocks.size() + numChildrenOfParent, BlockInfo());
}

RPS_RETURN_ERROR_IF(localLoopIndex >= m_blocks[parentBlockId].numChildren, RPS_ERROR_INVALID_PROGRAM);

blockId = m_blocks[parentBlockId].childrenIdBase + localLoopIndex;
}

auto& blockInfo = m_blocks[blockId];
Expand All @@ -213,6 +264,8 @@ namespace rps
RPS_ERROR_INVALID_PROGRAM);
}

*pBlockId = blockId;

return RPS_OK;
}

Expand Down Expand Up @@ -265,6 +318,7 @@ namespace rps

ArenaVector<BlockInfo> m_blocks;
ArenaVector<uint32_t> m_blockStack;
ArenaVector<uint32_t> m_blockInstanceStack;
ArenaVector<BlockInstance> m_blockInstances;

uint32_t m_currentBlockInstanceId = RPS_INDEX_NONE_U32;
Expand Down
19 changes: 12 additions & 7 deletions src/runtime/common/phases/rps_access_dag_build.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,18 @@ namespace rps

AccessTransitionInfo transitionInfo;

const NodeId lastAccessor = accessState.accessorNodes.empty()
? RPS_INDEX_NONE_U32
: accessState.accessorNodes.Get(m_nodeRefLists).back();

const bool bAccessedByCurrentNode = (lastAccessor == currNodeId);

if ((accessState.lastTransition == RenderGraph::INVALID_TRANSITION) ||
NeedTransition(beforeAccess, newAccess, transitionInfo))
NeedTransition(beforeAccess, newAccess, transitionInfo, bAccessedByCurrentNode))
{
// New Transition
NodeId lastAccessor = accessState.accessorNodes.empty()
? RPS_INDEX_NONE_U32
: accessState.accessorNodes.Get(m_nodeRefLists).back();

if (lastAccessor != currNodeId)
if (!bAccessedByCurrentNode)
{
AddNewTransition(graph, currNodeId, accessState, newAccess, resourceId, range);
}
Expand Down Expand Up @@ -470,7 +473,8 @@ namespace rps

inline bool NeedTransition(const RpsAccessAttr& before,
const RpsAccessAttr& after,
AccessTransitionInfo& accessTransInfo) const
AccessTransitionInfo& accessTransInfo,
bool bAccessedByCurrentNode) const
{
// Coarse filter before calling runtime dependent CalculateAccessTransition:
// TODO: Get this from runtime device
Expand All @@ -486,7 +490,8 @@ namespace rps
return accessTransInfo.bTransition;
}

if (IsReadOnly(before) && IsReadOnly(after))
if ((IsReadOnly(before) && IsReadOnly(after)) ||
(bAccessedByCurrentNode && rpsAllBitsSet(before.accessFlags, after.accessFlags)))
{
accessTransInfo.bMergedAccessStates = before != after;
accessTransInfo.mergedAccess = before | after;
Expand Down
9 changes: 9 additions & 0 deletions src/runtime/common/phases/rps_pre_process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ namespace rps
pResInstance->InvalidateRuntimeResource(pRuntimeBackend);
}
pResInstance->isPendingInit = false;
pResInstance->isAccessed = false;

pResInstance->SetInitialAccess(AccessAttr{});

Expand Down Expand Up @@ -356,6 +357,7 @@ namespace rps

ResourceInstance tempResInstCopy = parentResInstance;
tempResInstCopy.isTemporalSlice = true;
tempResInstCopy.isAccessed = false;

if (!bIsParentParamResource)
{
Expand Down Expand Up @@ -404,6 +406,11 @@ namespace rps

temporalSlice.SetInitialAccess(AccessAttr{});
temporalSlice.finalAccesses = {};

for (uint32_t iTemporalSlice = 0; iTemporalSlice < numTemporalLayers; iTemporalSlice++)
{
resInstances[parentResInstance.temporalLayerOffset + iTemporalSlice].isAccessed = false;
}
}

return RPS_OK;
Expand Down Expand Up @@ -839,6 +846,8 @@ namespace rps

accessInfo.resourceId = resInstanceId;

resInstance.isAccessed = true;

bool bPendingRecreate = false;

if (resInstance.desc.IsImage())
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/common/phases/rps_schedule_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace rps
printer(" ]");
}

for (uint32_t iCmd = batchInfo.waitFencesBegin, cmdEnd = batchInfo.waitFencesBegin + batchInfo.numCmds;
for (uint32_t iCmd = batchInfo.cmdBegin, cmdEnd = batchInfo.cmdBegin + batchInfo.numCmds;
iCmd < cmdEnd;
iCmd++)
{
Expand Down
14 changes: 12 additions & 2 deletions src/runtime/common/rps_render_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ namespace rps

if (pCreateInfo)
{
(*ppRenderGraph)->OnInit(renderGraphCreateInfo);
RPS_V_RETURN((*ppRenderGraph)->OnInit(renderGraphCreateInfo));
}


if (pRuntimeDevice)
{
if ((*ppRenderGraph)->m_createInfo.numPhases == 0)
Expand Down Expand Up @@ -487,6 +486,17 @@ RpsResult rpsCmdGetNodeName(const RpsCmdCallbackContext* pContext, const char**
return RPS_OK;
}

RpsResult rpsCmdGetNodeDeclIndex(const RpsCmdCallbackContext* pContext, uint32_t* pNodeDeclIndex)
{
RPS_CHECK_ARGS(pContext && pNodeDeclIndex);

auto pBackendContext = rps::RuntimeCmdCallbackContext::Get(pContext);

*pNodeDeclIndex = pBackendContext->pCmdInfo->nodeDeclIndex;

return RPS_OK;
}

RpsResult rpsCmdGetParamDesc(const RpsCmdCallbackContext* pContext, RpsParamId paramId, RpsParameterDesc* pDesc)
{
RPS_CHECK_ARGS(pContext && pDesc);
Expand Down
1 change: 1 addition & 0 deletions src/runtime/common/rps_render_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace rps
bool isAliased : 1;
bool isPendingCreate : 1;
bool isPendingInit : 1;
bool isAccessed : 1;
bool isMutableFormat : 1;
bool bBufferFormattedWrite : 1;
bool bBufferFormattedRead : 1;
Expand Down
Loading