mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-07-05 22:16:53 +00:00
Stricter sanitization, fix default lua shader
This commit is contained in:
parent
0297041d86
commit
ae3de517da
2 changed files with 11 additions and 6 deletions
|
|
@ -118,9 +118,7 @@ local function on_vertex_shader_create(cc, shaderIndex)
|
|||
end
|
||||
|
||||
table.insert(vs, "in vec3 aNormal;")
|
||||
table.insert(vs, "out vec3 vNormal;")
|
||||
table.insert(vs, "in vec3 aBarycentric;")
|
||||
table.insert(vs, "out vec3 vBarycentric;")
|
||||
|
||||
if opt_fog then
|
||||
table.insert(vs, "out float vFogZ;")
|
||||
|
|
@ -144,9 +142,6 @@ local function on_vertex_shader_create(cc, shaderIndex)
|
|||
table.insert(vs, string.format("vInput%d = aInput%d;", i, i))
|
||||
end
|
||||
|
||||
table.insert(vs, "vNormal = aNormal;")
|
||||
table.insert(vs, "vBarycentric = aBarycentric;")
|
||||
|
||||
table.insert(vs, "gl_Position = aVtxPos;")
|
||||
|
||||
if opt_fog then
|
||||
|
|
|
|||
|
|
@ -753,6 +753,15 @@ static void gfx_sanitize_shader(struct Shader *shader, struct ShaderInput *refer
|
|||
|
||||
bool gfx_sanitize_vertex_shader(struct Shader *shader, struct ShaderInput *referenceInputs, struct ShaderBinding *referenceBindings, char **shaderCode) {
|
||||
gfx_sanitize_shader(shader, referenceInputs, referenceBindings, shaderCode);
|
||||
// double check we are not missing any inputs, if we are, error out since it can cause
|
||||
// issues in certain render apis
|
||||
for (int i = 0; i < MAX_SHADER_INPUTS; i++) {
|
||||
if (strncmp(referenceInputs[i].name, shader->shaderInputs[i].name, MAX_SHADER_VARIABLE_NAME) != 0 || referenceInputs[i].location != shader->shaderInputs[i].location) {
|
||||
// mismatched! tell the shader code this is not a valid shader
|
||||
LOG_ERROR("Failed to sanitize vertex shader! Mismatch between expected inputs and inputs in the vertex shader! Index is %d, expected output is %s, vertex output is %s", i, referenceInputs[i].name, shader->shaderInputs[i].name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -764,7 +773,8 @@ bool gfx_sanitize_fragment_shader(struct Shader *shader, struct ShaderOutput *ou
|
|||
inputs[i].location = outputsFromVertexShader[i].location;
|
||||
}
|
||||
gfx_sanitize_shader(shader, inputs, referenceBindings, shaderCode);
|
||||
// double check we are not missing any inputs, if we are, error out
|
||||
// double check we are not missing any inputs, if we are, error out since it can cause
|
||||
// issues in certain render apis
|
||||
for (int i = 0; i < MAX_SHADER_INPUTS; i++) {
|
||||
if (strncmp(inputs[i].name, shader->shaderInputs[i].name, MAX_SHADER_VARIABLE_NAME) != 0 || inputs[i].location != shader->shaderInputs[i].location) {
|
||||
// mismatched! tell the shader code this is not a valid shader
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue