GLSL: Change shader type specifier from [vertex] to #[vertex]

The added `#` prevents clang-format from misinterpreting the meaning
of this statement and thus messing up the formatting of the next
lines up until the first `layout` statement.

Similarly, a semicolon is now enforced on `versions` defines to
prevent clang-format from messing up formatting and putting them
all on a single line. Note: In its current state the code will
ignore chained statements on a single line separated by a semicolon.

Also removed some extraneous lines missed in previous style changes
or added by mistake with said changes (e.g. after uniform definitions
that clang-format messes up somewhat too, but we live with it).
This commit is contained in:
Rémi Verschelde 2020-05-18 10:56:22 +02:00
parent 0187cdae9a
commit c74d65cec8
34 changed files with 102 additions and 279 deletions

View file

@ -1,10 +1,9 @@
/* clang-format off */
[versions]
#[versions]
lines = "#define MODE_LINES"
triangles = "#define MODE_TRIANGLES"
lines = "#define MODE_LINES";
triangles = "#define MODE_TRIANGLES";
[vertex]
#[vertex]
#version 450
@ -12,22 +11,20 @@ VERSION_DEFINES
#include "lm_common_inc.glsl"
/* clang-format on */
layout(push_constant, binding = 0, std430) uniform Params {
uint base_index;
uint slice;
vec2 uv_offset;
bool debug;
float blend;
uint pad[2];
} params;
layout(push_constant, binding = 0, std430) uniform Params {
uint base_index;
uint slice;
vec2 uv_offset;
bool debug;
float blend;
uint pad[2];
}
params;
layout(location = 0) out vec3 uv_interp;
void main() {
#ifdef MODE_TRIANGLES
uint triangle_idx = params.base_index + gl_VertexIndex / 3;
uint triangle_subidx = gl_VertexIndex % 3;
@ -42,7 +39,6 @@ void main() {
uv_interp = vec3(uv, float(params.slice));
gl_Position = vec4((uv + params.uv_offset) * 2.0 - 1.0, 0.0001, 1.0);
#endif
#ifdef MODE_LINES
@ -71,12 +67,10 @@ void main() {
uv_interp = vec3(src_uv, float(params.slice));
gl_Position = vec4(dst_uv * 2.0 - 1.0, 0.0001, 1.0);
;
#endif
}
/* clang-format off */
[fragment]
#[fragment]
#version 450
@ -84,16 +78,15 @@ VERSION_DEFINES
#include "lm_common_inc.glsl"
/* clang-format on */
layout(push_constant, binding = 0, std430) uniform Params {
uint base_index;
uint slice;
vec2 uv_offset;
bool debug;
float blend;
uint pad[2];
} params;
layout(push_constant, binding = 0, std430) uniform Params {
uint base_index;
uint slice;
vec2 uv_offset;
bool debug;
float blend;
uint pad[2];
}
params;
layout(location = 0) in vec3 uv_interp;