Rhino C++ API  9.0
Public Member Functions | List of all members
CRhinoComputeShader Class Reference

#include <RhinoSdkGpuCompute.h>

Public Member Functions

 CRhinoComputeShader ()
 
 CRhinoComputeShader (const CRhinoComputeShader &other)=delete
 
 ~CRhinoComputeShader ()
 
bool Compile (CRhinoDisplayPipeline::DisplayTechnologies technology, const char *source, const char *computeMainName, int shaderVersionMajor, int shaderVersionMinor, bool debug, ON_String *errorMessage)
 
bool ExecuteDispatch (unsigned int x, unsigned int y, unsigned int z)
 
bool HasConstantBufferBeenSet (unsigned int location) const
 
bool HasRWStructuredBuferBeenSet (unsigned int location) const
 
bool HasRWTextureBeenSet (unsigned int location) const
 
bool HasStructuredBufferBeenSet (unsigned int location) const
 
bool IsCompiled () const
 
CRhinoComputeShaderoperator= (const CRhinoComputeShader &other)=delete
 
bool ReadRWStructuredBuffer (unsigned int location, void *data, unsigned int dataSize)
 
bool ReadRWTexture (unsigned int location, void *data, unsigned int dataSize)
 
bool SetConstantBuffer (unsigned int location, void *data, unsigned int dataSize)
 
bool SetDepthBufferAsTextureSRV (unsigned int location, const class CRhinoDisplayPipeline &pipeline)
 
bool SetRWStructuredBuffer (unsigned int location, unsigned int elementCount, unsigned int elementSize)
 
bool SetRWTextureFloat32 (unsigned int location, unsigned int width, unsigned int height)
 
bool SetStructuredBuffer (unsigned int location, const ON_SimpleArray< int > &data)
 
bool SetStructuredBuffer (unsigned int location, const ON_SimpleArray< ON_3dex > &data)
 
bool SetStructuredBuffer (unsigned int location, const ON_SimpleArray< ON_3fPoint > &data)
 
CRhinoDisplayPipeline::DisplayTechnologies Technology () const
 

Detailed Description

Copyright (c) 1993-2026 Robert McNeel & Associates. All rights reserved. Rhinoceros is a registered trademark of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete Rhino SDK copyright information see http://www.rhino3d.com/developer.

Constructor & Destructor Documentation

◆ CRhinoComputeShader() [1/2]

CRhinoComputeShader::CRhinoComputeShader ( )

◆ CRhinoComputeShader() [2/2]

CRhinoComputeShader::CRhinoComputeShader ( const CRhinoComputeShader other)
delete

◆ ~CRhinoComputeShader()

CRhinoComputeShader::~CRhinoComputeShader ( )

Member Function Documentation

◆ Compile()

bool CRhinoComputeShader::Compile ( CRhinoDisplayPipeline::DisplayTechnologies  technology,
const char *  source,
const char *  computeMainName,
int  shaderVersionMajor,
int  shaderVersionMinor,
bool  debug,
ON_String errorMessage 
)

Description: Compile a string into a compute shader binary. If technology is is different for a CRhinoComputeShader instance from a previous call to compute, all internal data will be rebuilt and the instance will attempt to switch over to a different back end technology Parameters: technology: The technology to use for all parts of this compute shader source: The shader code computeMainName: name of the main function in source to use as the compute entry point shaderVersionMajor: version of shading language that source is written in shaderVersionMinor: version of shading language that source is written in debug: compile as debug or release errorMessage: if provided and any errors or warnings are generated by the compiler, then errorMessage will contain this message Returns: true on a successful compile

◆ ExecuteDispatch()

bool CRhinoComputeShader::ExecuteDispatch ( unsigned int  x,
unsigned int  y,
unsigned int  z 
)

Description: Run the compute shader.

◆ HasConstantBufferBeenSet()

bool CRhinoComputeShader::HasConstantBufferBeenSet ( unsigned int  location) const

Description: Has a constant buffer (uniform buffer) been set at a defined location

◆ HasRWStructuredBuferBeenSet()

bool CRhinoComputeShader::HasRWStructuredBuferBeenSet ( unsigned int  location) const

