23#include <unordered_set>
52 std::unordered_set<uint32_t> ids;
61 std::unordered_set<uint32_t> bindings;
70 if( !bindings.insert( entry.
binding ).second )
88 std::array<RHI_BindGroupHandle, RHI_MAX_BIND_GROUPS> bound{};
90 bool groupsChecked =
false;
98 if( !aLookup.
storageRange( command.buffer, command.offset, command.bytes ) )
104 pipeline = aLookup.
pipeline( command.pipeline );
110 groupsChecked =
false;
114 if( command.index >= bound.size() || !aLookup.
groupLayout( command.group ) )
117 bound[command.index] = command.group;
118 groupsChecked =
false;
121 case OP::PUSH_CONSTANTS:
129 if( !pipeline || !command.groupsX || !command.groupsY || command.groupsX > aLimits.
maxDispatchGroups[0]
151 groupsChecked =
true;
156 case OP::BARRIER:
break;
164static std::vector<uint8_t>
copyBytes(
const void* aData,
size_t aBytes )
166 const uint8_t* bytes =
static_cast<const uint8_t*
>( aData );
167 return aData ? std::vector<uint8_t>( bytes, bytes + aBytes ) : std::vector<uint8_t>();
220 .destination = aDestination } );
Plain owning command data, recordable on any thread without device access.
void Dispatch(uint32_t aGroupsX, uint32_t aGroupsY=1)
const std::vector< COMMAND > & Commands() const
void BindGroup(uint32_t aIndex, RHI_BindGroupHandle aGroup)
void Readback(RHI_BufferHandle aBuffer, size_t aOffset, size_t aBytes, void *aDestination)
std::vector< COMMAND > m_commands
void Upload(RHI_BufferHandle aBuffer, const void *aData, size_t aBytes, size_t aOffset=0)
Copy upload bytes immediately.
void Bind(RHI_ComputePipelineHandle aPipeline)
void PushConstants(const void *aData, size_t aBytes)
@ COMBINED_TEXTURE_SAMPLER
constexpr int RHI_MAX_BIND_GROUPS
Most bind groups one pipeline can use.
constexpr uint32_t RHI_MAX_PUSH_CONSTANT_BYTES
Largest push constant size SetPushConstants() accepts, in bytes.
bool RhiValidateComputeJob(const RHI_COMPUTE_JOB &aJob, const RHI_COMPUTE_DEVICE_LIMITS &aLimits, const RHI_COMPUTE_JOB_LOOKUP &aLookup)
Check a whole job against live resources before any of it executes, so a bad job has no partial effec...
static std::vector< uint8_t > copyBytes(const void *aData, size_t aBytes)
bool RhiValidateComputePipelineDesc(const RHI_COMPUTE_PIPELINE_DESC &aDesc)
Validate the portable contract without accessing a GPU or inspecting shader bytecode.
bool RhiValidateComputeBindGroupLayout(const RHI_BIND_GROUP_LAYOUT_DESC &aLayout)
Validate a compute bind group layout.
constexpr uint32_t RHI_SPEC_ID_USER_FIRST
RHI_HANDLE< RHI_TAG_BUFFER > RHI_BufferHandle
RHI_HANDLE< RHI_TAG_BIND_GROUP > RHI_BindGroupHandle
RHI_HANDLE< RHI_TAG_COMPUTE_PIPELINE > RHI_ComputePipelineHandle
std::vector< RHI_BINDING_ENTRY > entries
std::array< uint32_t, 3 > maxDispatchGroups
Backend command representation; payload bytes are owned by the job.
Backend lookups for RhiValidateComputeJob.
std::function< const RHI_BIND_GROUP_LAYOUT_DESC *(RHI_BindGroupHandle)> groupLayout
std::function< bool(RHI_BufferHandle, size_t aOffset, size_t aBytes)> storageRange
std::function< const RHI_COMPUTE_PIPELINE_DESC *(RHI_ComputePipelineHandle)> pipeline
std::vector< RHI_SPECIALIZATION_CONSTANT > constants
uint32_t pushConstantBytes
std::vector< RHI_BIND_GROUP_LAYOUT_DESC > bindGroupLayouts
A 32-bit specialization value represented as raw bits.
VECTOR3I expected(15, 30, 45)