Missing shader
This commit is contained in:
parent
c1c81ee761
commit
f4b4dd653a
@ -4,24 +4,23 @@
|
|||||||
|
|
||||||
#include "global.glsl"
|
#include "global.glsl"
|
||||||
|
|
||||||
layout(std430, buffer_reference, buffer_reference_align = 4) readonly buffer PositionBuffer
|
layout(std430, buffer_reference, buffer_reference_align = 64) readonly buffer PositionBuffer
|
||||||
{
|
{
|
||||||
vec3 positions[];
|
float positions[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OtherData
|
struct OtherData
|
||||||
{
|
{
|
||||||
vec3 normal;
|
float normal_and_tangent[6];
|
||||||
vec3 tangent;
|
|
||||||
vec2 uv;
|
vec2 uv;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(std430, buffer_reference, buffer_reference_align = 4) readonly buffer OtherDataBuffer
|
layout(std430, buffer_reference, buffer_reference_align = 16) readonly buffer OtherDataBuffer
|
||||||
{
|
{
|
||||||
OtherData other_data[];
|
OtherData other_data[];
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(push_constant, std430) uniform constants
|
layout(push_constant, std430, row_major) uniform constants
|
||||||
{
|
{
|
||||||
mat4 local_to_world;
|
mat4 local_to_world;
|
||||||
PositionBuffer positions;
|
PositionBuffer positions;
|
||||||
@ -33,15 +32,15 @@ layout(push_constant, std430) uniform constants
|
|||||||
#if VERTEX_SHADER
|
#if VERTEX_SHADER
|
||||||
|
|
||||||
// QUAD
|
// QUAD
|
||||||
vec2 positions[6] = vec2[](
|
// vec2 positions[6] = vec2[](
|
||||||
vec2(-1, -1),
|
// vec2(-1, -1),
|
||||||
vec2(-1, 1),
|
// vec2(-1, 1),
|
||||||
vec2(1, 1),
|
// vec2(1, 1),
|
||||||
|
//
|
||||||
vec2(1, 1),
|
// vec2(1, 1),
|
||||||
vec2(1, -1),
|
// vec2(1, -1),
|
||||||
vec2(-1, -1)
|
// vec2(-1, -1)
|
||||||
);
|
// );
|
||||||
|
|
||||||
layout(location = 0) out vec2 OutUV;
|
layout(location = 0) out vec2 OutUV;
|
||||||
|
|
||||||
@ -49,9 +48,16 @@ void main() {
|
|||||||
PositionBuffer positions_ptr = PushConstants.positions;
|
PositionBuffer positions_ptr = PushConstants.positions;
|
||||||
OtherDataBuffer other_data_ptr = PushConstants.other_data;
|
OtherDataBuffer other_data_ptr = PushConstants.other_data;
|
||||||
|
|
||||||
OutUV = other_data_ptr.other_data[gl_VertexIndex].uv;
|
OtherData other_data = other_data_ptr.other_data[gl_VertexIndex];
|
||||||
|
vec3 normal = vec3(other_data.normal_and_tangent[0], other_data.normal_and_tangent[1], other_data.normal_and_tangent[2]);
|
||||||
|
vec3 tangent = vec3(other_data.normal_and_tangent[3], other_data.normal_and_tangent[4], other_data.normal_and_tangent[5]);
|
||||||
|
vec2 uv = other_data.uv;
|
||||||
|
|
||||||
gl_Position = vec4(positions_ptr.positions[gl_VertexIndex], 1.0) * PushConstants.local_to_world * Global.view.world_to_clip;
|
OutUV = uv;
|
||||||
|
// OutUV.y = 1 - OutUV.y;
|
||||||
|
|
||||||
|
vec3 local_pos = vec3(positions_ptr.positions[gl_VertexIndex * 3 + 0], positions_ptr.positions[gl_VertexIndex * 3 + 1], positions_ptr.positions[gl_VertexIndex * 3 + 2]);
|
||||||
|
gl_Position = vec4(local_pos, 1.0) * PushConstants.local_to_world * Global.view.world_to_clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -62,7 +68,7 @@ layout(location = 0) in vec2 InUV;
|
|||||||
layout(location = 0) out vec4 FragColor;
|
layout(location = 0) out vec4 FragColor;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FragColor = vec4(1); // vec4(texture(sampler2D(global_textures2d[PushConstants.color_texture], global_samplers[PushConstants.color_sampler]), InUV).rgb, 1.0);
|
FragColor = vec4(texture(sampler2D(global_textures2d[PushConstants.color_texture], global_samplers[PushConstants.color_sampler]), InUV).rgb, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user