mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
This is an effort to be able to use the same GLSL code for both Vulkan and OpenGL. This is done by first compiling the Vulkan GLSL code to SPIR-V and then using a custom tool (which uses SPIRV-Cross) to convert that back into GLSL 1.50 compatible code. The required tool will be downloaded by CMake when glslc is found in the path. This is included in the Vulkan SDK. To avoid having a hard dependency on this, the generated files are included in the VCS and are only regenerated when glslc is found on the system.
43 lines
848 B
GLSL
43 lines
848 B
GLSL
#version 450
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
|
|
layout (location = 0) in vec4 vertPosition;
|
|
layout (location = 1) in vec4 vertColor;
|
|
layout (location = 2) in vec4 vertTexCoord;
|
|
|
|
layout (location = 0) out vec4 fragTexCoord;
|
|
layout (location = 1) out vec4 fragColor;
|
|
|
|
layout (binding = 0, std140) uniform matrixData {
|
|
mat4 modelViewMatrix;
|
|
mat4 projMatrix;
|
|
};
|
|
|
|
layout (binding = 1, std140) uniform genericData {
|
|
mat4 modelMatrix;
|
|
|
|
vec4 color;
|
|
|
|
vec4 clipEquation;
|
|
|
|
int baseMapIndex;
|
|
int alphaTexture;
|
|
int noTexturing;
|
|
int srgb;
|
|
|
|
float intensity;
|
|
float alphaThreshold;
|
|
bool clipEnabled;
|
|
};
|
|
|
|
void main()
|
|
{
|
|
fragTexCoord = vertTexCoord;
|
|
fragColor = vertColor * color;
|
|
gl_Position = projMatrix * modelViewMatrix * vertPosition;
|
|
|
|
if (clipEnabled) {
|
|
gl_ClipDistance[0] = dot(clipEquation, modelMatrix * vertPosition);
|
|
}
|
|
}
|