Objects::Components::ShaderArgument

Shader Arguments in Unified Engine

Within the Unified Engine, the shader arguments are vital for sending data to the GPU shaders. These arguments could range from primitive data types to complex data structures like matrices. The engine provides tools to handle these arguments efficiently.

Shader Argument Types Enumeration

This enumeration represents various data types that can be sent as arguments to shaders.

enum ShaderArgType{
    SHADER_ARG_NULL = -1,
    SHADER_ARG_INT = 0,
    SHADER_ARG_FLOAT = 1,
    SHADER_ARG_VEC2 = 2,
    SHADER_ARG_VEC3 = 3,
    SHADER_ARG_VEC4 = 4,
    SHADER_ARG_MAT3 = 5,
    SHADER_ARG_MAT4 = 6
};'

Shader Arguments Structure

A structure that encapsulates all the necessary details about the data to be sent as an argument to the shader. It includes the pointer to the actual data, the type of the data, and the variable's name (or uniform name) within the shader.

struct ShaderArguments{
    void* dataLoc = nullptr;
    ShaderArgType type = -1;
    std::string name = "";
};

Last updated