Shader programs
-
namespace d3d
Functions
-
PROGRAM create_program(VPROG vprog, FSHADER fsh, VDECL vdecl, unsigned *strides = nullptr, unsigned streams = 0)
Creates a program with a vertex shader, fragment shader, and vertex declaration.
If strides and streams are not set, they will be obtained from the vertex declaration. The program should be deleted externally using delete_program().
- Parameters:
vprog – The vertex shader program.
fsh – The fragment shader program.
vdecl – The vertex declaration.
strides – The stride values for each vertex stream (optional, default is 0).
streams – The number of vertex streams (optional, default is 0).
- Returns:
The created program.
-
PROGRAM create_program(const uint32_t *vpr_native, const uint32_t *fsh_native, VDECL vdecl, unsigned *strides = nullptr, unsigned streams = 0)
Creates a program with native vertex shader and fragment shader code.
If strides and streams are not set, they will be obtained from the vertex declaration.
- Parameters:
vpr_native – The native code for the vertex shader.
fsh_native – The native code for the fragment shader.
vdecl – The vertex declaration.
strides – The stride values for each vertex stream (optional, default is 0).
streams – The number of vertex streams (optional, default is 0).
- Returns:
The created program.
-
PROGRAM create_program_cs(const uint32_t *cs_native, CSPreloaded preloaded)
Creates a compute shader program with native code.
- Parameters:
cs_native – The native code for the compute shader.
preloaded – The preloaded data for the compute shader.
- Returns:
The created program.
-
bool set_program(PROGRAM program)
Sets the program as the current program, including the pixel shader, vertex shader, and vertex declaration.
- Parameters:
program – The program to set.
- Returns:
True if the program was set successfully, false otherwise.
-
void delete_program(PROGRAM program)
Deletes a program, including the vertex shader and fragment shader.
Warning
The vertex declaration should be deleted independently.
- Parameters:
program – The program to delete.
-
VPROG create_vertex_shader(const uint32_t *native_code)
Creates a vertex shader with native code.
- Parameters:
native_code – The native code for the vertex shader.
- Returns:
The created vertex shader.
-
void delete_vertex_shader(VPROG vs)
Deletes a vertex shader.
- Parameters:
vs – The vertex shader to delete.
-
FSHADER create_pixel_shader(const uint32_t *native_code)
Creates a pixel shader with native code.
- Parameters:
native_code – The native code for the pixel shader.
- Returns:
The created pixel shader.
-
PROGRAM create_program(VPROG vprog, FSHADER fsh, VDECL vdecl, unsigned *strides = nullptr, unsigned streams = 0)