This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
Справочник API
Animations-Related Classes
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
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine::CPUShaderCallable Class

Header: #include <UnigineThread.h>

CPUShaderCallable is a template class that provides a simplified way to execute custom multithreaded logic using the CPUShader class.

Typically, to use a CPUShader, you need to inherit from the base CPUShader class and manually implement the process() method. However, CPUShaderCallable allows you to pass in the processing logic and optional cleanup logic directly as function objects without writing a custom class or managing inheritance.

It also supports an internal shared state that is accessible from all threads and can be cleaned up automatically after execution.

Template Parameters:

  • State - user-defined type that stores shared state between threads.
  • Process - function called per thread.
    Signature: void(int thread_num, int num_threads)
  • Destroy - optional function called once after all threads are finished.
    Signature: void(State state)

CPUShaderCallable Class

Members


CPUShaderCallable ( Process func_process_, Destroy func_destroy_ ) #

Creates a new shader task with execution and destruction logic.

Arguments

  • Process func_process_ - Function executed on each thread.
  • Destroy func_destroy_ - Function executed once after all threads are done.

void process ( int thread_num, int num_threads ) #

Overridden from CPUShader. Called once per thread during execution. Invokes the provided processing function.

Arguments

  • int thread_num - Index of the current thread.
  • int num_threads - Total number of threads assigned to this task.

The information on this page is valid for UNIGINE 2.20 SDK.

Last update: 10.07.2025
Build: ()