28 lines
No EOL
711 B
GLSL
28 lines
No EOL
711 B
GLSL
#version 450
|
|
|
|
const int MAX_TEXTURES = 512;
|
|
const float GAMMA_CONST = 0.4545;
|
|
layout(location = 0) in vec2 inUV;
|
|
|
|
layout(location = 0) out vec4 outColor;
|
|
layout(push_constant) uniform pc {
|
|
layout(offset = 28) uint textureIndex;
|
|
} push_constants;
|
|
|
|
layout(set = 1, binding = 0) uniform sampler2D spriteTextures[MAX_TEXTURES];
|
|
|
|
vec4 gamma(vec4 color){
|
|
return color = vec4(pow(color.rgb,vec3(GAMMA_CONST)),color.a);
|
|
}
|
|
|
|
void main() {
|
|
if (push_constants.textureIndex >= MAX_TEXTURES){
|
|
outColor = vec4(0.0,0.0,1.0,1.0);
|
|
return;
|
|
}
|
|
vec4 tex = texture(spriteTextures[push_constants.textureIndex], inUV);
|
|
outColor = gamma(tex);
|
|
if (outColor.a <= 0.09) {
|
|
discard;
|
|
}
|
|
} |