diff --git a/src/pc/gfx/gfx_opengl.c b/src/pc/gfx/gfx_opengl.c index 38e263866..aec2c8f38 100644 --- a/src/pc/gfx/gfx_opengl.c +++ b/src/pc/gfx/gfx_opengl.c @@ -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; diff --git a/src/pc/gfx/gfx_shader.c b/src/pc/gfx/gfx_shader.c index a05ecebf9..191a0942e 100644 --- a/src/pc/gfx/gfx_shader.c +++ b/src/pc/gfx/gfx_shader.c @@ -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++; } } }