Shaders adapted for Legacy GL
Some checks failed
Build Dusk / run-tests (pull_request) Failing after 24s
Build Dusk / build-linux (pull_request) Failing after 18s
Build Dusk / build-psp (pull_request) Failing after 18s
Build Dusk / build-gamecube (pull_request) Failing after 15s
Build Dusk / build-wii (pull_request) Failing after 16s

This commit is contained in:
2026-03-22 10:44:28 -05:00
parent ca0e9fc3b2
commit 5ac21db997
9 changed files with 184 additions and 61 deletions

View File

@@ -16,6 +16,12 @@ typedef struct {
GLuint vertexShaderId;
GLuint fragmentShaderId;
#endif
#if DUSK_OPENGL_LEGACY
mat4 view;
mat4 proj;
mat4 model;
#endif
} shadergl_t;
typedef struct {
@@ -27,6 +33,19 @@ typedef struct {
#endif
} shaderdefinitiongl_t;
#if DUSK_OPENGL_LEGACY
typedef struct {
shadergl_t *boundShader;
uint_fast8_t dirty;
} shaderlegacygl_t;
extern shaderlegacygl_t SHADER_LEGACY;
#define SHADER_LEGACY_DIRTY_PROJ (1 << 0)
#define SHADER_LEGACY_DIRTY_VIEW (1 << 1)
#define SHADER_LEGACY_DIRTY_MODEL (1 << 2)
#endif
/**
* Initializes a shader.
*
@@ -69,7 +88,7 @@ errorret_t shaderParamGetLocationGL(
errorret_t shaderSetMatrixGL(
shadergl_t *shader,
const char_t *name,
const mat4 matrix
mat4 matrix
);
/**
@@ -77,4 +96,14 @@ errorret_t shaderSetMatrixGL(
*
* @param shader The shader to dispose.
*/
errorret_t shaderDisposeGL(shadergl_t *shader);
errorret_t shaderDisposeGL(shadergl_t *shader);
#ifdef DUSK_OPENGL_LEGACY
/**
* During mesh rendering, this is requesting the legacy system to push all
* shaders necessary to render the currently bound shader's matrices.
*
* @return Any error state.
*/
errorret_t shaderLegacyMatrixUpdate();
#endif