KiCad PCB EDA Suite
Loading...
Searching...
No Matches
rhi_compute.h File Reference
#include <rhi/rhi_bind_group.h>
#include <rhi/rhi_command.h>
#include <rhi/rhi_shader.h>
#include <array>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <vector>

Go to the source code of this file.

Classes

struct  RHI_SPECIALIZATION_CONSTANT
 A 32-bit specialization value represented as raw bits. More...
 
struct  RHI_COMPUTE_PIPELINE_DESC
 
struct  RHI_COMPUTE_DEVICE_LIMITS
 
struct  RHI_COMPUTE_PIPELINE_LIMITS
 
class  RHI_COMPUTE_JOB
 Plain owning command data, recordable on any thread without device access. More...
 
struct  RHI_COMPUTE_JOB::COMMAND
 Backend command representation; payload bytes are owned by the job. More...
 
struct  RHI_COMPUTE_JOB_LOOKUP
 Backend lookups for RhiValidateComputeJob. More...
 

Enumerations

enum class  RHI_COMPUTE_RESULT { OK , DEVICE_LOST , INVALID }
 

Functions

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.
 
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 effect.
 

Variables

constexpr uint32_t RHI_SPEC_ID_WORKGROUP_X = 0
 Specialization IDs reserved for the workgroup dimensions; Z is always one.
 
constexpr uint32_t RHI_SPEC_ID_WORKGROUP_Y = 1
 
constexpr uint32_t RHI_SPEC_ID_USER_FIRST = 2
 

Enumeration Type Documentation

◆ RHI_COMPUTE_RESULT

enum class RHI_COMPUTE_RESULT
strong
Enumerator
OK 
DEVICE_LOST 
INVALID 

Definition at line 78 of file rhi_compute.h.

Function Documentation

◆ RhiValidateComputeBindGroupLayout()

bool RhiValidateComputeBindGroupLayout ( const RHI_BIND_GROUP_LAYOUT_DESC & aLayout)

Validate a compute bind group layout.

Every entry must be visible to compute and no buffer may use binding 0, which Metal reserves for push constants.

Definition at line 26 of file rhi_compute.cpp.

References RHI_BINDING_ENTRY::binding, COMBINED_TEXTURE_SAMPLER, COMPUTE, RHI_BIND_GROUP_LAYOUT_DESC::entries, RHI_BINDING_ENTRY::stages, RHI_BINDING_ENTRY::type, and RHI_BIND_GROUP_LAYOUT_DESC::Validate().

Referenced by BOOST_AUTO_TEST_CASE(), GPU_COMPUTE::CreateBindGroupLayout(), and RhiValidateComputePipelineDesc().

◆ RhiValidateComputeJob()

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 effect.

Push constants must be pushed in full after each Bind() and before the next Dispatch().

Definition at line 79 of file rhi_compute.cpp.

References actual, RHI_COMPUTE_PIPELINE_DESC::bindGroupLayouts, RHI_COMPUTE_JOB::Commands(), expected, RHI_COMPUTE_JOB_LOOKUP::groupLayout, RHI_COMPUTE_JOB::IsValid(), RHI_COMPUTE_DEVICE_LIMITS::maxDispatchGroups, RHI_COMPUTE_JOB_LOOKUP::pipeline, RHI_COMPUTE_PIPELINE_DESC::pushConstantBytes, and RHI_COMPUTE_JOB_LOOKUP::storageRange.

Referenced by RHI_VULKAN_DEVICE::ExecuteCompute().

◆ RhiValidateComputePipelineDesc()

Variable Documentation

◆ RHI_SPEC_ID_USER_FIRST

uint32_t RHI_SPEC_ID_USER_FIRST = 2
constexpr

Definition at line 34 of file rhi_compute.h.

Referenced by RhiValidateComputePipelineDesc().

◆ RHI_SPEC_ID_WORKGROUP_X

uint32_t RHI_SPEC_ID_WORKGROUP_X = 0
constexpr

Specialization IDs reserved for the workgroup dimensions; Z is always one.

Definition at line 32 of file rhi_compute.h.

Referenced by RHI_VULKAN_DEVICE::CreateComputePipeline().

◆ RHI_SPEC_ID_WORKGROUP_Y

uint32_t RHI_SPEC_ID_WORKGROUP_Y = 1
constexpr

Definition at line 33 of file rhi_compute.h.

Referenced by RHI_VULKAN_DEVICE::CreateComputePipeline().