Crafter.Graphics/example/VulkanShader/CustomShader.glsl
2025-06-13 23:59:36 +02:00

49 lines
1.5 KiB
GLSL

/*
Crafter®.Graphics
Copyright (C) 2025 Catcrafts®
Catcrafts.net
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#version 450
#extension GL_EXT_mesh_shader : require
layout (binding = 0) buffer COLORS
{
vec4 colors[];
} colors;
layout (location = 0) out PerVertexData
{
vec4 color;
} outVert[];
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(triangles, max_vertices = 3, max_primitives = 1) out;
void main()
{
SetMeshOutputsEXT(3, 1);
gl_MeshVerticesEXT[0].gl_Position = vec4(0, -0.3, 0, 1);
gl_MeshVerticesEXT[1].gl_Position = vec4(0.3, 0.3, 0, 1);
gl_MeshVerticesEXT[2].gl_Position = vec4(-0.3, 0.3, 0, 1);
outVert[0].color = colors.colors[0];
outVert[1].color = colors.colors[1];
outVert[2].color = colors.colors[2];
gl_PrimitiveTriangleIndicesEXT[0] = uvec3(0, 1, 2);
}