Must test dx11

This commit is contained in:
EmeraldLockdown 2026-04-01 14:52:45 -05:00
parent cb515ac764
commit b77cbd3de1
2 changed files with 25 additions and 1 deletions

View file

@ -430,7 +430,7 @@ static struct ShaderProgram *gfx_d3d11_lookup_shader(struct ColorCombiner* cc) {
static struct ShaderProgram *gfx_d3d11_lookup_shader_using_index(u8 shaderIndex) {
if (shaderIndex >= d3d.shader_program_pool_size) return nullptr;
return (struct ShaderProgram *)&d3d.shader_program_pool[i];
return (struct ShaderProgram *)&d3d.shader_program_pool[shaderIndex];
}
static void gfx_d3d11_shader_get_info(struct ShaderProgram *prg, uint8_t *num_inputs, bool used_textures[2]) {

View file

@ -396,59 +396,83 @@ struct CCFeatures *gfx_color_combiner_get_features(struct ColorCombiner *cc) {
u32 gfx_get_program_id_from_shader_index(u8 shaderIndex) {
#ifdef RAPI_GL
struct ShaderProgram* program = RAPI.lookup_shader_using_index(shaderIndex);
if (!program) return 0;
return program->opengl_program_id;
#else
return 0;
#endif
}
void gfx_use_program(u32 program) {
#ifdef RAPI_GL
glUseProgram(program);
#endif
}
int gfx_shader_get_uniform_location(u32 program, const char* name) {
#ifdef RAPI_GL
return glGetUniformLocation(program, name);
#else
return 0;
#endif
}
void gfx_shader_set_int(int loc, int value) {
#ifdef RAPI_GL
if (loc != -1) {
glUniform1i(loc, value);
}
#endif
}
void gfx_shader_set_bool(int loc, bool value) {
#ifdef RAPI_GL
if (loc != -1) {
glUniform1i(loc, (int)value);
}
#endif
}
void gfx_shader_set_float(int loc, float value) {
#ifdef RAPI_GL
if (loc != -1) {
glUniform1f(loc, value);
}
#endif
}
void gfx_shader_set_vec2(int loc, float x, float y) {
#ifdef RAPI_GL
if (loc != -1) {
glUniform2f(loc, x, y);
}
#endif
}
void gfx_shader_set_vec3(int loc, float x, float y, float z) {
#ifdef RAPI_GL
if (loc != -1) {
glUniform3f(loc, x, y, z);
}
#endif
}
void gfx_shader_set_vec4(int loc, float x, float y, float z, float w) {
#ifdef RAPI_GL
if (loc != -1) {
glUniform4f(loc, x, y, z, w);
}
#endif
}
void gfx_shader_set_mat4(int loc, const Mat4 mat) {
#ifdef RAPI_GL
if (loc != -1) {
glUniformMatrix4fv(loc, 1, GL_FALSE, (const GLfloat*)mat);
}
#endif
}
Vtx *vtx_get_from_name(const char *name, RET u32 *count) {