libgui
2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
Loading...
Searching...
No Matches
FetchShader.h
1
/****************************************************************************
2
* Platform Abstraction Layer (WUT driver)
3
* Daryl Borth 2026
4
* FetchShader.h
5
***************************************************************************/
6
#ifndef WUT_FETCH_SHADER_H_
7
#define WUT_FETCH_SHADER_H_
8
9
#include <malloc.h>
10
#include "Shader.h"
11
16
class
FetchShader
:
public
Shader
17
{
18
public
:
24
FetchShader
(GX2AttribStream * attributes, uint32_t attrCount,
25
GX2FetchShaderType type = GX2_FETCH_SHADER_TESSELLATION_NONE,
26
GX2TessellationMode tess = GX2_TESSELLATION_MODE_DISCRETE)
27
:
fetchShader
(nullptr),
fetchShaderProgram
(nullptr)
28
{
29
uint32_t shaderSize = GX2CalcFetchShaderSizeEx(attrCount, type, tess);
30
fetchShaderProgram
= memalign(GX2_SHADER_PROGRAM_ALIGNMENT, shaderSize);
31
if
(
fetchShaderProgram
)
32
{
33
fetchShader
=
new
GX2FetchShader;
34
GX2InitFetchShaderEx(
fetchShader
,
static_cast<
uint8_t *
>
(
fetchShaderProgram
), attrCount, attributes, type, tess);
35
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_SHADER,
fetchShaderProgram
, shaderSize);
36
}
37
}
38
39
virtual
~FetchShader
()
40
{
41
if
(
fetchShaderProgram
)
42
free(
fetchShaderProgram
);
43
if
(
fetchShader
)
44
delete
fetchShader
;
45
}
46
48
void
setShader
()
const
49
{
50
GX2SetFetchShader(
fetchShader
);
51
}
52
53
protected
:
54
GX2FetchShader *
fetchShader
;
55
void
*
fetchShaderProgram
;
56
};
57
58
#endif
// WUT_FETCH_SHADER_H_
FetchShader
Owns the GX2 fetch shader program that binds vertex attribute streams to a vertex shader.
Definition
FetchShader.h:17
FetchShader::fetchShader
GX2FetchShader * fetchShader
The GX2 fetch shader object (nullptr if allocation failed)
Definition
FetchShader.h:54
FetchShader::setShader
void setShader() const
Binds this fetch shader for subsequent draws.
Definition
FetchShader.h:48
FetchShader::fetchShaderProgram
void * fetchShaderProgram
Aligned program memory the fetch shader executes from.
Definition
FetchShader.h:55
FetchShader::FetchShader
FetchShader(GX2AttribStream *attributes, uint32_t attrCount, GX2FetchShaderType type=GX2_FETCH_SHADER_TESSELLATION_NONE, GX2TessellationMode tess=GX2_TESSELLATION_MODE_DISCRETE)
Builds a fetch shader for the given vertex attribute streams.
Definition
FetchShader.h:24
source
drivers
wut
shaders
FetchShader.h
Generated by
1.13.2