mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-07-12 17:31:06 +00:00
Fix opengl uniforms
This commit is contained in:
parent
5f3cf69fac
commit
b8d683b0d5
2 changed files with 11 additions and 2 deletions
|
|
@ -195,23 +195,31 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
|
|||
if (usingCustomVertexShader) {
|
||||
// make sure it compiles with glslang first
|
||||
if (!gfx_compile_shader_to_spirv(GLSLANG_STAGE_VERTEX, vsShaderCode, vertexShader)) {
|
||||
LOG_ERROR("Failed to compile vertex shader!");
|
||||
LOG_ERROR("Failed to compile custom vertex shader to SPIR-V!");
|
||||
usingCustomVertexShader = false;
|
||||
free(vsShaderCode);
|
||||
vsShaderCode = (char*)vs_buf;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gfx_compile_shader_to_spirv(GLSLANG_STAGE_VERTEX, vsShaderCode, vertexShader)) {
|
||||
sys_fatal("Failed to compile vertex shader to SPIR-V!");
|
||||
}
|
||||
|
||||
if (usingCustomFragmentShader) {
|
||||
// make sure it compiles with glslang first
|
||||
if (!gfx_compile_shader_to_spirv(GLSLANG_STAGE_FRAGMENT, fsShaderCode, fragmentShader)) {
|
||||
LOG_ERROR("Failed to compile fragment shader!");
|
||||
LOG_ERROR("Failed to compile custom fragment shader to SPIR-V!");
|
||||
usingCustomFragmentShader = false;
|
||||
free(fsShaderCode);
|
||||
fsShaderCode = (char*)fs_buf;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gfx_compile_shader_to_spirv(GLSLANG_STAGE_FRAGMENT, fsShaderCode, fragmentShader)) {
|
||||
sys_fatal("Failed to compile fragment shader to SPIR-V!");
|
||||
}
|
||||
|
||||
const GLchar *sources[2] = { vsShaderCode, fsShaderCode };
|
||||
GLint lengths[2] = { strlen(vsShaderCode), strlen(fsShaderCode) };
|
||||
GLint success;
|
||||
|
|
|
|||
|
|
@ -616,6 +616,7 @@ static void process_shader_line(struct Shader *shader, struct ShaderInput *refer
|
|||
// add to shader uniforms
|
||||
snprintf(shader->shaderUniforms[sShaderUniformCount].name, MAX_SHADER_VARIABLE_NAME, "%s", name);
|
||||
shader->shaderUniforms[sShaderUniformCount].location = sShaderUniformCount;
|
||||
shader->shaderUniforms[sShaderUniformCount].size = 1;
|
||||
if (sShaderUniformCount < MAX_SHADER_UNIFORMS - 1) { sShaderUniformCount++; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue