This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::StructuredBuffer Class

Header: #include <UnigineTextures.h>

StructuredBuffer is a buffer for structures: it represents a uniform array of structures.

StructuredBuffer resource can specified via the following flags:

  • GPU_RESOURCE specifies a resource that can be read and written by the GPU. It also creates a temporary direct staging buffer to copy the data from the main buffer and gets the data by the CPU.
  • IMMUTABLE specifies a resources that can only be read by the GPU. It also creates a temporary direct staging buffer to copy the data from the main buffer and gets the data by the CPU.
  • CPU_RESOURCE specifies a resource that is accessible by both the GPU (read only mode) and the CPU (write only mode). It also creates a temporary direct staging buffer to copy the data from the main buffer and gets the data by the CPU.
  • STAGING specifies a resource that supports direct data transfer from the GPU to CPU.

See Also#

  • StructuredBuffer C++ sample provided in the Samples (Samples -> C++ -> Render) section of UNIGINE SDK Browser.

StructuredBuffer Class

Members


static StructuredBufferPtr create ( ) #

Constructor. Creates a new structured buffer.
Source code (C++)
StructuredBufferPtr input_buffer = StructuredBuffer::create();

void * getD3D11ShaderResourceView ( ) #

Gets a shader-resource view that specifies the subresources a shader can access during rendering.

Return value

A pointer to D3D11 shader resource view.

void * getD3D11UnorderedAccessView ( ) #

Gets a view for an unordered access resource that specifies the parts of a resource the pipeline can access during rendering.

Return value

A pointer to a D3D11 unordered access view.

int getData ( void * data ) #

Gets the data from StructuredBuffer instance.

Arguments

  • void * data - A pointer to the data.

Return value

1 if StructuredBuffer data was returned; otherwise, 0.

int getGLBufferID ( ) #

Returns the Id of buffer.

Return value

An Id of the buffer.

void bindCompute ( int unit ) #

Binds the StructuredBuffer to the compute shader type.

Arguments

  • int unit - Number of the slot.

void unbindCompute ( int unit ) #

Unbinds the StructuredBuffer from the compute shader type.

Arguments

  • int unit - Number of the slot.

void bindControl ( int unit ) #

Binds the StructuredBuffer to the tessellation control (hull) shader type.

Arguments

  • int unit - Number of the slot.

void unbindControl ( int unit ) #

Unbinds the StructuredBuffer from the tessellation control (hull) shader type.

Arguments

  • int unit - Number of the slot.

void bindEvaluate ( int unit ) #

Binds the StructuredBuffer to the tessellation evaluation (domain) shader type.

Arguments

  • int unit - Number of the slot.

void unbindEvaluate ( int unit ) #

Unbinds the StructuredBuffer from the tessellation evaluation (domain) shader type.

Arguments

  • int unit - Number of the slot.

void bindFragment ( int unit ) #

Binds the StructuredBuffer to the fragment shader type.

Arguments

  • int unit - Number of the slot.

void unbindFragment ( int unit ) #

Unbinds the StructuredBuffer from the fragment shader type.

Arguments

  • int unit - Number of the slot.

void bindGeometry ( int unit ) #

Binds the StructuredBuffer to the geometry shader type.

Arguments

  • int unit - Number of the slot.

void unbindGeometry ( int unit ) #

Unbinds the StructuredBuffer from the geometry shader type.

Arguments

  • int unit - Number of the slot.

void bindVertex ( int unit ) #

Binds the StructuredBuffer to the vertex shader type.

Arguments

  • int unit - Number of the slot.

void clear ( ) #

Clears smart pointer.

int create ( int flags, void * data, unsigned int structure_size, unsigned int num_elements ) #

Creates a StructuredBuffer instance with specified parameters.
Source code (C++)
#define NUMBERS_COUNT 4096 * 8192

// Input data structure
struct InputDataStructure {
	vec4 vector0;
	vec4 vector1;
};

// Source data
InputDataStructure *source_data = new InputDataStructure[NUMBERS_COUNT];

// Create immutable structure buffer (gpu_read-only) and store initial values
StructuredBufferPtr input_buffer = StructuredBuffer::create();
input_buffer->create(StructuredBuffer::IMMUTABLE, source_data, sizeof(InputDataStructure), NUMBERS_COUNT);

Arguments

  • int flags - StructuredBuffer flag.
  • void * data - Pointer to the source data.
  • unsigned int structure_size - The size of the structured buffer.
  • unsigned int num_elements - Number of elements in the structured buffer.

Return value

1 if the StructuredBuffer was created successfully; otherwise, 0.

int create ( int flags, unsigned int structure_size, unsigned int num_elements ) #

Constructor. Creates a new structured buffer with the specified parameters.

Arguments

  • int flags - StructuredBuffer flag.
  • unsigned int structure_size - The size of the structured buffer.
  • unsigned int num_elements - Number of elements in the structured buffer.

Return value

1 if the StructuredBuffer was created successfully; otherwise, 0.

void destroy ( ) #

Destroys smart pointer.

void unbindVertex ( int unit ) #

Unbinds the StructuredBuffer from the vertex shader type.

Arguments

  • int unit - Number of the slot.

void setDebugName ( const char * name ) #

Sets a friendly name for GPU debugging (RenderDoc, NVIDIA Nsight). It can be used to help you determine if the corresponding object interface pointer caused the leak. Memory leaks are reported by the debug software layer by outputting a list of object interface pointers along with their friendly names.

Arguments

  • const char * name - Friendly debug name to be set.

const char * getDebugName ( ) #

Returns the currently used friendly name for GPU debugging (RenderDoc, NVIDIA Nsight). It can be used to help you determine if the corresponding object interface pointer caused the leak. Memory leaks are reported by the debug software layer by outputting a list of object interface pointers along with their friendly names.

Return value

Friendly debug name.

void clearBuffer ( ) #

Clears the structured buffer.

void copy ( const Ptr<StructuredBuffer> & src ) #

Copies the data from the specified source structured buffer.

Arguments

  • const Ptr<StructuredBuffer> & src - Source structured buffer to copy data from.

int getNumElements ( ) #

Returns the number of elements in the structured buffer.

Return value

Number of elements in the structured buffer.
Last update: 2023-06-23
Build: ()