gpu/internal/convertshaders,gpu: represent converted shaders with raw literals

Raw strings with linebreaks are easier to read and produce smaller
diffs.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-04-12 12:04:53 +02:00
parent 495c690187
commit fbee13a07d
13 changed files with 7086 additions and 474 deletions
+7 -5
View File
@@ -2,16 +2,18 @@
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include <common.inc>
#include "common.h"
layout(binding = 0) uniform Block {
vec4 transform;
vec4 uvTransformR1;
vec4 uvTransformR2;
float z;
};
} _block;
layout(location = 0) in vec2 pos;
@@ -20,7 +22,7 @@ layout(location = 1) in vec2 uv;
layout(location = 0) out vec2 vUV;
void main() {
vec2 p = pos*transform.xy + transform.zw;
gl_Position = toClipSpace(vec4(p, z, 1));
vUV = transform3x2(m3x2(uvTransformR1.xyz, uvTransformR2.xyz), vec3(uv,1)).xy;
vec2 p = pos*_block.transform.xy + _block.transform.zw;
gl_Position = toClipSpace(vec4(p, _block.z, 1));
vUV = transform3x2(m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz), vec3(uv,1)).xy;
}
+7 -5
View File
@@ -2,9 +2,11 @@
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include <common.inc>
#include "common.h"
layout(binding = 0) uniform Block {
vec4 transform;
@@ -12,7 +14,7 @@ layout(binding = 0) uniform Block {
vec4 uvTransformR1;
vec4 uvTransformR2;
float z;
};
} _block;
layout(location = 0) in vec2 pos;
@@ -22,8 +24,8 @@ layout(location = 1) in vec2 uv;
layout(location = 1) out vec2 vUV;
void main() {
gl_Position = toClipSpace(vec4(pos*transform.xy + transform.zw, z, 1));
vUV = transform3x2(m3x2(uvTransformR1.xyz, uvTransformR2.xyz), vec3(uv,1)).xy;
gl_Position = toClipSpace(vec4(pos*_block.transform.xy + _block.transform.zw, _block.z, 1));
vUV = transform3x2(m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz), vec3(uv,1)).xy;
vec3 uv3 = transform3x2(fboTextureTransform, vec3(uv, 1.0));
vCoverUV = (uv3*vec3(uvCoverTransform.xy, 1.0)+vec3(uvCoverTransform.zw, 0.0)).xy;
vCoverUV = (uv3*vec3(_block.uvCoverTransform.xy, 1.0)+vec3(_block.uvCoverTransform.zw, 0.0)).xy;
}
+6 -4
View File
@@ -2,9 +2,11 @@
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include <common.inc>
#include "common.h"
layout(location = 0) in vec2 pos;
layout(location = 1) in vec2 uv;
@@ -12,7 +14,7 @@ layout(location = 1) in vec2 uv;
layout(binding = 0) uniform Block {
vec4 uvTransform;
vec4 subUVTransform;
};
} _block;
layout(location = 0) out vec2 vUV;
@@ -20,7 +22,7 @@ void main() {
vec3 p = transform3x2(fboTransform, vec3(pos, 1.0));
gl_Position = vec4(p, 1);
vec3 uv3 = transform3x2(fboTextureTransform, vec3(uv, 1.0));
vUV = uv3.xy*subUVTransform.xy + subUVTransform.zw;
vUV = uv3.xy*_block.subUVTransform.xy + _block.subUVTransform.zw;
vUV = transform3x2(fboTextureTransform, vec3(vUV, 1.0)).xy;
vUV = vUV*uvTransform.xy + uvTransform.zw;
vUV = vUV*_block.uvTransform.xy + _block.uvTransform.zw;
}
+6 -6
View File
@@ -7,7 +7,7 @@ precision highp float;
layout(binding = 0) uniform Block {
vec4 transform;
vec2 pathOffset;
};
} _block;
layout(location=0) in float corner;
layout(location=1) in float maxy;
@@ -23,10 +23,10 @@ void main() {
// Add a one pixel overlap so curve quads cover their
// entire curves. Could use conservative rasterization
// if available.
vec2 from = from + pathOffset;
vec2 ctrl = ctrl + pathOffset;
vec2 to = to + pathOffset;
float maxy = maxy + pathOffset.y;
vec2 from = from + _block.pathOffset;
vec2 ctrl = ctrl + _block.pathOffset;
vec2 to = to + _block.pathOffset;
float maxy = maxy + _block.pathOffset.y;
vec2 pos;
float c = corner;
if (c >= 0.375) {
@@ -47,7 +47,7 @@ void main() {
vFrom = from-pos;
vCtrl = ctrl-pos;
vTo = to-pos;
pos = pos*transform.xy + transform.zw;
pos = pos*_block.transform.xy + _block.transform.zw;
gl_Position = vec4(pos, 1, 1);
}