Description: Has a read-write structured buffer been set at a defined location. These buffers are often not initialized with CPU data and can be written to inside of shaders. These buffers can also be copied back to the CPU after a successful ExecuteDispath call

◆ HasRWTextureBeenSet()

bool CRhinoComputeShader::HasRWTextureBeenSet ( unsigned int  location) const

Description: Has a read-write texture been set at a defined location

◆ HasStructuredBufferBeenSet()

bool CRhinoComputeShader::HasStructuredBufferBeenSet ( unsigned int  location) const

Description: Has a structured buffer been set at a defined location. Structured buffers are arrays of data passed from the CPU to the GPU and meant as read-only data in compute shaders. Structured buffers are not meant to ever be read back to the CPU from the GPU

◆ IsCompiled()

bool CRhinoComputeShader::IsCompiled ( ) const

Returns: True if the last call to compile was successful. Use this as a fast test to avoid expensive calls to compile

◆ operator=()

CRhinoComputeShader& CRhinoComputeShader::operator= ( const CRhinoComputeShader other)
delete

◆ ReadRWStructuredBuffer()

bool CRhinoComputeShader::ReadRWStructuredBuffer ( unsigned int  location,
void *  data,
unsigned int  dataSize 
)

Description: Read data back from a RW buffer after a successful call to ExecuteDispatch Parameters: location: the RW buffer to read from data: the data to memcpy buffer data into dataSize: the size of data Returns: true on success

◆ ReadRWTexture()

bool CRhinoComputeShader::ReadRWTexture ( unsigned int  location,
void *  data,
unsigned int  dataSize 
)

Description: Copy the contents of an RW texture back to CPU memory after a successful call to ExecuteDispatch. Pixels are written tightly packed (no row padding) in the format's natural element size. Parameters: location: the RW texture slot to read from data: destination buffer dataSize: size of the destination buffer in bytes; must be at least width * height * bytesPerPixel Returns: true on success

◆ SetConstantBuffer()

bool CRhinoComputeShader::SetConstantBuffer ( unsigned int  location,
void *  data,
unsigned int  dataSize 
)

◆ SetDepthBufferAsTextureSRV()

bool CRhinoComputeShader::SetDepthBufferAsTextureSRV ( unsigned int  location,
const class CRhinoDisplayPipeline pipeline 
)

Description: Bind the given pipeline's depth buffer as a read-only shader resource. The compute shader receives a single-channel float Texture2D (or Texture2DMS for multisampled depth) at the given t-register location. Parameters: location: the t-register slot (e.g. 0 for register(t0)) pipeline: the display pipeline whose engine owns the depth buffer to read from. The pipeline's engine must be using the same technology this CRhinoComputeShader was compiled for. Returns: true on success

◆ SetRWStructuredBuffer()

bool CRhinoComputeShader::SetRWStructuredBuffer ( unsigned int  location,
unsigned int  elementCount,
unsigned int  elementSize 
)

◆ SetRWTextureFloat32()

bool CRhinoComputeShader::SetRWTextureFloat32 ( unsigned int  location,
unsigned int  width,
unsigned int  height 
)

Description: Create a single-channel 32-bit float read-write texture (UAV) owned by this compute shader. The texture is filled by the shader during ExecuteDispatch and can be read back to the CPU with ReadRWTexture. Equivalent to a RWTexture2D<float> at the given u-register. Parameters: location: the u-register slot (e.g. 0 for register(u0)) width, height: texture dimensions in pixels Returns: true on success

◆ SetStructuredBuffer() [1/3]

bool CRhinoComputeShader::SetStructuredBuffer ( unsigned int  location,
const ON_SimpleArray< int > &  data 
)

◆ SetStructuredBuffer() [2/3]

bool CRhinoComputeShader::SetStructuredBuffer ( unsigned int  location,
const ON_SimpleArray< ON_3dex > &  data 
)

◆ SetStructuredBuffer() [3/3]

bool CRhinoComputeShader::SetStructuredBuffer ( unsigned int  location,
const ON_SimpleArray< ON_3fPoint > &  data 
)

◆ Technology()

CRhinoDisplayPipeline::DisplayTechnologies CRhinoComputeShader::Technology ( ) const

Description: Underlying technology this compute shader is using (or attempting to use)