From df6982e0f9733b59aa1249176ce4ec773b5d9097 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sat, 9 May 2020 11:17:02 -0700 Subject: [PATCH] use explicit "vulkan-style" shaders to generate all shader outputs --- gl/src/lib.rs | 34 +- metal/src/lib.rs | 2 +- resources/shaders/gl3/blit.fs.glsl | 28 +- resources/shaders/gl3/blit.vs.glsl | 27 +- resources/shaders/gl3/clear.fs.glsl | 26 +- resources/shaders/gl3/clear.vs.glsl | 32 +- resources/shaders/gl3/debug_solid.fs.glsl | 26 +- resources/shaders/gl3/debug_solid.vs.glsl | 28 +- resources/shaders/gl3/debug_texture.fs.glsl | 30 +- resources/shaders/gl3/debug_texture.vs.glsl | 37 +- resources/shaders/gl3/demo_ground.fs.glsl | 42 +- resources/shaders/gl3/demo_ground.vs.glsl | 31 +- resources/shaders/gl3/fill.fs.glsl | 73 +- resources/shaders/gl3/fill.vs.glsl | 89 +- resources/shaders/gl3/reproject.fs.glsl | 32 +- resources/shaders/gl3/reproject.vs.glsl | 32 +- resources/shaders/gl3/stencil.fs.glsl | 22 +- resources/shaders/gl3/stencil.vs.glsl | 21 +- resources/shaders/gl3/tile.fs.glsl | 1033 ++++++++-------- resources/shaders/gl3/tile.vs.glsl | 78 +- resources/shaders/gl3/tile_clip.fs.glsl | 26 +- resources/shaders/gl3/tile_clip.vs.glsl | 34 +- resources/shaders/gl3/tile_copy.fs.glsl | 29 +- resources/shaders/gl3/tile_copy.vs.glsl | 32 +- resources/shaders/gl4/blit.fs.glsl | 30 +- resources/shaders/gl4/blit.vs.glsl | 29 +- resources/shaders/gl4/clear.fs.glsl | 26 +- resources/shaders/gl4/clear.vs.glsl | 32 +- resources/shaders/gl4/debug_solid.fs.glsl | 26 +- resources/shaders/gl4/debug_solid.vs.glsl | 28 +- resources/shaders/gl4/debug_texture.fs.glsl | 32 +- resources/shaders/gl4/debug_texture.vs.glsl | 39 +- resources/shaders/gl4/demo_ground.fs.glsl | 44 +- resources/shaders/gl4/demo_ground.vs.glsl | 35 +- resources/shaders/gl4/fill.cs.glsl | 145 +-- resources/shaders/gl4/fill.fs.glsl | 79 +- resources/shaders/gl4/fill.vs.glsl | 95 +- resources/shaders/gl4/reproject.fs.glsl | 34 +- resources/shaders/gl4/reproject.vs.glsl | 34 +- resources/shaders/gl4/stencil.fs.glsl | 22 +- resources/shaders/gl4/stencil.vs.glsl | 21 +- resources/shaders/gl4/tile.fs.glsl | 1043 ++++++++--------- resources/shaders/gl4/tile.vs.glsl | 84 +- resources/shaders/gl4/tile_clip.fs.glsl | 30 +- resources/shaders/gl4/tile_clip.vs.glsl | 40 +- resources/shaders/gl4/tile_copy.fs.glsl | 29 +- resources/shaders/gl4/tile_copy.vs.glsl | 32 +- resources/shaders/metal/blit.fs.metal | 4 +- resources/shaders/metal/clear.fs.metal | 9 +- resources/shaders/metal/clear.vs.metal | 14 +- resources/shaders/metal/debug_solid.fs.metal | 9 +- resources/shaders/metal/debug_solid.vs.metal | 9 +- .../shaders/metal/debug_texture.fs.metal | 11 +- .../shaders/metal/debug_texture.vs.metal | 16 +- resources/shaders/metal/demo_ground.fs.metal | 23 +- resources/shaders/metal/demo_ground.vs.metal | 16 +- resources/shaders/metal/fill.cs.metal | 21 +- resources/shaders/metal/fill.fs.metal | 8 +- resources/shaders/metal/fill.vs.metal | 26 +- resources/shaders/metal/reproject.fs.metal | 11 +- resources/shaders/metal/reproject.vs.metal | 9 +- resources/shaders/metal/tile.fs.metal | 205 ++-- resources/shaders/metal/tile.vs.metal | 31 +- resources/shaders/metal/tile_clip.fs.metal | 4 +- resources/shaders/metal/tile_copy.fs.metal | 11 +- resources/shaders/metal/tile_copy.vs.metal | 16 +- resources/shaders/vulkan/blit.fs.spv | Bin 0 -> 1040 bytes resources/shaders/vulkan/blit.vs.spv | Bin 0 -> 1140 bytes resources/shaders/vulkan/clear.fs.spv | Bin 0 -> 792 bytes resources/shaders/vulkan/clear.vs.spv | Bin 0 -> 1656 bytes resources/shaders/vulkan/debug_solid.fs.spv | Bin 0 -> 792 bytes resources/shaders/vulkan/debug_solid.vs.spv | Bin 0 -> 1324 bytes resources/shaders/vulkan/debug_texture.fs.spv | Bin 0 -> 1324 bytes resources/shaders/vulkan/debug_texture.vs.spv | Bin 0 -> 1720 bytes resources/shaders/vulkan/demo_ground.fs.spv | Bin 0 -> 1248 bytes resources/shaders/vulkan/demo_ground.vs.spv | Bin 0 -> 1572 bytes resources/shaders/vulkan/fill.cs.spv | Bin 0 -> 7048 bytes resources/shaders/vulkan/fill.fs.spv | Bin 0 -> 3084 bytes resources/shaders/vulkan/fill.vs.spv | Bin 0 -> 4468 bytes resources/shaders/vulkan/reproject.fs.spv | Bin 0 -> 1512 bytes resources/shaders/vulkan/reproject.vs.spv | Bin 0 -> 1332 bytes resources/shaders/vulkan/stencil.fs.spv | Bin 0 -> 352 bytes resources/shaders/vulkan/stencil.vs.spv | Bin 0 -> 828 bytes resources/shaders/vulkan/tile.fs.spv | Bin 0 -> 34884 bytes resources/shaders/vulkan/tile.vs.spv | Bin 0 -> 4728 bytes resources/shaders/vulkan/tile_clip.fs.spv | Bin 0 -> 968 bytes resources/shaders/vulkan/tile_clip.vs.spv | Bin 0 -> 1668 bytes resources/shaders/vulkan/tile_copy.fs.spv | Bin 0 -> 1080 bytes resources/shaders/vulkan/tile_copy.vs.spv | Bin 0 -> 1464 bytes shaders/Makefile | 43 +- shaders/blit.fs.glsl | 7 +- shaders/blit.vs.glsl | 2 +- shaders/clear.fs.glsl | 8 +- shaders/clear.vs.glsl | 12 +- shaders/debug_solid.fs.glsl | 8 +- shaders/debug_solid.vs.glsl | 8 +- shaders/debug_texture.fs.glsl | 13 +- shaders/debug_texture.vs.glsl | 14 +- shaders/demo_ground.fs.glsl | 12 +- shaders/demo_ground.vs.glsl | 14 +- shaders/fill.cs.glsl | 19 +- shaders/fill.fs.glsl | 7 +- shaders/fill.inc.glsl | 4 +- shaders/fill.vs.glsl | 20 +- shaders/reproject.fs.glsl | 13 +- shaders/reproject.vs.glsl | 8 +- shaders/stencil.fs.glsl | 2 +- shaders/stencil.vs.glsl | 2 +- shaders/tile.fs.glsl | 104 +- shaders/tile.vs.glsl | 31 +- shaders/tile_clip.fs.glsl | 7 +- shaders/tile_clip.vs.glsl | 2 +- shaders/tile_copy.fs.glsl | 13 +- shaders/tile_copy.vs.glsl | 14 +- 114 files changed, 2050 insertions(+), 2643 deletions(-) create mode 100644 resources/shaders/vulkan/blit.fs.spv create mode 100644 resources/shaders/vulkan/blit.vs.spv create mode 100644 resources/shaders/vulkan/clear.fs.spv create mode 100644 resources/shaders/vulkan/clear.vs.spv create mode 100644 resources/shaders/vulkan/debug_solid.fs.spv create mode 100644 resources/shaders/vulkan/debug_solid.vs.spv create mode 100644 resources/shaders/vulkan/debug_texture.fs.spv create mode 100644 resources/shaders/vulkan/debug_texture.vs.spv create mode 100644 resources/shaders/vulkan/demo_ground.fs.spv create mode 100644 resources/shaders/vulkan/demo_ground.vs.spv create mode 100644 resources/shaders/vulkan/fill.cs.spv create mode 100644 resources/shaders/vulkan/fill.fs.spv create mode 100644 resources/shaders/vulkan/fill.vs.spv create mode 100644 resources/shaders/vulkan/reproject.fs.spv create mode 100644 resources/shaders/vulkan/reproject.vs.spv create mode 100644 resources/shaders/vulkan/stencil.fs.spv create mode 100644 resources/shaders/vulkan/stencil.vs.spv create mode 100644 resources/shaders/vulkan/tile.fs.spv create mode 100644 resources/shaders/vulkan/tile.vs.spv create mode 100644 resources/shaders/vulkan/tile_clip.fs.spv create mode 100644 resources/shaders/vulkan/tile_clip.vs.spv create mode 100644 resources/shaders/vulkan/tile_copy.fs.spv create mode 100644 resources/shaders/vulkan/tile_copy.vs.spv diff --git a/gl/src/lib.rs b/gl/src/lib.rs index dabfec0ca..13ea36b25 100644 --- a/gl/src/lib.rs +++ b/gl/src/lib.rs @@ -148,16 +148,16 @@ impl GLDevice { unsafe { match *data { UniformData::Float(value) => { - gl::Uniform1f(uniform.location, value); ck(); + gl::Uniform4f(uniform.location, value, 0.0, 0.0, 0.0); ck(); } UniformData::IVec2(value) => { - gl::Uniform2i(uniform.location, value[0], value[1]); ck(); + gl::Uniform4i(uniform.location, value[0], value[1], 0, 0); ck(); } UniformData::IVec3(value) => { - gl::Uniform3i(uniform.location, value[0], value[1], value[2]); ck(); + gl::Uniform4i(uniform.location, value[0], value[1], value[2], 0); ck(); } UniformData::Int(value) => { - gl::Uniform1i(uniform.location, value); ck(); + gl::Uniform4i(uniform.location, value, 0, 0, 0); ck(); } UniformData::Mat2(data) => { assert_eq!(mem::size_of::(), 4 * 4); @@ -168,17 +168,16 @@ impl GLDevice { } UniformData::Mat4(data) => { assert_eq!(mem::size_of::<[F32x4; 4]>(), 4 * 4 * 4); - let data_ptr: *const F32x4 = data.as_ptr(); - gl::UniformMatrix4fv(uniform.location, - 1, - gl::FALSE, - data_ptr as *const GLfloat); + gl::Uniform4f(uniform.location, data[0].x(), data[0].y(), data[0].z(), data[0].w()); ck(); + gl::Uniform4f(uniform.location + 1, data[1].x(), data[1].y(), data[1].z(), data[1].w()); ck(); + gl::Uniform4f(uniform.location + 2, data[2].x(), data[2].y(), data[2].z(), data[2].w()); ck(); + gl::Uniform4f(uniform.location + 3, data[3].x(), data[3].y(), data[3].z(), data[3].w()); ck(); } UniformData::Vec2(data) => { - gl::Uniform2f(uniform.location, data.x(), data.y()); ck(); + gl::Uniform4f(uniform.location, data.x(), data.y(), 0.0, 0.0); ck(); } UniformData::Vec3(data) => { - gl::Uniform3f(uniform.location, data[0], data[1], data[2]); ck(); + gl::Uniform4f(uniform.location, data[0], data[1], data[2], 0.0); ck(); } UniformData::Vec4(data) => { gl::Uniform4f(uniform.location, data.x(), data.y(), data.z(), data.w()); ck(); @@ -432,10 +431,17 @@ impl Device for GLDevice { } fn get_uniform(&self, program: &GLProgram, name: &str) -> GLUniform { - let name = CString::new(format!("u{}", name)).unwrap(); - let location = unsafe { - gl::GetUniformLocation(program.gl_program, name.as_ptr() as *const GLchar) + let uniform_name = CString::new(format!("u{}", name)).unwrap(); + let mut location = unsafe { + gl::GetUniformLocation(program.gl_program, uniform_name.as_ptr() as *const GLchar) }; ck(); + if location < 0 { + let uniform_name = CString::new(format!("SPIRV_Cross_Combinedu{}uSampler", name)).unwrap(); + location = unsafe { + gl::GetUniformLocation(program.gl_program, uniform_name.as_ptr() as *const GLchar) + }; + ck(); + }; GLUniform { location } } diff --git a/metal/src/lib.rs b/metal/src/lib.rs index 6e85722b0..4ceff48d0 100644 --- a/metal/src/lib.rs +++ b/metal/src/lib.rs @@ -848,7 +848,7 @@ impl MetalDevice { None => panic!("get_uniform_index() called before reflection!"), Some(ref arguments) => arguments, }; - let (main_name, sampler_name) = (format!("u{}", name), format!("u{}Smplr", name)); + let (main_name, sampler_name) = (format!("u{}", name), format!("u{}Sampler", name)); let (mut main_argument, mut sampler_argument) = (None, None); for argument_index in 0..arguments.len() { let argument = arguments.object_at(argument_index); diff --git a/resources/shaders/gl3/blit.fs.glsl b/resources/shaders/gl3/blit.fs.glsl index b32fc956f..806d71495 100644 --- a/resources/shaders/gl3/blit.fs.glsl +++ b/resources/shaders/gl3/blit.fs.glsl @@ -2,30 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform sampler2D uSrc; +uniform sampler2D SPIRV_Cross_CombineduSrcuSampler; in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; -out vec4 oFragColor; - -void main(){ - vec4 color = texture(uSrc, vTexCoord); - oFragColor = vec4(color . rgb * color . a, color . a); +void main() +{ + vec4 color = texture(SPIRV_Cross_CombineduSrcuSampler, vTexCoord); + oFragColor = vec4(color.xyz * color.w, color.w); } diff --git a/resources/shaders/gl3/blit.vs.glsl b/resources/shaders/gl3/blit.vs.glsl index 6c9391d50..7efaa8cdc 100644 --- a/resources/shaders/gl3/blit.vs.glsl +++ b/resources/shaders/gl3/blit.vs.glsl @@ -2,32 +2,13 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -in ivec2 aPosition; - +layout(location = 0) in ivec2 aPosition; out vec2 vTexCoord; -void main(){ +void main() +{ vec2 texCoord = vec2(aPosition); - - - vTexCoord = texCoord; - gl_Position = vec4(mix(vec2(- 1.0), vec2(1.0), vec2(aPosition)), 0.0, 1.0); + gl_Position = vec4(mix(vec2(-1.0), vec2(1.0), vec2(aPosition)), 0.0, 1.0); } diff --git a/resources/shaders/gl3/clear.fs.glsl b/resources/shaders/gl3/clear.fs.glsl index 447e4d838..bfc45445d 100644 --- a/resources/shaders/gl3/clear.fs.glsl +++ b/resources/shaders/gl3/clear.fs.glsl @@ -2,27 +2,11 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uColor[1]; +layout(location = 0) out vec4 oFragColor; - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uColor; - -out vec4 oFragColor; - -void main(){ - oFragColor = vec4(uColor . rgb, 1.0)* uColor . a; +void main() +{ + oFragColor = vec4(uColor[0].xyz, 1.0) * uColor[0].w; } diff --git a/resources/shaders/gl3/clear.vs.glsl b/resources/shaders/gl3/clear.vs.glsl index 2dd02b1ce..76b85239b 100644 --- a/resources/shaders/gl3/clear.vs.glsl +++ b/resources/shaders/gl3/clear.vs.glsl @@ -2,29 +2,13 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uRect; -uniform vec2 uFramebufferSize; - -in ivec2 aPosition; - -void main(){ - vec2 position = mix(uRect . xy, uRect . zw, vec2(aPosition))/ uFramebufferSize * 2.0 - 1.0; - gl_Position = vec4(position . x, - position . y, 0.0, 1.0); +uniform vec4 uRect[1]; +uniform vec4 uFramebufferSize[1]; +layout(location = 0) in ivec2 aPosition; + +void main() +{ + vec2 position = ((mix(uRect[0].xy, uRect[0].zw, vec2(aPosition)) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); + gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/resources/shaders/gl3/debug_solid.fs.glsl b/resources/shaders/gl3/debug_solid.fs.glsl index 447e4d838..bfc45445d 100644 --- a/resources/shaders/gl3/debug_solid.fs.glsl +++ b/resources/shaders/gl3/debug_solid.fs.glsl @@ -2,27 +2,11 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uColor[1]; +layout(location = 0) out vec4 oFragColor; - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uColor; - -out vec4 oFragColor; - -void main(){ - oFragColor = vec4(uColor . rgb, 1.0)* uColor . a; +void main() +{ + oFragColor = vec4(uColor[0].xyz, 1.0) * uColor[0].w; } diff --git a/resources/shaders/gl3/debug_solid.vs.glsl b/resources/shaders/gl3/debug_solid.vs.glsl index de155484a..705fbc5ef 100644 --- a/resources/shaders/gl3/debug_solid.vs.glsl +++ b/resources/shaders/gl3/debug_solid.vs.glsl @@ -2,28 +2,12 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uFramebufferSize[1]; +layout(location = 0) in ivec2 aPosition; - - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; - -in ivec2 aPosition; - -void main(){ - vec2 position = vec2(aPosition)/ uFramebufferSize * 2.0 - 1.0; - gl_Position = vec4(position . x, - position . y, 0.0, 1.0); +void main() +{ + vec2 position = ((vec2(aPosition) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); + gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/resources/shaders/gl3/debug_texture.fs.glsl b/resources/shaders/gl3/debug_texture.fs.glsl index c786f3520..7a23aec86 100644 --- a/resources/shaders/gl3/debug_texture.fs.glsl +++ b/resources/shaders/gl3/debug_texture.fs.glsl @@ -2,31 +2,15 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform sampler2D uTexture; -uniform vec4 uColor; +uniform vec4 uColor[1]; +uniform sampler2D SPIRV_Cross_CombineduTextureuSampler; in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; -out vec4 oFragColor; - -void main(){ - float alpha = texture(uTexture, vTexCoord). r * uColor . a; - oFragColor = alpha * vec4(uColor . rgb, 1.0); +void main() +{ + float alpha = texture(SPIRV_Cross_CombineduTextureuSampler, vTexCoord).x * uColor[0].w; + oFragColor = vec4(uColor[0].xyz, 1.0) * alpha; } diff --git a/resources/shaders/gl3/debug_texture.vs.glsl b/resources/shaders/gl3/debug_texture.vs.glsl index e073da211..e8965d26f 100644 --- a/resources/shaders/gl3/debug_texture.vs.glsl +++ b/resources/shaders/gl3/debug_texture.vs.glsl @@ -2,33 +2,16 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; -uniform vec2 uTextureSize; - -in ivec2 aPosition; -in ivec2 aTexCoord; - +uniform vec4 uTextureSize[1]; +uniform vec4 uFramebufferSize[1]; out vec2 vTexCoord; - -void main(){ - vTexCoord = vec2(aTexCoord)/ uTextureSize; - vec2 position = vec2(aPosition)/ uFramebufferSize * 2.0 - 1.0; - gl_Position = vec4(position . x, - position . y, 0.0, 1.0); +layout(location = 1) in ivec2 aTexCoord; +layout(location = 0) in ivec2 aPosition; + +void main() +{ + vTexCoord = vec2(aTexCoord) / uTextureSize[0].xy; + vec2 position = ((vec2(aPosition) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); + gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/resources/shaders/gl3/demo_ground.fs.glsl b/resources/shaders/gl3/demo_ground.fs.glsl index 63c0883ea..f33c5b98b 100644 --- a/resources/shaders/gl3/demo_ground.fs.glsl +++ b/resources/shaders/gl3/demo_ground.fs.glsl @@ -2,31 +2,23 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uGroundColor; -uniform vec4 uGridlineColor; - +uniform vec4 uGridlineColor[1]; +uniform vec4 uGroundColor[1]; in vec2 vTexCoord; - -out vec4 oFragColor; - -void main(){ - vec2 texCoordPx = fract(vTexCoord)/ fwidth(vTexCoord); - oFragColor = any(lessThanEqual(texCoordPx, vec2(1.0)))? uGridlineColor : uGroundColor; +layout(location = 0) out vec4 oFragColor; + +void main() +{ + vec2 texCoordPx = fract(vTexCoord) / fwidth(vTexCoord); + vec4 _28; + if (any(lessThanEqual(texCoordPx, vec2(1.0)))) + { + _28 = uGridlineColor[0]; + } + else + { + _28 = uGroundColor[0]; + } + oFragColor = _28; } diff --git a/resources/shaders/gl3/demo_ground.vs.glsl b/resources/shaders/gl3/demo_ground.vs.glsl index cb3a47421..c87472bea 100644 --- a/resources/shaders/gl3/demo_ground.vs.glsl +++ b/resources/shaders/gl3/demo_ground.vs.glsl @@ -2,31 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uTransform; -uniform int uGridlineCount; - -in ivec2 aPosition; - +uniform ivec4 uGridlineCount[1]; +uniform vec4 uTransform[4]; out vec2 vTexCoord; +layout(location = 0) in ivec2 aPosition; -void main(){ - vTexCoord = vec2(aPosition * uGridlineCount); - gl_Position = uTransform * vec4(ivec4(aPosition . x, 0, aPosition . y, 1)); +void main() +{ + vTexCoord = vec2(aPosition * ivec2(uGridlineCount[0].x)); + gl_Position = mat4(uTransform[0], uTransform[1], uTransform[2], uTransform[3]) * vec4(ivec4(aPosition.x, 0, aPosition.y, 1)); } diff --git a/resources/shaders/gl3/fill.fs.glsl b/resources/shaders/gl3/fill.fs.glsl index e56cbaebb..b7c0dee33 100644 --- a/resources/shaders/gl3/fill.fs.glsl +++ b/resources/shaders/gl3/fill.fs.glsl @@ -2,62 +2,31 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform sampler2D SPIRV_Cross_CombineduAreaLUTuSampler; - - - - - - - - - -#extension GL_GOOGLE_include_directive : enable - -precision highp float; - - - - - - - - - - - - - - - - -vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT){ - - vec2 left = from . x < to . x ? from : to, right = from . x < to . x ? to : from; - - - vec2 window = clamp(vec2(from . x, to . x), - 0.5, 0.5); - float offset = mix(window . x, window . y, 0.5)- left . x; - float t = offset /(right . x - left . x); - - - float y = mix(left . y, right . y, t); - float d =(right . y - left . y)/(right . x - left . x); - - - float dX = window . x - window . y; - return texture(areaLUT, vec2(y + 8.0, abs(d * dX))/ 16.0)* dX; -} - - -uniform sampler2D uAreaLUT; - +layout(location = 0) out vec4 oFragColor; in vec2 vFrom; in vec2 vTo; -out vec4 oFragColor; +vec4 computeCoverage(vec2 from, vec2 to, sampler2D SPIRV_Cross_CombinedareaLUTareaLUTSampler) +{ + bvec2 _34 = bvec2(from.x < to.x); + vec2 left = vec2(_34.x ? from.x : to.x, _34.y ? from.y : to.y); + bvec2 _44 = bvec2(from.x < to.x); + vec2 right = vec2(_44.x ? to.x : from.x, _44.y ? to.y : from.y); + vec2 window = clamp(vec2(from.x, to.x), vec2(-0.5), vec2(0.5)); + float offset = mix(window.x, window.y, 0.5) - left.x; + float t = offset / (right.x - left.x); + float y = mix(left.y, right.y, t); + float d = (right.y - left.y) / (right.x - left.x); + float dX = window.x - window.y; + return texture(SPIRV_Cross_CombinedareaLUTareaLUTSampler, vec2(y + 8.0, abs(d * dX)) / vec2(16.0)) * dX; +} -void main(){ - oFragColor = computeCoverage(vFrom, vTo, uAreaLUT); +void main() +{ + vec2 param = vFrom; + vec2 param_1 = vTo; + oFragColor = computeCoverage(param, param_1, SPIRV_Cross_CombineduAreaLUTuSampler); } diff --git a/resources/shaders/gl3/fill.vs.glsl b/resources/shaders/gl3/fill.vs.glsl index 58b0b7f02..6db1875b7 100644 --- a/resources/shaders/gl3/fill.vs.glsl +++ b/resources/shaders/gl3/fill.vs.glsl @@ -2,70 +2,53 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; -uniform vec2 uTileSize; - -in uvec2 aTessCoord; -in uint aFromPx; -in uint aToPx; -in vec2 aFromSubpx; -in vec2 aToSubpx; -in uint aTileIndex; - +uniform vec4 uTileSize[1]; +uniform vec4 uFramebufferSize[1]; +layout(location = 5) in uint aTileIndex; +layout(location = 1) in uint aFromPx; +layout(location = 3) in vec2 aFromSubpx; +layout(location = 2) in uint aToPx; +layout(location = 4) in vec2 aToSubpx; +layout(location = 0) in uvec2 aTessCoord; out vec2 vFrom; out vec2 vTo; -vec2 computeTileOffset(uint tileIndex, float stencilTextureWidth){ - uint tilesPerRow = uint(stencilTextureWidth / uTileSize . x); +vec2 computeTileOffset(uint tileIndex, float stencilTextureWidth) +{ + uint tilesPerRow = uint(stencilTextureWidth / uTileSize[0].x); uvec2 tileOffset = uvec2(tileIndex % tilesPerRow, tileIndex / tilesPerRow); - return vec2(tileOffset)* uTileSize * vec2(1.0, 0.25); + return (vec2(tileOffset) * uTileSize[0].xy) * vec2(1.0, 0.25); } -void main(){ - vec2 tileOrigin = computeTileOffset(aTileIndex, uFramebufferSize . x); - - vec2 from = vec2(aFromPx & 15u, aFromPx >> 4u)+ aFromSubpx; - vec2 to = vec2(aToPx & 15u, aToPx >> 4u)+ aToSubpx; - +void main() +{ + uint param = aTileIndex; + float param_1 = uFramebufferSize[0].x; + vec2 tileOrigin = computeTileOffset(param, param_1); + vec2 from = vec2(float(aFromPx & 15u), float(aFromPx >> 4u)) + aFromSubpx; + vec2 to = vec2(float(aToPx & 15u), float(aToPx >> 4u)) + aToSubpx; vec2 position; - if(aTessCoord . x == 0u) - position . x = floor(min(from . x, to . x)); + if (aTessCoord.x == 0u) + { + position.x = floor(min(from.x, to.x)); + } else - position . x = ceil(max(from . x, to . x)); - if(aTessCoord . y == 0u) - position . y = floor(min(from . y, to . y)); + { + position.x = ceil(max(from.x, to.x)); + } + if (aTessCoord.y == 0u) + { + position.y = floor(min(from.y, to.y)); + } else - position . y = uTileSize . y; - position . y = floor(position . y * 0.25); - - - - - - vec2 offset = vec2(0.0, 1.5)- position * vec2(1.0, 4.0); + { + position.y = uTileSize[0].y; + } + position.y = floor(position.y * 0.25); + vec2 offset = vec2(0.0, 1.5) - (position * vec2(1.0, 4.0)); vFrom = from + offset; vTo = to + offset; - - vec2 globalPosition =(tileOrigin + position)/ uFramebufferSize * 2.0 - 1.0; - - - + vec2 globalPosition = (((tileOrigin + position) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); gl_Position = vec4(globalPosition, 0.0, 1.0); } diff --git a/resources/shaders/gl3/reproject.fs.glsl b/resources/shaders/gl3/reproject.fs.glsl index a2fe1643d..5803ed2bc 100644 --- a/resources/shaders/gl3/reproject.fs.glsl +++ b/resources/shaders/gl3/reproject.fs.glsl @@ -2,32 +2,16 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uOldTransform; -uniform sampler2D uTexture; +uniform vec4 uOldTransform[4]; +uniform sampler2D SPIRV_Cross_CombineduTextureuSampler; in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; -out vec4 oFragColor; - -void main(){ - vec4 normTexCoord = uOldTransform * vec4(vTexCoord, 0.0, 1.0); - vec2 texCoord =((normTexCoord . xy / normTexCoord . w)+ 1.0)* 0.5; - oFragColor = texture(uTexture, texCoord); +void main() +{ + vec4 normTexCoord = mat4(uOldTransform[0], uOldTransform[1], uOldTransform[2], uOldTransform[3]) * vec4(vTexCoord, 0.0, 1.0); + vec2 texCoord = ((normTexCoord.xy / vec2(normTexCoord.w)) + vec2(1.0)) * 0.5; + oFragColor = texture(SPIRV_Cross_CombineduTextureuSampler, texCoord); } diff --git a/resources/shaders/gl3/reproject.vs.glsl b/resources/shaders/gl3/reproject.vs.glsl index 539e30e15..8cb538d47 100644 --- a/resources/shaders/gl3/reproject.vs.glsl +++ b/resources/shaders/gl3/reproject.vs.glsl @@ -2,36 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uNewTransform; - -in ivec2 aPosition; - +uniform vec4 uNewTransform[4]; +layout(location = 0) in ivec2 aPosition; out vec2 vTexCoord; -void main(){ +void main() +{ vec2 position = vec2(aPosition); vTexCoord = position; - - - - - - gl_Position = uNewTransform * vec4(position, 0.0, 1.0); + gl_Position = mat4(uNewTransform[0], uNewTransform[1], uNewTransform[2], uNewTransform[3]) * vec4(position, 0.0, 1.0); } diff --git a/resources/shaders/gl3/stencil.fs.glsl b/resources/shaders/gl3/stencil.fs.glsl index 2174f77ac..c9a19890d 100644 --- a/resources/shaders/gl3/stencil.fs.glsl +++ b/resources/shaders/gl3/stencil.fs.glsl @@ -2,26 +2,10 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(location = 0) out vec4 oFragColor; - - - - - - - - - -precision highp float; - - - - - -out vec4 oFragColor; - -void main(){ - +void main() +{ oFragColor = vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/resources/shaders/gl3/stencil.vs.glsl b/resources/shaders/gl3/stencil.vs.glsl index e42111876..f56fba14e 100644 --- a/resources/shaders/gl3/stencil.vs.glsl +++ b/resources/shaders/gl3/stencil.vs.glsl @@ -2,25 +2,10 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(location = 0) in vec3 aPosition; - - - - - - - - - -precision highp float; - - - - - -in vec3 aPosition; - -void main(){ +void main() +{ gl_Position = vec4(aPosition, 1.0); } diff --git a/resources/shaders/gl3/tile.fs.glsl b/resources/shaders/gl3/tile.fs.glsl index 33815bd91..ad5011885 100644 --- a/resources/shaders/gl3/tile.fs.glsl +++ b/resources/shaders/gl3/tile.fs.glsl @@ -2,613 +2,570 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#extension GL_GOOGLE_include_directive : enable - -precision highp float; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uniform sampler2D uColorTexture0; -uniform sampler2D uMaskTexture0; -uniform sampler2D uDestTexture; -uniform sampler2D uGammaLUT; -uniform vec2 uColorTextureSize0; -uniform vec2 uMaskTextureSize0; -uniform vec4 uFilterParams0; -uniform vec4 uFilterParams1; -uniform vec4 uFilterParams2; -uniform vec2 uFramebufferSize; -uniform int uCtrl; +uniform vec4 uMaskTextureSize0[1]; +uniform vec4 uColorTextureSize0[1]; +uniform vec4 uFramebufferSize[1]; +uniform vec4 uFilterParams0[1]; +uniform vec4 uFilterParams1[1]; +uniform vec4 uFilterParams2[1]; +uniform ivec4 uCtrl[1]; +uniform sampler2D SPIRV_Cross_CombineduMaskTexture0uSampler; +uniform sampler2D SPIRV_Cross_CombineduColorTexture0uSampler; +uniform sampler2D SPIRV_Cross_CombineduGammaLUTuSampler; +uniform sampler2D SPIRV_Cross_CombineduDestTextureuSampler; in vec3 vMaskTexCoord0; -in vec2 vColorTexCoord0; in vec4 vBaseColor; +in vec2 vColorTexCoord0; +layout(location = 0) out vec4 oFragColor; in float vTileCtrl; -out vec4 oFragColor; - - - -vec4 sampleColor(sampler2D colorTexture, vec2 colorTexCoord){ - return texture(colorTexture, colorTexCoord); +float sampleMask(float maskAlpha, vec2 maskTextureSize, vec3 maskTexCoord, int maskCtrl, sampler2D SPIRV_Cross_CombinedmaskTextureuSampler) +{ + if (maskCtrl == 0) + { + return maskAlpha; + } + ivec2 maskTexCoordI = ivec2(floor(maskTexCoord.xy)); + vec4 texel = texture(SPIRV_Cross_CombinedmaskTextureuSampler, (vec2(maskTexCoordI / ivec2(1, 4)) + vec2(0.5)) / maskTextureSize); + float coverage = texel[maskTexCoordI.y % 4] + maskTexCoord.z; + if ((maskCtrl & 1) != 0) + { + coverage = abs(coverage); + } + else + { + coverage = 1.0 - abs(1.0 - mod(coverage, 2.0)); + } + return min(maskAlpha, coverage); } - - -vec4 combineColor0(vec4 destColor, vec4 srcColor, int op){ - switch(op){ - case 0x1 : - return vec4(srcColor . rgb, srcColor . a * destColor . a); - case 0x2 : - return vec4(destColor . rgb, srcColor . a * destColor . a); +vec4 filterRadialGradient(vec2 colorTexCoord, vec2 colorTextureSize, vec2 fragCoord, vec2 framebufferSize, vec4 filterParams0, vec4 filterParams1, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + vec2 lineFrom = filterParams0.xy; + vec2 lineVector = filterParams0.zw; + vec2 radii = filterParams1.xy; + vec2 uvOrigin = filterParams1.zw; + vec2 dP = colorTexCoord - lineFrom; + vec2 dC = lineVector; + float dR = radii.y - radii.x; + float a = dot(dC, dC) - (dR * dR); + float b = dot(dP, dC) + (radii.x * dR); + float c = dot(dP, dP) - (radii.x * radii.x); + float discrim = (b * b) - (a * c); + vec4 color = vec4(0.0); + if (abs(discrim) >= 9.9999997473787516355514526367188e-06) + { + vec2 ts = vec2((vec2(1.0, -1.0) * sqrt(discrim)) + vec2(b)) / vec2(a); + if (ts.x > ts.y) + { + ts = ts.yx; + } + float _566; + if (ts.x >= 0.0) + { + _566 = ts.x; + } + else + { + _566 = ts.y; + } + float t = _566; + color = texture(SPIRV_Cross_CombinedcolorTextureuSampler, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); } - return destColor; + return color; } - - -float filterTextSample1Tap(float offset, sampler2D colorTexture, vec2 colorTexCoord){ - return texture(colorTexture, colorTexCoord + vec2(offset, 0.0)). r; +vec4 filterBlur(vec2 colorTexCoord, vec2 colorTextureSize, vec4 filterParams0, vec4 filterParams1, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + vec2 srcOffsetScale = filterParams0.xy / colorTextureSize; + int support = int(filterParams0.z); + vec3 gaussCoeff = filterParams1.xyz; + float gaussSum = gaussCoeff.x; + vec4 color = texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord) * gaussCoeff.x; + vec2 _615 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = vec3(_615.x, _615.y, gaussCoeff.z); + for (int i = 1; i <= support; i += 2) + { + float gaussPartialSum = gaussCoeff.x; + vec2 _635 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = vec3(_635.x, _635.y, gaussCoeff.z); + gaussPartialSum += gaussCoeff.x; + vec2 srcOffset = srcOffsetScale * (float(i) + (gaussCoeff.x / gaussPartialSum)); + color += ((texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord - srcOffset) + texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord + srcOffset)) * gaussPartialSum); + gaussSum += (2.0 * gaussPartialSum); + vec2 _679 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = vec3(_679.x, _679.y, gaussCoeff.z); + } + return color / vec4(gaussSum); } - -void filterTextSample9Tap(out vec4 outAlphaLeft, - out float outAlphaCenter, - out vec4 outAlphaRight, - sampler2D colorTexture, - vec2 colorTexCoord, - vec4 kernel, - float onePixel){ - bool wide = kernel . x > 0.0; - outAlphaLeft = - vec4(wide ? filterTextSample1Tap(- 4.0 * onePixel, colorTexture, colorTexCoord): 0.0, - filterTextSample1Tap(- 3.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(- 2.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(- 1.0 * onePixel, colorTexture, colorTexCoord)); - outAlphaCenter = filterTextSample1Tap(0.0, colorTexture, colorTexCoord); - outAlphaRight = - vec4(filterTextSample1Tap(1.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(2.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(3.0 * onePixel, colorTexture, colorTexCoord), - wide ? filterTextSample1Tap(4.0 * onePixel, colorTexture, colorTexCoord): 0.0); +float filterTextSample1Tap(float offset, vec2 colorTexCoord, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + return texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord + vec2(offset, 0.0)).x; } -float filterTextConvolve7Tap(vec4 alpha0, vec3 alpha1, vec4 kernel){ - return dot(alpha0, kernel)+ dot(alpha1, kernel . zyx); +void filterTextSample9Tap(out vec4 outAlphaLeft, out float outAlphaCenter, out vec4 outAlphaRight, vec2 colorTexCoord, vec4 kernel, float onePixel, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + bool wide = kernel.x > 0.0; + float _243; + if (wide) + { + float param = (-4.0) * onePixel; + vec2 param_1 = colorTexCoord; + _243 = filterTextSample1Tap(param, param_1, SPIRV_Cross_CombinedcolorTextureuSampler); + } + else + { + _243 = 0.0; + } + float param_2 = (-3.0) * onePixel; + vec2 param_3 = colorTexCoord; + float param_4 = (-2.0) * onePixel; + vec2 param_5 = colorTexCoord; + float param_6 = (-1.0) * onePixel; + vec2 param_7 = colorTexCoord; + outAlphaLeft = vec4(_243, filterTextSample1Tap(param_2, param_3, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_4, param_5, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_6, param_7, SPIRV_Cross_CombinedcolorTextureuSampler)); + float param_8 = 0.0; + vec2 param_9 = colorTexCoord; + outAlphaCenter = filterTextSample1Tap(param_8, param_9, SPIRV_Cross_CombinedcolorTextureuSampler); + float param_10 = 1.0 * onePixel; + vec2 param_11 = colorTexCoord; + float param_12 = 2.0 * onePixel; + vec2 param_13 = colorTexCoord; + float param_14 = 3.0 * onePixel; + vec2 param_15 = colorTexCoord; + float _303; + if (wide) + { + float param_16 = 4.0 * onePixel; + vec2 param_17 = colorTexCoord; + _303 = filterTextSample1Tap(param_16, param_17, SPIRV_Cross_CombinedcolorTextureuSampler); + } + else + { + _303 = 0.0; + } + outAlphaRight = vec4(filterTextSample1Tap(param_10, param_11, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_12, param_13, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_14, param_15, SPIRV_Cross_CombinedcolorTextureuSampler), _303); } -float filterTextGammaCorrectChannel(float bgColor, float fgColor, sampler2D gammaLUT){ - return texture(gammaLUT, vec2(fgColor, 1.0 - bgColor)). r; +float filterTextConvolve7Tap(vec4 alpha0, vec3 alpha1, vec4 kernel) +{ + return dot(alpha0, kernel) + dot(alpha1, kernel.zyx); } - -vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, sampler2D gammaLUT){ - return vec3(filterTextGammaCorrectChannel(bgColor . r, fgColor . r, gammaLUT), - filterTextGammaCorrectChannel(bgColor . g, fgColor . g, gammaLUT), - filterTextGammaCorrectChannel(bgColor . b, fgColor . b, gammaLUT)); +float filterTextGammaCorrectChannel(float bgColor, float fgColor, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ + return texture(SPIRV_Cross_CombinedgammaLUTuSampler, vec2(fgColor, 1.0 - bgColor)).x; } +vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ + float param = bgColor.x; + float param_1 = fgColor.x; + float param_2 = bgColor.y; + float param_3 = fgColor.y; + float param_4 = bgColor.z; + float param_5 = fgColor.z; + return vec3(filterTextGammaCorrectChannel(param, param_1, SPIRV_Cross_CombinedgammaLUTuSampler), filterTextGammaCorrectChannel(param_2, param_3, SPIRV_Cross_CombinedgammaLUTuSampler), filterTextGammaCorrectChannel(param_4, param_5, SPIRV_Cross_CombinedgammaLUTuSampler)); +} - - - - -vec4 filterText(vec2 colorTexCoord, - sampler2D colorTexture, - sampler2D gammaLUT, - vec2 colorTextureSize, - vec4 filterParams0, - vec4 filterParams1, - vec4 filterParams2){ - +vec4 filterText(vec2 colorTexCoord, vec2 colorTextureSize, vec4 filterParams0, vec4 filterParams1, vec4 filterParams2, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ vec4 kernel = filterParams0; - vec3 bgColor = filterParams1 . rgb; - vec3 fgColor = filterParams2 . rgb; - bool gammaCorrectionEnabled = filterParams2 . a != 0.0; - - + vec3 bgColor = filterParams1.xyz; + vec3 fgColor = filterParams2.xyz; + bool gammaCorrectionEnabled = filterParams2.w != 0.0; vec3 alpha; - if(kernel . w == 0.0){ - alpha = texture(colorTexture, colorTexCoord). rrr; - } else { - vec4 alphaLeft, alphaRight; - float alphaCenter; - filterTextSample9Tap(alphaLeft, - alphaCenter, - alphaRight, - colorTexture, - colorTexCoord, - kernel, - 1.0 / colorTextureSize . x); - - float r = filterTextConvolve7Tap(alphaLeft, vec3(alphaCenter, alphaRight . xy), kernel); - float g = filterTextConvolve7Tap(vec4(alphaLeft . yzw, alphaCenter), alphaRight . xyz, kernel); - float b = filterTextConvolve7Tap(vec4(alphaLeft . zw, alphaCenter, alphaRight . x), - alphaRight . yzw, - kernel); - + if (kernel.w == 0.0) + { + alpha = texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord).xxx; + } + else + { + vec2 param_3 = colorTexCoord; + vec4 param_4 = kernel; + float param_5 = 1.0 / colorTextureSize.x; + vec4 param; + float param_1; + vec4 param_2; + filterTextSample9Tap(param, param_1, param_2, param_3, param_4, param_5, SPIRV_Cross_CombinedcolorTextureuSampler); + vec4 alphaLeft = param; + float alphaCenter = param_1; + vec4 alphaRight = param_2; + vec4 param_6 = alphaLeft; + vec3 param_7 = vec3(alphaCenter, alphaRight.xy); + vec4 param_8 = kernel; + float r = filterTextConvolve7Tap(param_6, param_7, param_8); + vec4 param_9 = vec4(alphaLeft.yzw, alphaCenter); + vec3 param_10 = alphaRight.xyz; + vec4 param_11 = kernel; + float g = filterTextConvolve7Tap(param_9, param_10, param_11); + vec4 param_12 = vec4(alphaLeft.zw, alphaCenter, alphaRight.x); + vec3 param_13 = alphaRight.yzw; + vec4 param_14 = kernel; + float b = filterTextConvolve7Tap(param_12, param_13, param_14); alpha = vec3(r, g, b); } - - - if(gammaCorrectionEnabled) - alpha = filterTextGammaCorrect(bgColor, alpha, gammaLUT); - - + if (gammaCorrectionEnabled) + { + vec3 param_15 = bgColor; + vec3 param_16 = alpha; + alpha = filterTextGammaCorrect(param_15, param_16, SPIRV_Cross_CombinedgammaLUTuSampler); + } return vec4(mix(bgColor, fgColor, alpha), 1.0); } +vec4 sampleColor(vec2 colorTexCoord, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + return texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord); +} +vec4 filterNone(vec2 colorTexCoord, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + vec2 param = colorTexCoord; + return sampleColor(param, SPIRV_Cross_CombinedcolorTextureuSampler); +} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -vec4 filterRadialGradient(vec2 colorTexCoord, - sampler2D colorTexture, - vec2 colorTextureSize, - vec2 fragCoord, - vec2 framebufferSize, - vec4 filterParams0, - vec4 filterParams1){ - vec2 lineFrom = filterParams0 . xy, lineVector = filterParams0 . zw; - vec2 radii = filterParams1 . xy, uvOrigin = filterParams1 . zw; - - vec2 dP = colorTexCoord - lineFrom, dC = lineVector; - float dR = radii . y - radii . x; - - float a = dot(dC, dC)- dR * dR; - float b = dot(dP, dC)+ radii . x * dR; - float c = dot(dP, dP)- radii . x * radii . x; - float discrim = b * b - a * c; - - vec4 color = vec4(0.0); - if(abs(discrim)>= 0.00001){ - vec2 ts = vec2(sqrt(discrim)* vec2(1.0, - 1.0)+ vec2(b))/ vec2(a); - if(ts . x > ts . y) - ts = ts . yx; - float t = ts . x >= 0.0 ? ts . x : ts . y; - color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); +vec4 filterColor(vec2 colorTexCoord, vec2 colorTextureSize, vec2 fragCoord, vec2 framebufferSize, vec4 filterParams0, vec4 filterParams1, vec4 filterParams2, int colorFilter, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ + switch (colorFilter) + { + case 1: + { + vec2 param = colorTexCoord; + vec2 param_1 = colorTextureSize; + vec2 param_2 = fragCoord; + vec2 param_3 = framebufferSize; + vec4 param_4 = filterParams0; + vec4 param_5 = filterParams1; + return filterRadialGradient(param, param_1, param_2, param_3, param_4, param_5, SPIRV_Cross_CombinedcolorTextureuSampler); + } + case 3: + { + vec2 param_6 = colorTexCoord; + vec2 param_7 = colorTextureSize; + vec4 param_8 = filterParams0; + vec4 param_9 = filterParams1; + return filterBlur(param_6, param_7, param_8, param_9, SPIRV_Cross_CombinedcolorTextureuSampler); + } + case 2: + { + vec2 param_10 = colorTexCoord; + vec2 param_11 = colorTextureSize; + vec4 param_12 = filterParams0; + vec4 param_13 = filterParams1; + vec4 param_14 = filterParams2; + return filterText(param_10, param_11, param_12, param_13, param_14, SPIRV_Cross_CombinedcolorTextureuSampler, SPIRV_Cross_CombinedgammaLUTuSampler); + } } - - return color; + vec2 param_15 = colorTexCoord; + return filterNone(param_15, SPIRV_Cross_CombinedcolorTextureuSampler); } - - - - - -vec4 filterBlur(vec2 colorTexCoord, - sampler2D colorTexture, - vec2 colorTextureSize, - vec4 filterParams0, - vec4 filterParams1){ - - vec2 srcOffsetScale = filterParams0 . xy / colorTextureSize; - int support = int(filterParams0 . z); - vec3 gaussCoeff = filterParams1 . xyz; - - - float gaussSum = gaussCoeff . x; - vec4 color = texture(colorTexture, colorTexCoord)* gaussCoeff . x; - gaussCoeff . xy *= gaussCoeff . yz; - - - - - - - - - - for(int i = 1;i <= support;i += 2){ - float gaussPartialSum = gaussCoeff . x; - gaussCoeff . xy *= gaussCoeff . yz; - gaussPartialSum += gaussCoeff . x; - - vec2 srcOffset = srcOffsetScale *(float(i)+ gaussCoeff . x / gaussPartialSum); - color +=(texture(colorTexture, colorTexCoord - srcOffset)+ - texture(colorTexture, colorTexCoord + srcOffset))* gaussPartialSum; - - gaussSum += 2.0 * gaussPartialSum; - gaussCoeff . xy *= gaussCoeff . yz; +vec4 combineColor0(vec4 destColor, vec4 srcColor, int op) +{ + switch (op) + { + case 1: + { + return vec4(srcColor.xyz, srcColor.w * destColor.w); + } + case 2: + { + return vec4(destColor.xyz, srcColor.w * destColor.w); + } } - - - return color / gaussSum; + return destColor; } -vec4 filterNone(vec2 colorTexCoord, sampler2D colorTexture){ - return sampleColor(colorTexture, colorTexCoord); +vec3 compositeScreen(vec3 destColor, vec3 srcColor) +{ + return (destColor + srcColor) - (destColor * srcColor); } -vec4 filterColor(vec2 colorTexCoord, - sampler2D colorTexture, - sampler2D gammaLUT, - vec2 colorTextureSize, - vec2 fragCoord, - vec2 framebufferSize, - vec4 filterParams0, - vec4 filterParams1, - vec4 filterParams2, - int colorFilter){ - switch(colorFilter){ - case 0x1 : - return filterRadialGradient(colorTexCoord, - colorTexture, - colorTextureSize, - fragCoord, - framebufferSize, - filterParams0, - filterParams1); - case 0x3 : - return filterBlur(colorTexCoord, - colorTexture, - colorTextureSize, - filterParams0, - filterParams1); - case 0x2 : - return filterText(colorTexCoord, - colorTexture, - gammaLUT, - colorTextureSize, - filterParams0, - filterParams1, - filterParams2); +vec3 compositeSelect(bvec3 cond, vec3 ifTrue, vec3 ifFalse) +{ + float _745; + if (cond.x) + { + _745 = ifTrue.x; + } + else + { + _745 = ifFalse.x; + } + float _756; + if (cond.y) + { + _756 = ifTrue.y; + } + else + { + _756 = ifFalse.y; + } + float _767; + if (cond.z) + { + _767 = ifTrue.z; + } + else + { + _767 = ifFalse.z; } - return filterNone(colorTexCoord, colorTexture); + return vec3(_745, _756, _767); } - - -vec3 compositeSelect(bvec3 cond, vec3 ifTrue, vec3 ifFalse){ - return vec3(cond . x ? ifTrue . x : ifFalse . x, - cond . y ? ifTrue . y : ifFalse . y, - cond . z ? ifTrue . z : ifFalse . z); +vec3 compositeHardLight(vec3 destColor, vec3 srcColor) +{ + vec3 param = destColor; + vec3 param_1 = (vec3(2.0) * srcColor) - vec3(1.0); + bvec3 param_2 = lessThanEqual(srcColor, vec3(0.5)); + vec3 param_3 = (destColor * vec3(2.0)) * srcColor; + vec3 param_4 = compositeScreen(param, param_1); + return compositeSelect(param_2, param_3, param_4); } -float compositeDivide(float num, float denom){ - return denom != 0.0 ? num / denom : 0.0; +vec3 compositeColorDodge(vec3 destColor, vec3 srcColor) +{ + bvec3 destZero = equal(destColor, vec3(0.0)); + bvec3 srcOne = equal(srcColor, vec3(1.0)); + bvec3 param = srcOne; + vec3 param_1 = vec3(1.0); + vec3 param_2 = destColor / (vec3(1.0) - srcColor); + bvec3 param_3 = destZero; + vec3 param_4 = vec3(0.0); + vec3 param_5 = compositeSelect(param, param_1, param_2); + return compositeSelect(param_3, param_4, param_5); } -vec3 compositeColorDodge(vec3 destColor, vec3 srcColor){ - bvec3 destZero = equal(destColor, vec3(0.0)), srcOne = equal(srcColor, vec3(1.0)); - return compositeSelect(destZero, - vec3(0.0), - compositeSelect(srcOne, vec3(1.0), destColor /(vec3(1.0)- srcColor))); +vec3 compositeSoftLight(vec3 destColor, vec3 srcColor) +{ + bvec3 param = lessThanEqual(destColor, vec3(0.25)); + vec3 param_1 = ((((vec3(16.0) * destColor) - vec3(12.0)) * destColor) + vec3(4.0)) * destColor; + vec3 param_2 = sqrt(destColor); + vec3 darkenedDestColor = compositeSelect(param, param_1, param_2); + bvec3 param_3 = lessThanEqual(srcColor, vec3(0.5)); + vec3 param_4 = destColor * (vec3(1.0) - destColor); + vec3 param_5 = darkenedDestColor - destColor; + vec3 factor = compositeSelect(param_3, param_4, param_5); + return destColor + (((srcColor * 2.0) - vec3(1.0)) * factor); } - -vec3 compositeHSLToRGB(vec3 hsl){ - float a = hsl . y * min(hsl . z, 1.0 - hsl . z); - vec3 ks = mod(vec3(0.0, 8.0, 4.0)+ vec3(hsl . x * 1.9098593171027443), 12.0); - return hsl . zzz - clamp(min(ks - vec3(3.0), vec3(9.0)- ks), - 1.0, 1.0)* a; +float compositeDivide(float num, float denom) +{ + float _781; + if (denom != 0.0) + { + _781 = num / denom; + } + else + { + _781 = 0.0; + } + return _781; } - -vec3 compositeRGBToHSL(vec3 rgb){ - float v = max(max(rgb . r, rgb . g), rgb . b), xMin = min(min(rgb . r, rgb . g), rgb . b); - float c = v - xMin, l = mix(xMin, v, 0.5); - vec3 terms = rgb . r == v ? vec3(0.0, rgb . gb): - rgb . g == v ? vec3(2.0, rgb . br): - vec3(4.0, rgb . rg); - float h = 1.0471975511965976 * compositeDivide(terms . x * c + terms . y - terms . z, c); - float s = compositeDivide(c, v); +vec3 compositeRGBToHSL(vec3 rgb) +{ + float v = max(max(rgb.x, rgb.y), rgb.z); + float xMin = min(min(rgb.x, rgb.y), rgb.z); + float c = v - xMin; + float l = mix(xMin, v, 0.5); + vec3 _887; + if (rgb.x == v) + { + _887 = vec3(0.0, rgb.yz); + } + else + { + vec3 _900; + if (rgb.y == v) + { + _900 = vec3(2.0, rgb.zx); + } + else + { + _900 = vec3(4.0, rgb.xy); + } + _887 = _900; + } + vec3 terms = _887; + float param = ((terms.x * c) + terms.y) - terms.z; + float param_1 = c; + float h = 1.0471975803375244140625 * compositeDivide(param, param_1); + float param_2 = c; + float param_3 = v; + float s = compositeDivide(param_2, param_3); return vec3(h, s, l); } -vec3 compositeScreen(vec3 destColor, vec3 srcColor){ - return destColor + srcColor - destColor * srcColor; -} - -vec3 compositeHardLight(vec3 destColor, vec3 srcColor){ - return compositeSelect(lessThanEqual(srcColor, vec3(0.5)), - destColor * vec3(2.0)* srcColor, - compositeScreen(destColor, vec3(2.0)* srcColor - vec3(1.0))); -} - -vec3 compositeSoftLight(vec3 destColor, vec3 srcColor){ - vec3 darkenedDestColor = - compositeSelect(lessThanEqual(destColor, vec3(0.25)), - ((vec3(16.0)* destColor - 12.0)* destColor + 4.0)* destColor, - sqrt(destColor)); - vec3 factor = compositeSelect(lessThanEqual(srcColor, vec3(0.5)), - destColor *(vec3(1.0)- destColor), - darkenedDestColor - destColor); - return destColor +(srcColor * 2.0 - 1.0)* factor; +vec3 compositeHSL(vec3 destColor, vec3 srcColor, int op) +{ + switch (op) + { + case 12: + { + return vec3(srcColor.x, destColor.y, destColor.z); + } + case 13: + { + return vec3(destColor.x, srcColor.y, destColor.z); + } + case 14: + { + return vec3(srcColor.x, srcColor.y, destColor.z); + } + default: + { + return vec3(destColor.x, destColor.y, srcColor.z); + } + } } -vec3 compositeHSL(vec3 destColor, vec3 srcColor, int op){ - switch(op){ - case 0xc : - return vec3(srcColor . x, destColor . y, destColor . z); - case 0xd : - return vec3(destColor . x, srcColor . y, destColor . z); - case 0xe : - return vec3(srcColor . x, srcColor . y, destColor . z); - default : - return vec3(destColor . x, destColor . y, srcColor . z); - } +vec3 compositeHSLToRGB(vec3 hsl) +{ + float a = hsl.y * min(hsl.z, 1.0 - hsl.z); + vec3 ks = mod(vec3(0.0, 8.0, 4.0) + vec3(hsl.x * 1.90985929965972900390625), vec3(12.0)); + return hsl.zzz - (clamp(min(ks - vec3(3.0), vec3(9.0) - ks), vec3(-1.0), vec3(1.0)) * a); } -vec3 compositeRGB(vec3 destColor, vec3 srcColor, int op){ - switch(op){ - case 0x1 : - return destColor * srcColor; - case 0x2 : - return compositeScreen(destColor, srcColor); - case 0x3 : - return compositeHardLight(srcColor, destColor); - case 0x4 : - return min(destColor, srcColor); - case 0x5 : - return max(destColor, srcColor); - case 0x6 : - return compositeColorDodge(destColor, srcColor); - case 0x7 : - return vec3(1.0)- compositeColorDodge(vec3(1.0)- destColor, vec3(1.0)- srcColor); - case 0x8 : - return compositeHardLight(destColor, srcColor); - case 0x9 : - return compositeSoftLight(destColor, srcColor); - case 0xa : - return abs(destColor - srcColor); - case 0xb : - return destColor + srcColor - vec3(2.0)* destColor * srcColor; - case 0xc : - case 0xd : - case 0xe : - case 0xf : - return compositeHSLToRGB(compositeHSL(compositeRGBToHSL(destColor), - compositeRGBToHSL(srcColor), - op)); +vec3 compositeRGB(vec3 destColor, vec3 srcColor, int op) +{ + switch (op) + { + case 1: + { + return destColor * srcColor; + } + case 2: + { + vec3 param = destColor; + vec3 param_1 = srcColor; + return compositeScreen(param, param_1); + } + case 3: + { + vec3 param_2 = srcColor; + vec3 param_3 = destColor; + return compositeHardLight(param_2, param_3); + } + case 4: + { + return min(destColor, srcColor); + } + case 5: + { + return max(destColor, srcColor); + } + case 6: + { + vec3 param_4 = destColor; + vec3 param_5 = srcColor; + return compositeColorDodge(param_4, param_5); + } + case 7: + { + vec3 param_6 = vec3(1.0) - destColor; + vec3 param_7 = vec3(1.0) - srcColor; + return vec3(1.0) - compositeColorDodge(param_6, param_7); + } + case 8: + { + vec3 param_8 = destColor; + vec3 param_9 = srcColor; + return compositeHardLight(param_8, param_9); + } + case 9: + { + vec3 param_10 = destColor; + vec3 param_11 = srcColor; + return compositeSoftLight(param_10, param_11); + } + case 10: + { + return abs(destColor - srcColor); + } + case 11: + { + return (destColor + srcColor) - ((vec3(2.0) * destColor) * srcColor); + } + case 12: + case 13: + case 14: + case 15: + { + vec3 param_12 = destColor; + vec3 param_13 = srcColor; + vec3 param_14 = compositeRGBToHSL(param_12); + vec3 param_15 = compositeRGBToHSL(param_13); + int param_16 = op; + vec3 param_17 = compositeHSL(param_14, param_15, param_16); + return compositeHSLToRGB(param_17); + } } return srcColor; } -vec4 composite(vec4 srcColor, - sampler2D destTexture, - vec2 destTextureSize, - vec2 fragCoord, - int op){ - if(op == 0x0) +vec4 composite(vec4 srcColor, vec2 destTextureSize, vec2 fragCoord, int op, sampler2D SPIRV_Cross_CombineddestTextureuSampler) +{ + if (op == 0) + { return srcColor; - - + } vec2 destTexCoord = fragCoord / destTextureSize; - vec4 destColor = texture(destTexture, destTexCoord); - vec3 blendedRGB = compositeRGB(destColor . rgb, srcColor . rgb, op); - return vec4(srcColor . a *(1.0 - destColor . a)* srcColor . rgb + - srcColor . a * destColor . a * blendedRGB + - (1.0 - srcColor . a)* destColor . rgb, - 1.0); + vec4 destColor = texture(SPIRV_Cross_CombineddestTextureuSampler, destTexCoord); + vec3 param = destColor.xyz; + vec3 param_1 = srcColor.xyz; + int param_2 = op; + vec3 blendedRGB = compositeRGB(param, param_1, param_2); + return vec4(((srcColor.xyz * (srcColor.w * (1.0 - destColor.w))) + (blendedRGB * (srcColor.w * destColor.w))) + (destColor.xyz * (1.0 - srcColor.w)), 1.0); } - - -float sampleMask(float maskAlpha, - sampler2D maskTexture, - vec2 maskTextureSize, - vec3 maskTexCoord, - int maskCtrl){ - if(maskCtrl == 0) - return maskAlpha; - - ivec2 maskTexCoordI = ivec2(floor(maskTexCoord . xy)); - vec4 texel = texture(maskTexture,(vec2(maskTexCoordI / ivec2(1, 4))+ 0.5)/ maskTextureSize); - float coverage = texel[maskTexCoordI . y % 4]+ maskTexCoord . z; - - if((maskCtrl & 0x1)!= 0) - coverage = abs(coverage); - else - coverage = 1.0 - abs(1.0 - mod(coverage, 2.0)); - return min(maskAlpha, coverage); -} - - - -void calculateColor(int tileCtrl, int ctrl){ - - int maskCtrl0 =(tileCtrl >> 0)& 0x3; +void calculateColor(int tileCtrl, int ctrl) +{ + int maskCtrl0 = (tileCtrl >> 0) & 3; float maskAlpha = 1.0; - maskAlpha = sampleMask(maskAlpha, uMaskTexture0, uMaskTextureSize0, vMaskTexCoord0, maskCtrl0); - - + float param = maskAlpha; + vec2 param_1 = uMaskTextureSize0[0].xy; + vec3 param_2 = vMaskTexCoord0; + int param_3 = maskCtrl0; + maskAlpha = sampleMask(param, param_1, param_2, param_3, SPIRV_Cross_CombineduMaskTexture0uSampler); vec4 color = vBaseColor; - int color0Combine =(ctrl >> 6)& - 0x3; - if(color0Combine != 0){ - int color0Filter =(ctrl >> 4)& 0x3; - vec4 color0 = filterColor(vColorTexCoord0, - uColorTexture0, - uGammaLUT, - uColorTextureSize0, - gl_FragCoord . xy, - uFramebufferSize, - uFilterParams0, - uFilterParams1, - uFilterParams2, - color0Filter); - color = combineColor0(color, color0, color0Combine); + int color0Combine = (ctrl >> 6) & 3; + if (color0Combine != 0) + { + int color0Filter = (ctrl >> 4) & 3; + vec2 param_4 = vColorTexCoord0; + vec2 param_5 = uColorTextureSize0[0].xy; + vec2 param_6 = gl_FragCoord.xy; + vec2 param_7 = uFramebufferSize[0].xy; + vec4 param_8 = uFilterParams0[0]; + vec4 param_9 = uFilterParams1[0]; + vec4 param_10 = uFilterParams2[0]; + int param_11 = color0Filter; + vec4 color0 = filterColor(param_4, param_5, param_6, param_7, param_8, param_9, param_10, param_11, SPIRV_Cross_CombineduColorTexture0uSampler, SPIRV_Cross_CombineduGammaLUTuSampler); + vec4 param_12 = color; + vec4 param_13 = color0; + int param_14 = color0Combine; + color = combineColor0(param_12, param_13, param_14); } - - - color . a *= maskAlpha; - - - int compositeOp =(ctrl >> 8)& 0xf; - color = composite(color, uDestTexture, uFramebufferSize, gl_FragCoord . xy, compositeOp); - - - color . rgb *= color . a; + color.w *= maskAlpha; + int compositeOp = (ctrl >> 8) & 15; + vec4 param_15 = color; + vec2 param_16 = uFramebufferSize[0].xy; + vec2 param_17 = gl_FragCoord.xy; + int param_18 = compositeOp; + color = composite(param_15, param_16, param_17, param_18, SPIRV_Cross_CombineduDestTextureuSampler); + vec3 _1389 = color.xyz * color.w; + color = vec4(_1389.x, _1389.y, _1389.z, color.w); oFragColor = color; } - - - - -void main(){ - calculateColor(int(vTileCtrl), uCtrl); +void main() +{ + int param = int(vTileCtrl); + int param_1 = uCtrl[0].x; + calculateColor(param, param_1); } diff --git a/resources/shaders/gl3/tile.vs.glsl b/resources/shaders/gl3/tile.vs.glsl index 6f3819c00..39df49168 100644 --- a/resources/shaders/gl3/tile.vs.glsl +++ b/resources/shaders/gl3/tile.vs.glsl @@ -2,58 +2,40 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uTransform; -uniform vec2 uTileSize; -uniform sampler2D uTextureMetadata; -uniform ivec2 uTextureMetadataSize; - -in ivec2 aTileOffset; -in ivec2 aTileOrigin; -in uvec2 aMaskTexCoord0; -in ivec2 aMaskBackdrop; -in int aColor; -in int aTileCtrl; - -out vec3 vMaskTexCoord0; +uniform vec4 uTileSize[1]; +uniform ivec4 uTextureMetadataSize[1]; +uniform vec4 uTransform[4]; +uniform sampler2D SPIRV_Cross_CombineduTextureMetadatauSampler; + +layout(location = 1) in ivec2 aTileOrigin; +layout(location = 0) in ivec2 aTileOffset; +layout(location = 2) in uvec2 aMaskTexCoord0; +layout(location = 4) in int aColor; out vec2 vColorTexCoord0; +out vec3 vMaskTexCoord0; +layout(location = 3) in ivec2 aMaskBackdrop; out vec4 vBaseColor; out float vTileCtrl; - -void main(){ - vec2 tileOrigin = vec2(aTileOrigin), tileOffset = vec2(aTileOffset); - vec2 position =(tileOrigin + tileOffset)* uTileSize; - - vec2 maskTexCoord0 =(vec2(aMaskTexCoord0)+ tileOffset)* uTileSize; - - vec2 textureMetadataScale = vec2(1.0)/ vec2(uTextureMetadataSize); - vec2 metadataEntryCoord = vec2(aColor % 128 * 4, aColor / 128); - vec2 colorTexMatrix0Coord =(metadataEntryCoord + vec2(0.5, 0.5))* textureMetadataScale; - vec2 colorTexOffsetsCoord =(metadataEntryCoord + vec2(1.5, 0.5))* textureMetadataScale; - vec2 baseColorCoord =(metadataEntryCoord + vec2(2.5, 0.5))* textureMetadataScale; - vec4 colorTexMatrix0 = texture(uTextureMetadata, colorTexMatrix0Coord); - vec4 colorTexOffsets = texture(uTextureMetadata, colorTexOffsetsCoord); - vec4 baseColor = texture(uTextureMetadata, baseColorCoord); - - vColorTexCoord0 = mat2(colorTexMatrix0)* position + colorTexOffsets . xy; - vMaskTexCoord0 = vec3(maskTexCoord0, float(aMaskBackdrop . x)); +layout(location = 5) in int aTileCtrl; + +void main() +{ + vec2 tileOrigin = vec2(aTileOrigin); + vec2 tileOffset = vec2(aTileOffset); + vec2 position = (tileOrigin + tileOffset) * uTileSize[0].xy; + vec2 maskTexCoord0 = (vec2(aMaskTexCoord0) + tileOffset) * uTileSize[0].xy; + vec2 textureMetadataScale = vec2(1.0) / vec2(uTextureMetadataSize[0].xy); + vec2 metadataEntryCoord = vec2(float((aColor % 128) * 4), float(aColor / 128)); + vec2 colorTexMatrix0Coord = (metadataEntryCoord + vec2(0.5)) * textureMetadataScale; + vec2 colorTexOffsetsCoord = (metadataEntryCoord + vec2(1.5, 0.5)) * textureMetadataScale; + vec2 baseColorCoord = (metadataEntryCoord + vec2(2.5, 0.5)) * textureMetadataScale; + vec4 colorTexMatrix0 = textureLod(SPIRV_Cross_CombineduTextureMetadatauSampler, colorTexMatrix0Coord, 0.0); + vec4 colorTexOffsets = textureLod(SPIRV_Cross_CombineduTextureMetadatauSampler, colorTexOffsetsCoord, 0.0); + vec4 baseColor = textureLod(SPIRV_Cross_CombineduTextureMetadatauSampler, baseColorCoord, 0.0); + vColorTexCoord0 = (mat2(vec2(colorTexMatrix0.xy), vec2(colorTexMatrix0.zw)) * position) + colorTexOffsets.xy; + vMaskTexCoord0 = vec3(maskTexCoord0, float(aMaskBackdrop.x)); vBaseColor = baseColor; vTileCtrl = float(aTileCtrl); - gl_Position = uTransform * vec4(position, 0.0, 1.0); + gl_Position = mat4(uTransform[0], uTransform[1], uTransform[2], uTransform[3]) * vec4(position, 0.0, 1.0); } diff --git a/resources/shaders/gl3/tile_clip.fs.glsl b/resources/shaders/gl3/tile_clip.fs.glsl index 9b8b6cd3f..5bbb7a259 100644 --- a/resources/shaders/gl3/tile_clip.fs.glsl +++ b/resources/shaders/gl3/tile_clip.fs.glsl @@ -2,30 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform sampler2D SPIRV_Cross_CombineduSrcuSampler; - - - - - - - - - -precision highp float; - - - - - -uniform sampler2D uSrc; - +layout(location = 0) out vec4 oFragColor; in vec2 vTexCoord; in float vBackdrop; -out vec4 oFragColor; - -void main(){ - oFragColor = clamp(abs(texture(uSrc, vTexCoord)+ vBackdrop), 0.0, 1.0); +void main() +{ + oFragColor = clamp(abs(texture(SPIRV_Cross_CombineduSrcuSampler, vTexCoord) + vec4(vBackdrop)), vec4(0.0), vec4(1.0)); } diff --git a/resources/shaders/gl3/tile_clip.vs.glsl b/resources/shaders/gl3/tile_clip.vs.glsl index 6693ec921..9cf2b9b01 100644 --- a/resources/shaders/gl3/tile_clip.vs.glsl +++ b/resources/shaders/gl3/tile_clip.vs.glsl @@ -2,35 +2,19 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -in ivec2 aTileOffset; -in ivec2 aDestTileOrigin; -in ivec2 aSrcTileOrigin; -in int aSrcBackdrop; - +layout(location = 1) in ivec2 aDestTileOrigin; +layout(location = 0) in ivec2 aTileOffset; +layout(location = 2) in ivec2 aSrcTileOrigin; out vec2 vTexCoord; out float vBackdrop; +layout(location = 3) in int aSrcBackdrop; -void main(){ - vec2 destPosition = vec2(aDestTileOrigin + aTileOffset)/ vec2(256.0); - vec2 srcPosition = vec2(aSrcTileOrigin + aTileOffset)/ vec2(256.0); +void main() +{ + vec2 destPosition = vec2(aDestTileOrigin + aTileOffset) / vec2(256.0); + vec2 srcPosition = vec2(aSrcTileOrigin + aTileOffset) / vec2(256.0); vTexCoord = srcPosition; vBackdrop = float(aSrcBackdrop); - gl_Position = vec4(mix(vec2(- 1.0), vec2(1.0), destPosition), 0.0, 1.0); + gl_Position = vec4(mix(vec2(-1.0), vec2(1.0), destPosition), 0.0, 1.0); } diff --git a/resources/shaders/gl3/tile_copy.fs.glsl b/resources/shaders/gl3/tile_copy.fs.glsl index af33abfd2..015b6ec45 100644 --- a/resources/shaders/gl3/tile_copy.fs.glsl +++ b/resources/shaders/gl3/tile_copy.fs.glsl @@ -2,29 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uFramebufferSize[1]; +uniform sampler2D SPIRV_Cross_CombineduSrcuSampler; +layout(location = 0) out vec4 oFragColor; - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; -uniform sampler2D uSrc; - -out vec4 oFragColor; - -void main(){ - vec2 texCoord = gl_FragCoord . xy / uFramebufferSize; - oFragColor = texture(uSrc, texCoord); +void main() +{ + vec2 texCoord = gl_FragCoord.xy / uFramebufferSize[0].xy; + oFragColor = texture(SPIRV_Cross_CombineduSrcuSampler, texCoord); } diff --git a/resources/shaders/gl3/tile_copy.vs.glsl b/resources/shaders/gl3/tile_copy.vs.glsl index 87925fda3..d20f31e40 100644 --- a/resources/shaders/gl3/tile_copy.vs.glsl +++ b/resources/shaders/gl3/tile_copy.vs.glsl @@ -2,29 +2,13 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uTransform; -uniform vec2 uTileSize; - -in ivec2 aTilePosition; - -void main(){ - vec2 position = vec2(aTilePosition)* uTileSize; - gl_Position = uTransform * vec4(position, 0.0, 1.0); +uniform vec4 uTileSize[1]; +uniform vec4 uTransform[4]; +layout(location = 0) in ivec2 aTilePosition; + +void main() +{ + vec2 position = vec2(aTilePosition) * uTileSize[0].xy; + gl_Position = mat4(uTransform[0], uTransform[1], uTransform[2], uTransform[3]) * vec4(position, 0.0, 1.0); } diff --git a/resources/shaders/gl4/blit.fs.glsl b/resources/shaders/gl4/blit.fs.glsl index b32fc956f..1a9b2d9f1 100644 --- a/resources/shaders/gl4/blit.fs.glsl +++ b/resources/shaders/gl4/blit.fs.glsl @@ -2,30 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(binding = 0) uniform sampler2D SPIRV_Cross_CombineduSrcuSampler; +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; - - - - - - - - -precision highp float; - - - - - -uniform sampler2D uSrc; - -in vec2 vTexCoord; - -out vec4 oFragColor; - -void main(){ - vec4 color = texture(uSrc, vTexCoord); - oFragColor = vec4(color . rgb * color . a, color . a); +void main() +{ + vec4 color = texture(SPIRV_Cross_CombineduSrcuSampler, vTexCoord); + oFragColor = vec4(color.xyz * color.w, color.w); } diff --git a/resources/shaders/gl4/blit.vs.glsl b/resources/shaders/gl4/blit.vs.glsl index 6c9391d50..0a3bf222e 100644 --- a/resources/shaders/gl4/blit.vs.glsl +++ b/resources/shaders/gl4/blit.vs.glsl @@ -2,32 +2,13 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(location = 0) in ivec2 aPosition; +layout(location = 0) out vec2 vTexCoord; - - - - - - - - - -precision highp float; - - - - - -in ivec2 aPosition; - -out vec2 vTexCoord; - -void main(){ +void main() +{ vec2 texCoord = vec2(aPosition); - - - vTexCoord = texCoord; - gl_Position = vec4(mix(vec2(- 1.0), vec2(1.0), vec2(aPosition)), 0.0, 1.0); + gl_Position = vec4(mix(vec2(-1.0), vec2(1.0), vec2(aPosition)), 0.0, 1.0); } diff --git a/resources/shaders/gl4/clear.fs.glsl b/resources/shaders/gl4/clear.fs.glsl index 447e4d838..bfc45445d 100644 --- a/resources/shaders/gl4/clear.fs.glsl +++ b/resources/shaders/gl4/clear.fs.glsl @@ -2,27 +2,11 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uColor[1]; +layout(location = 0) out vec4 oFragColor; - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uColor; - -out vec4 oFragColor; - -void main(){ - oFragColor = vec4(uColor . rgb, 1.0)* uColor . a; +void main() +{ + oFragColor = vec4(uColor[0].xyz, 1.0) * uColor[0].w; } diff --git a/resources/shaders/gl4/clear.vs.glsl b/resources/shaders/gl4/clear.vs.glsl index 2dd02b1ce..76b85239b 100644 --- a/resources/shaders/gl4/clear.vs.glsl +++ b/resources/shaders/gl4/clear.vs.glsl @@ -2,29 +2,13 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uRect; -uniform vec2 uFramebufferSize; - -in ivec2 aPosition; - -void main(){ - vec2 position = mix(uRect . xy, uRect . zw, vec2(aPosition))/ uFramebufferSize * 2.0 - 1.0; - gl_Position = vec4(position . x, - position . y, 0.0, 1.0); +uniform vec4 uRect[1]; +uniform vec4 uFramebufferSize[1]; +layout(location = 0) in ivec2 aPosition; + +void main() +{ + vec2 position = ((mix(uRect[0].xy, uRect[0].zw, vec2(aPosition)) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); + gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/resources/shaders/gl4/debug_solid.fs.glsl b/resources/shaders/gl4/debug_solid.fs.glsl index 447e4d838..bfc45445d 100644 --- a/resources/shaders/gl4/debug_solid.fs.glsl +++ b/resources/shaders/gl4/debug_solid.fs.glsl @@ -2,27 +2,11 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uColor[1]; +layout(location = 0) out vec4 oFragColor; - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uColor; - -out vec4 oFragColor; - -void main(){ - oFragColor = vec4(uColor . rgb, 1.0)* uColor . a; +void main() +{ + oFragColor = vec4(uColor[0].xyz, 1.0) * uColor[0].w; } diff --git a/resources/shaders/gl4/debug_solid.vs.glsl b/resources/shaders/gl4/debug_solid.vs.glsl index de155484a..705fbc5ef 100644 --- a/resources/shaders/gl4/debug_solid.vs.glsl +++ b/resources/shaders/gl4/debug_solid.vs.glsl @@ -2,28 +2,12 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uFramebufferSize[1]; +layout(location = 0) in ivec2 aPosition; - - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; - -in ivec2 aPosition; - -void main(){ - vec2 position = vec2(aPosition)/ uFramebufferSize * 2.0 - 1.0; - gl_Position = vec4(position . x, - position . y, 0.0, 1.0); +void main() +{ + vec2 position = ((vec2(aPosition) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); + gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/resources/shaders/gl4/debug_texture.fs.glsl b/resources/shaders/gl4/debug_texture.fs.glsl index c786f3520..c35786c4d 100644 --- a/resources/shaders/gl4/debug_texture.fs.glsl +++ b/resources/shaders/gl4/debug_texture.fs.glsl @@ -2,31 +2,15 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uColor[1]; +layout(binding = 2) uniform sampler2D SPIRV_Cross_CombineduTextureuSampler; +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; - - - - - - - - -precision highp float; - - - - - -uniform sampler2D uTexture; -uniform vec4 uColor; - -in vec2 vTexCoord; - -out vec4 oFragColor; - -void main(){ - float alpha = texture(uTexture, vTexCoord). r * uColor . a; - oFragColor = alpha * vec4(uColor . rgb, 1.0); +void main() +{ + float alpha = texture(SPIRV_Cross_CombineduTextureuSampler, vTexCoord).x * uColor[0].w; + oFragColor = vec4(uColor[0].xyz, 1.0) * alpha; } diff --git a/resources/shaders/gl4/debug_texture.vs.glsl b/resources/shaders/gl4/debug_texture.vs.glsl index e073da211..009773372 100644 --- a/resources/shaders/gl4/debug_texture.vs.glsl +++ b/resources/shaders/gl4/debug_texture.vs.glsl @@ -2,33 +2,16 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; -uniform vec2 uTextureSize; - -in ivec2 aPosition; -in ivec2 aTexCoord; - -out vec2 vTexCoord; - -void main(){ - vTexCoord = vec2(aTexCoord)/ uTextureSize; - vec2 position = vec2(aPosition)/ uFramebufferSize * 2.0 - 1.0; - gl_Position = vec4(position . x, - position . y, 0.0, 1.0); +uniform vec4 uTextureSize[1]; +uniform vec4 uFramebufferSize[1]; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) in ivec2 aTexCoord; +layout(location = 0) in ivec2 aPosition; + +void main() +{ + vTexCoord = vec2(aTexCoord) / uTextureSize[0].xy; + vec2 position = ((vec2(aPosition) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); + gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/resources/shaders/gl4/demo_ground.fs.glsl b/resources/shaders/gl4/demo_ground.fs.glsl index 63c0883ea..2c4c3168e 100644 --- a/resources/shaders/gl4/demo_ground.fs.glsl +++ b/resources/shaders/gl4/demo_ground.fs.glsl @@ -2,31 +2,23 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec4 uGroundColor; -uniform vec4 uGridlineColor; - -in vec2 vTexCoord; - -out vec4 oFragColor; - -void main(){ - vec2 texCoordPx = fract(vTexCoord)/ fwidth(vTexCoord); - oFragColor = any(lessThanEqual(texCoordPx, vec2(1.0)))? uGridlineColor : uGroundColor; +uniform vec4 uGridlineColor[1]; +uniform vec4 uGroundColor[1]; +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; + +void main() +{ + vec2 texCoordPx = fract(vTexCoord) / fwidth(vTexCoord); + vec4 _28; + if (any(lessThanEqual(texCoordPx, vec2(1.0)))) + { + _28 = uGridlineColor[0]; + } + else + { + _28 = uGroundColor[0]; + } + oFragColor = _28; } diff --git a/resources/shaders/gl4/demo_ground.vs.glsl b/resources/shaders/gl4/demo_ground.vs.glsl index cb3a47421..ab3fce9c6 100644 --- a/resources/shaders/gl4/demo_ground.vs.glsl +++ b/resources/shaders/gl4/demo_ground.vs.glsl @@ -2,31 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uTransform; -uniform int uGridlineCount; - -in ivec2 aPosition; - -out vec2 vTexCoord; - -void main(){ - vTexCoord = vec2(aPosition * uGridlineCount); - gl_Position = uTransform * vec4(ivec4(aPosition . x, 0, aPosition . y, 1)); +uniform ivec4 uGridlineCount[1]; +uniform vec4 uTransform[4]; +layout(location = 0) out vec2 vTexCoord; +layout(location = 0) in ivec2 aPosition; + +void main() +{ + vTexCoord = vec2(aPosition * ivec2(uGridlineCount[0].x)); + gl_Position = mat4(uTransform[0], uTransform[1], uTransform[2], uTransform[3]) * vec4(ivec4(aPosition.x, 0, aPosition.y, 1)); } diff --git a/resources/shaders/gl4/fill.cs.glsl b/resources/shaders/gl4/fill.cs.glsl index 3a528df59..ebdbcb8cb 100644 --- a/resources/shaders/gl4/fill.cs.glsl +++ b/resources/shaders/gl4/fill.cs.glsl @@ -1,100 +1,65 @@ #version {{version}} // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - - -#extension GL_GOOGLE_include_directive : enable - -precision highp float; - - - - - - - - - - - - - - - - -vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT){ - - vec2 left = from . x < to . x ? from : to, right = from . x < to . x ? to : from; - - - vec2 window = clamp(vec2(from . x, to . x), - 0.5, 0.5); - float offset = mix(window . x, window . y, 0.5)- left . x; - float t = offset /(right . x - left . x); - - - float y = mix(left . y, right . y, t); - float d =(right . y - left . y)/(right . x - left . x); - - - float dX = window . x - window . y; - return texture(areaLUT, vec2(y + 8.0, abs(d * dX))/ 16.0)* dX; +layout(local_size_x = 16, local_size_y = 4, local_size_z = 1) in; + +uniform ivec4 uFirstTileIndex[1]; +layout(binding = 6, std430) restrict readonly buffer bFillTileMap +{ + int iFillTileMap[]; +} _159; + +layout(binding = 4, std430) restrict readonly buffer bFills +{ + uvec2 iFills[]; +} _180; + +layout(binding = 5, std430) restrict readonly buffer bNextFills +{ + int iNextFills[]; +} _264; + +layout(binding = 0) uniform writeonly image2D uDest; +layout(binding = 1) uniform sampler2D SPIRV_Cross_CombineduAreaLUTuSampler; + +vec4 computeCoverage(vec2 from, vec2 to, sampler2D SPIRV_Cross_CombinedareaLUTareaLUTSampler) +{ + bvec2 _34 = bvec2(from.x < to.x); + vec2 left = vec2(_34.x ? from.x : to.x, _34.y ? from.y : to.y); + bvec2 _44 = bvec2(from.x < to.x); + vec2 right = vec2(_44.x ? to.x : from.x, _44.y ? to.y : from.y); + vec2 window = clamp(vec2(from.x, to.x), vec2(-0.5), vec2(0.5)); + float offset = mix(window.x, window.y, 0.5) - left.x; + float t = offset / (right.x - left.x); + float y = mix(left.y, right.y, t); + float d = (right.y - left.y) / (right.x - left.x); + float dX = window.x - window.y; + return textureLod(SPIRV_Cross_CombinedareaLUTareaLUTSampler, vec2(y + 8.0, abs(d * dX)) / vec2(16.0), 0.0) * dX; } - -layout(local_size_x = 16, local_size_y = 4)in; - -uniform writeonly image2D uDest; -uniform sampler2D uAreaLUT; -uniform int uFirstTileIndex; - -layout(std430, binding = 0)buffer bFills { - restrict readonly uvec2 iFills[]; -}; - -layout(std430, binding = 1)buffer bNextFills { - restrict readonly int iNextFills[]; -}; - -layout(std430, binding = 2)buffer bFillTileMap { - restrict readonly int iFillTileMap[]; -}; - -void main(){ - ivec2 tileSubCoord = ivec2(gl_LocalInvocationID . xy)* ivec2(1, 4); - uint tileIndexOffset = gl_WorkGroupID . z; - - uint tileIndex = tileIndexOffset + uint(uFirstTileIndex); - - int fillIndex = iFillTileMap[tileIndex]; - if(fillIndex < 0) +void main() +{ + ivec2 tileSubCoord = ivec2(gl_LocalInvocationID.xy) * ivec2(1, 4); + uint tileIndexOffset = gl_WorkGroupID.z; + uint tileIndex = tileIndexOffset + uint(uFirstTileIndex[0].x); + int fillIndex = _159.iFillTileMap[tileIndex]; + if (fillIndex < 0) + { return; - + } vec4 coverages = vec4(0.0); - do { - uvec2 fill = iFills[fillIndex]; - vec2 from = vec2(fill . y & 0xf,(fill . y >> 4u)& 0xf)+ - vec2(fill . x & 0xff,(fill . x >> 8u)& 0xff)/ 256.0; - vec2 to = vec2((fill . y >> 8u)& 0xf,(fill . y >> 12u)& 0xf)+ - vec2((fill . x >> 16u)& 0xff,(fill . x >> 24u)& 0xff)/ 256.0; - - coverages += computeCoverage(from -(vec2(tileSubCoord)+ vec2(0.5)), - to -(vec2(tileSubCoord)+ vec2(0.5)), - uAreaLUT); - - fillIndex = iNextFills[fillIndex]; - } while(fillIndex >= 0); - - ivec2 tileOrigin = ivec2(tileIndex & 0xff,(tileIndex >> 8u)& 0xff)* ivec2(16, 4); - ivec2 destCoord = tileOrigin + ivec2(gl_LocalInvocationID . xy); + do + { + uvec2 fill = _180.iFills[fillIndex]; + vec2 from = vec2(float(fill.y & 15u), float((fill.y >> 4u) & 15u)) + (vec2(float(fill.x & 255u), float((fill.x >> 8u) & 255u)) / vec2(256.0)); + vec2 to = vec2(float((fill.y >> 8u) & 15u), float((fill.y >> 12u) & 15u)) + (vec2(float((fill.x >> 16u) & 255u), float((fill.x >> 24u) & 255u)) / vec2(256.0)); + vec2 param = from - (vec2(tileSubCoord) + vec2(0.5)); + vec2 param_1 = to - (vec2(tileSubCoord) + vec2(0.5)); + coverages += computeCoverage(param, param_1, SPIRV_Cross_CombineduAreaLUTuSampler); + fillIndex = _264.iNextFills[fillIndex]; + } while (fillIndex >= 0); + ivec2 tileOrigin = ivec2(int(tileIndex & 255u), int((tileIndex >> 8u) & 255u)) * ivec2(16, 4); + ivec2 destCoord = tileOrigin + ivec2(gl_LocalInvocationID.xy); imageStore(uDest, destCoord, coverages); } diff --git a/resources/shaders/gl4/fill.fs.glsl b/resources/shaders/gl4/fill.fs.glsl index e56cbaebb..01c47c165 100644 --- a/resources/shaders/gl4/fill.fs.glsl +++ b/resources/shaders/gl4/fill.fs.glsl @@ -2,62 +2,31 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -#extension GL_GOOGLE_include_directive : enable - -precision highp float; - - - - - - - - - - - - - - - - -vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT){ - - vec2 left = from . x < to . x ? from : to, right = from . x < to . x ? to : from; - - - vec2 window = clamp(vec2(from . x, to . x), - 0.5, 0.5); - float offset = mix(window . x, window . y, 0.5)- left . x; - float t = offset /(right . x - left . x); - - - float y = mix(left . y, right . y, t); - float d =(right . y - left . y)/(right . x - left . x); - - - float dX = window . x - window . y; - return texture(areaLUT, vec2(y + 8.0, abs(d * dX))/ 16.0)* dX; +layout(binding = 2) uniform sampler2D SPIRV_Cross_CombineduAreaLUTuSampler; + +layout(location = 0) out vec4 oFragColor; +layout(location = 0) in vec2 vFrom; +layout(location = 1) in vec2 vTo; + +vec4 computeCoverage(vec2 from, vec2 to, sampler2D SPIRV_Cross_CombinedareaLUTareaLUTSampler) +{ + bvec2 _34 = bvec2(from.x < to.x); + vec2 left = vec2(_34.x ? from.x : to.x, _34.y ? from.y : to.y); + bvec2 _44 = bvec2(from.x < to.x); + vec2 right = vec2(_44.x ? to.x : from.x, _44.y ? to.y : from.y); + vec2 window = clamp(vec2(from.x, to.x), vec2(-0.5), vec2(0.5)); + float offset = mix(window.x, window.y, 0.5) - left.x; + float t = offset / (right.x - left.x); + float y = mix(left.y, right.y, t); + float d = (right.y - left.y) / (right.x - left.x); + float dX = window.x - window.y; + return texture(SPIRV_Cross_CombinedareaLUTareaLUTSampler, vec2(y + 8.0, abs(d * dX)) / vec2(16.0)) * dX; } - -uniform sampler2D uAreaLUT; - -in vec2 vFrom; -in vec2 vTo; - -out vec4 oFragColor; - -void main(){ - oFragColor = computeCoverage(vFrom, vTo, uAreaLUT); +void main() +{ + vec2 param = vFrom; + vec2 param_1 = vTo; + oFragColor = computeCoverage(param, param_1, SPIRV_Cross_CombineduAreaLUTuSampler); } diff --git a/resources/shaders/gl4/fill.vs.glsl b/resources/shaders/gl4/fill.vs.glsl index 58b0b7f02..c1acc414c 100644 --- a/resources/shaders/gl4/fill.vs.glsl +++ b/resources/shaders/gl4/fill.vs.glsl @@ -2,70 +2,53 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; -uniform vec2 uTileSize; - -in uvec2 aTessCoord; -in uint aFromPx; -in uint aToPx; -in vec2 aFromSubpx; -in vec2 aToSubpx; -in uint aTileIndex; - -out vec2 vFrom; -out vec2 vTo; - -vec2 computeTileOffset(uint tileIndex, float stencilTextureWidth){ - uint tilesPerRow = uint(stencilTextureWidth / uTileSize . x); +uniform vec4 uTileSize[1]; +uniform vec4 uFramebufferSize[1]; +layout(location = 5) in uint aTileIndex; +layout(location = 1) in uint aFromPx; +layout(location = 3) in vec2 aFromSubpx; +layout(location = 2) in uint aToPx; +layout(location = 4) in vec2 aToSubpx; +layout(location = 0) in uvec2 aTessCoord; +layout(location = 0) out vec2 vFrom; +layout(location = 1) out vec2 vTo; + +vec2 computeTileOffset(uint tileIndex, float stencilTextureWidth) +{ + uint tilesPerRow = uint(stencilTextureWidth / uTileSize[0].x); uvec2 tileOffset = uvec2(tileIndex % tilesPerRow, tileIndex / tilesPerRow); - return vec2(tileOffset)* uTileSize * vec2(1.0, 0.25); + return (vec2(tileOffset) * uTileSize[0].xy) * vec2(1.0, 0.25); } -void main(){ - vec2 tileOrigin = computeTileOffset(aTileIndex, uFramebufferSize . x); - - vec2 from = vec2(aFromPx & 15u, aFromPx >> 4u)+ aFromSubpx; - vec2 to = vec2(aToPx & 15u, aToPx >> 4u)+ aToSubpx; - +void main() +{ + uint param = aTileIndex; + float param_1 = uFramebufferSize[0].x; + vec2 tileOrigin = computeTileOffset(param, param_1); + vec2 from = vec2(float(aFromPx & 15u), float(aFromPx >> 4u)) + aFromSubpx; + vec2 to = vec2(float(aToPx & 15u), float(aToPx >> 4u)) + aToSubpx; vec2 position; - if(aTessCoord . x == 0u) - position . x = floor(min(from . x, to . x)); + if (aTessCoord.x == 0u) + { + position.x = floor(min(from.x, to.x)); + } else - position . x = ceil(max(from . x, to . x)); - if(aTessCoord . y == 0u) - position . y = floor(min(from . y, to . y)); + { + position.x = ceil(max(from.x, to.x)); + } + if (aTessCoord.y == 0u) + { + position.y = floor(min(from.y, to.y)); + } else - position . y = uTileSize . y; - position . y = floor(position . y * 0.25); - - - - - - vec2 offset = vec2(0.0, 1.5)- position * vec2(1.0, 4.0); + { + position.y = uTileSize[0].y; + } + position.y = floor(position.y * 0.25); + vec2 offset = vec2(0.0, 1.5) - (position * vec2(1.0, 4.0)); vFrom = from + offset; vTo = to + offset; - - vec2 globalPosition =(tileOrigin + position)/ uFramebufferSize * 2.0 - 1.0; - - - + vec2 globalPosition = (((tileOrigin + position) / uFramebufferSize[0].xy) * 2.0) - vec2(1.0); gl_Position = vec4(globalPosition, 0.0, 1.0); } diff --git a/resources/shaders/gl4/reproject.fs.glsl b/resources/shaders/gl4/reproject.fs.glsl index a2fe1643d..efcd61273 100644 --- a/resources/shaders/gl4/reproject.fs.glsl +++ b/resources/shaders/gl4/reproject.fs.glsl @@ -2,32 +2,16 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uOldTransform[4]; +layout(binding = 2) uniform sampler2D SPIRV_Cross_CombineduTextureuSampler; +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 oFragColor; - - - - - - - - -precision highp float; - - - - - -uniform mat4 uOldTransform; -uniform sampler2D uTexture; - -in vec2 vTexCoord; - -out vec4 oFragColor; - -void main(){ - vec4 normTexCoord = uOldTransform * vec4(vTexCoord, 0.0, 1.0); - vec2 texCoord =((normTexCoord . xy / normTexCoord . w)+ 1.0)* 0.5; - oFragColor = texture(uTexture, texCoord); +void main() +{ + vec4 normTexCoord = mat4(uOldTransform[0], uOldTransform[1], uOldTransform[2], uOldTransform[3]) * vec4(vTexCoord, 0.0, 1.0); + vec2 texCoord = ((normTexCoord.xy / vec2(normTexCoord.w)) + vec2(1.0)) * 0.5; + oFragColor = texture(SPIRV_Cross_CombineduTextureuSampler, texCoord); } diff --git a/resources/shaders/gl4/reproject.vs.glsl b/resources/shaders/gl4/reproject.vs.glsl index 539e30e15..d4d7378a8 100644 --- a/resources/shaders/gl4/reproject.vs.glsl +++ b/resources/shaders/gl4/reproject.vs.glsl @@ -2,36 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uNewTransform[4]; +layout(location = 0) in ivec2 aPosition; +layout(location = 0) out vec2 vTexCoord; - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uNewTransform; - -in ivec2 aPosition; - -out vec2 vTexCoord; - -void main(){ +void main() +{ vec2 position = vec2(aPosition); vTexCoord = position; - - - - - - gl_Position = uNewTransform * vec4(position, 0.0, 1.0); + gl_Position = mat4(uNewTransform[0], uNewTransform[1], uNewTransform[2], uNewTransform[3]) * vec4(position, 0.0, 1.0); } diff --git a/resources/shaders/gl4/stencil.fs.glsl b/resources/shaders/gl4/stencil.fs.glsl index 2174f77ac..c9a19890d 100644 --- a/resources/shaders/gl4/stencil.fs.glsl +++ b/resources/shaders/gl4/stencil.fs.glsl @@ -2,26 +2,10 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(location = 0) out vec4 oFragColor; - - - - - - - - - -precision highp float; - - - - - -out vec4 oFragColor; - -void main(){ - +void main() +{ oFragColor = vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/resources/shaders/gl4/stencil.vs.glsl b/resources/shaders/gl4/stencil.vs.glsl index e42111876..f56fba14e 100644 --- a/resources/shaders/gl4/stencil.vs.glsl +++ b/resources/shaders/gl4/stencil.vs.glsl @@ -2,25 +2,10 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(location = 0) in vec3 aPosition; - - - - - - - - - -precision highp float; - - - - - -in vec3 aPosition; - -void main(){ +void main() +{ gl_Position = vec4(aPosition, 1.0); } diff --git a/resources/shaders/gl4/tile.fs.glsl b/resources/shaders/gl4/tile.fs.glsl index 33815bd91..293cb6da1 100644 --- a/resources/shaders/gl4/tile.fs.glsl +++ b/resources/shaders/gl4/tile.fs.glsl @@ -2,613 +2,570 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#extension GL_GOOGLE_include_directive : enable - -precision highp float; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uniform sampler2D uColorTexture0; -uniform sampler2D uMaskTexture0; -uniform sampler2D uDestTexture; -uniform sampler2D uGammaLUT; -uniform vec2 uColorTextureSize0; -uniform vec2 uMaskTextureSize0; -uniform vec4 uFilterParams0; -uniform vec4 uFilterParams1; -uniform vec4 uFilterParams2; -uniform vec2 uFramebufferSize; -uniform int uCtrl; - -in vec3 vMaskTexCoord0; -in vec2 vColorTexCoord0; -in vec4 vBaseColor; -in float vTileCtrl; - -out vec4 oFragColor; - - - -vec4 sampleColor(sampler2D colorTexture, vec2 colorTexCoord){ - return texture(colorTexture, colorTexCoord); +uniform vec4 uMaskTextureSize0[1]; +uniform vec4 uColorTextureSize0[1]; +uniform vec4 uFramebufferSize[1]; +uniform vec4 uFilterParams0[1]; +uniform vec4 uFilterParams1[1]; +uniform vec4 uFilterParams2[1]; +uniform ivec4 uCtrl[1]; +layout(binding = 2) uniform sampler2D SPIRV_Cross_CombineduMaskTexture0uSampler; +layout(binding = 1) uniform sampler2D SPIRV_Cross_CombineduColorTexture0uSampler; +layout(binding = 4) uniform sampler2D SPIRV_Cross_CombineduGammaLUTuSampler; +layout(binding = 3) uniform sampler2D SPIRV_Cross_CombineduDestTextureuSampler; + +layout(location = 0) in vec3 vMaskTexCoord0; +layout(location = 2) in vec4 vBaseColor; +layout(location = 1) in vec2 vColorTexCoord0; +layout(location = 0) out vec4 oFragColor; +layout(location = 3) in float vTileCtrl; + +float sampleMask(float maskAlpha, vec2 maskTextureSize, vec3 maskTexCoord, int maskCtrl, sampler2D SPIRV_Cross_CombinedmaskTextureuSampler) +{ + if (maskCtrl == 0) + { + return maskAlpha; + } + ivec2 maskTexCoordI = ivec2(floor(maskTexCoord.xy)); + vec4 texel = texture(SPIRV_Cross_CombinedmaskTextureuSampler, (vec2(maskTexCoordI / ivec2(1, 4)) + vec2(0.5)) / maskTextureSize); + float coverage = texel[maskTexCoordI.y % 4] + maskTexCoord.z; + if ((maskCtrl & 1) != 0) + { + coverage = abs(coverage); + } + else + { + coverage = 1.0 - abs(1.0 - mod(coverage, 2.0)); + } + return min(maskAlpha, coverage); } - - -vec4 combineColor0(vec4 destColor, vec4 srcColor, int op){ - switch(op){ - case 0x1 : - return vec4(srcColor . rgb, srcColor . a * destColor . a); - case 0x2 : - return vec4(destColor . rgb, srcColor . a * destColor . a); +vec4 filterRadialGradient(vec2 colorTexCoord, vec2 colorTextureSize, vec2 fragCoord, vec2 framebufferSize, vec4 filterParams0, vec4 filterParams1, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + vec2 lineFrom = filterParams0.xy; + vec2 lineVector = filterParams0.zw; + vec2 radii = filterParams1.xy; + vec2 uvOrigin = filterParams1.zw; + vec2 dP = colorTexCoord - lineFrom; + vec2 dC = lineVector; + float dR = radii.y - radii.x; + float a = dot(dC, dC) - (dR * dR); + float b = dot(dP, dC) + (radii.x * dR); + float c = dot(dP, dP) - (radii.x * radii.x); + float discrim = (b * b) - (a * c); + vec4 color = vec4(0.0); + if (abs(discrim) >= 9.9999997473787516355514526367188e-06) + { + vec2 ts = vec2((vec2(1.0, -1.0) * sqrt(discrim)) + vec2(b)) / vec2(a); + if (ts.x > ts.y) + { + ts = ts.yx; + } + float _566; + if (ts.x >= 0.0) + { + _566 = ts.x; + } + else + { + _566 = ts.y; + } + float t = _566; + color = texture(SPIRV_Cross_CombinedcolorTextureuSampler, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); } - return destColor; + return color; } - - -float filterTextSample1Tap(float offset, sampler2D colorTexture, vec2 colorTexCoord){ - return texture(colorTexture, colorTexCoord + vec2(offset, 0.0)). r; +vec4 filterBlur(vec2 colorTexCoord, vec2 colorTextureSize, vec4 filterParams0, vec4 filterParams1, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + vec2 srcOffsetScale = filterParams0.xy / colorTextureSize; + int support = int(filterParams0.z); + vec3 gaussCoeff = filterParams1.xyz; + float gaussSum = gaussCoeff.x; + vec4 color = texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord) * gaussCoeff.x; + vec2 _615 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = vec3(_615.x, _615.y, gaussCoeff.z); + for (int i = 1; i <= support; i += 2) + { + float gaussPartialSum = gaussCoeff.x; + vec2 _635 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = vec3(_635.x, _635.y, gaussCoeff.z); + gaussPartialSum += gaussCoeff.x; + vec2 srcOffset = srcOffsetScale * (float(i) + (gaussCoeff.x / gaussPartialSum)); + color += ((texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord - srcOffset) + texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord + srcOffset)) * gaussPartialSum); + gaussSum += (2.0 * gaussPartialSum); + vec2 _679 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = vec3(_679.x, _679.y, gaussCoeff.z); + } + return color / vec4(gaussSum); } - -void filterTextSample9Tap(out vec4 outAlphaLeft, - out float outAlphaCenter, - out vec4 outAlphaRight, - sampler2D colorTexture, - vec2 colorTexCoord, - vec4 kernel, - float onePixel){ - bool wide = kernel . x > 0.0; - outAlphaLeft = - vec4(wide ? filterTextSample1Tap(- 4.0 * onePixel, colorTexture, colorTexCoord): 0.0, - filterTextSample1Tap(- 3.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(- 2.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(- 1.0 * onePixel, colorTexture, colorTexCoord)); - outAlphaCenter = filterTextSample1Tap(0.0, colorTexture, colorTexCoord); - outAlphaRight = - vec4(filterTextSample1Tap(1.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(2.0 * onePixel, colorTexture, colorTexCoord), - filterTextSample1Tap(3.0 * onePixel, colorTexture, colorTexCoord), - wide ? filterTextSample1Tap(4.0 * onePixel, colorTexture, colorTexCoord): 0.0); +float filterTextSample1Tap(float offset, vec2 colorTexCoord, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + return texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord + vec2(offset, 0.0)).x; } -float filterTextConvolve7Tap(vec4 alpha0, vec3 alpha1, vec4 kernel){ - return dot(alpha0, kernel)+ dot(alpha1, kernel . zyx); +void filterTextSample9Tap(out vec4 outAlphaLeft, out float outAlphaCenter, out vec4 outAlphaRight, vec2 colorTexCoord, vec4 kernel, float onePixel, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + bool wide = kernel.x > 0.0; + float _243; + if (wide) + { + float param = (-4.0) * onePixel; + vec2 param_1 = colorTexCoord; + _243 = filterTextSample1Tap(param, param_1, SPIRV_Cross_CombinedcolorTextureuSampler); + } + else + { + _243 = 0.0; + } + float param_2 = (-3.0) * onePixel; + vec2 param_3 = colorTexCoord; + float param_4 = (-2.0) * onePixel; + vec2 param_5 = colorTexCoord; + float param_6 = (-1.0) * onePixel; + vec2 param_7 = colorTexCoord; + outAlphaLeft = vec4(_243, filterTextSample1Tap(param_2, param_3, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_4, param_5, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_6, param_7, SPIRV_Cross_CombinedcolorTextureuSampler)); + float param_8 = 0.0; + vec2 param_9 = colorTexCoord; + outAlphaCenter = filterTextSample1Tap(param_8, param_9, SPIRV_Cross_CombinedcolorTextureuSampler); + float param_10 = 1.0 * onePixel; + vec2 param_11 = colorTexCoord; + float param_12 = 2.0 * onePixel; + vec2 param_13 = colorTexCoord; + float param_14 = 3.0 * onePixel; + vec2 param_15 = colorTexCoord; + float _303; + if (wide) + { + float param_16 = 4.0 * onePixel; + vec2 param_17 = colorTexCoord; + _303 = filterTextSample1Tap(param_16, param_17, SPIRV_Cross_CombinedcolorTextureuSampler); + } + else + { + _303 = 0.0; + } + outAlphaRight = vec4(filterTextSample1Tap(param_10, param_11, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_12, param_13, SPIRV_Cross_CombinedcolorTextureuSampler), filterTextSample1Tap(param_14, param_15, SPIRV_Cross_CombinedcolorTextureuSampler), _303); } -float filterTextGammaCorrectChannel(float bgColor, float fgColor, sampler2D gammaLUT){ - return texture(gammaLUT, vec2(fgColor, 1.0 - bgColor)). r; +float filterTextConvolve7Tap(vec4 alpha0, vec3 alpha1, vec4 kernel) +{ + return dot(alpha0, kernel) + dot(alpha1, kernel.zyx); } - -vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, sampler2D gammaLUT){ - return vec3(filterTextGammaCorrectChannel(bgColor . r, fgColor . r, gammaLUT), - filterTextGammaCorrectChannel(bgColor . g, fgColor . g, gammaLUT), - filterTextGammaCorrectChannel(bgColor . b, fgColor . b, gammaLUT)); +float filterTextGammaCorrectChannel(float bgColor, float fgColor, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ + return texture(SPIRV_Cross_CombinedgammaLUTuSampler, vec2(fgColor, 1.0 - bgColor)).x; } +vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ + float param = bgColor.x; + float param_1 = fgColor.x; + float param_2 = bgColor.y; + float param_3 = fgColor.y; + float param_4 = bgColor.z; + float param_5 = fgColor.z; + return vec3(filterTextGammaCorrectChannel(param, param_1, SPIRV_Cross_CombinedgammaLUTuSampler), filterTextGammaCorrectChannel(param_2, param_3, SPIRV_Cross_CombinedgammaLUTuSampler), filterTextGammaCorrectChannel(param_4, param_5, SPIRV_Cross_CombinedgammaLUTuSampler)); +} - - - - -vec4 filterText(vec2 colorTexCoord, - sampler2D colorTexture, - sampler2D gammaLUT, - vec2 colorTextureSize, - vec4 filterParams0, - vec4 filterParams1, - vec4 filterParams2){ - +vec4 filterText(vec2 colorTexCoord, vec2 colorTextureSize, vec4 filterParams0, vec4 filterParams1, vec4 filterParams2, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ vec4 kernel = filterParams0; - vec3 bgColor = filterParams1 . rgb; - vec3 fgColor = filterParams2 . rgb; - bool gammaCorrectionEnabled = filterParams2 . a != 0.0; - - + vec3 bgColor = filterParams1.xyz; + vec3 fgColor = filterParams2.xyz; + bool gammaCorrectionEnabled = filterParams2.w != 0.0; vec3 alpha; - if(kernel . w == 0.0){ - alpha = texture(colorTexture, colorTexCoord). rrr; - } else { - vec4 alphaLeft, alphaRight; - float alphaCenter; - filterTextSample9Tap(alphaLeft, - alphaCenter, - alphaRight, - colorTexture, - colorTexCoord, - kernel, - 1.0 / colorTextureSize . x); - - float r = filterTextConvolve7Tap(alphaLeft, vec3(alphaCenter, alphaRight . xy), kernel); - float g = filterTextConvolve7Tap(vec4(alphaLeft . yzw, alphaCenter), alphaRight . xyz, kernel); - float b = filterTextConvolve7Tap(vec4(alphaLeft . zw, alphaCenter, alphaRight . x), - alphaRight . yzw, - kernel); - + if (kernel.w == 0.0) + { + alpha = texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord).xxx; + } + else + { + vec2 param_3 = colorTexCoord; + vec4 param_4 = kernel; + float param_5 = 1.0 / colorTextureSize.x; + vec4 param; + float param_1; + vec4 param_2; + filterTextSample9Tap(param, param_1, param_2, param_3, param_4, param_5, SPIRV_Cross_CombinedcolorTextureuSampler); + vec4 alphaLeft = param; + float alphaCenter = param_1; + vec4 alphaRight = param_2; + vec4 param_6 = alphaLeft; + vec3 param_7 = vec3(alphaCenter, alphaRight.xy); + vec4 param_8 = kernel; + float r = filterTextConvolve7Tap(param_6, param_7, param_8); + vec4 param_9 = vec4(alphaLeft.yzw, alphaCenter); + vec3 param_10 = alphaRight.xyz; + vec4 param_11 = kernel; + float g = filterTextConvolve7Tap(param_9, param_10, param_11); + vec4 param_12 = vec4(alphaLeft.zw, alphaCenter, alphaRight.x); + vec3 param_13 = alphaRight.yzw; + vec4 param_14 = kernel; + float b = filterTextConvolve7Tap(param_12, param_13, param_14); alpha = vec3(r, g, b); } - - - if(gammaCorrectionEnabled) - alpha = filterTextGammaCorrect(bgColor, alpha, gammaLUT); - - + if (gammaCorrectionEnabled) + { + vec3 param_15 = bgColor; + vec3 param_16 = alpha; + alpha = filterTextGammaCorrect(param_15, param_16, SPIRV_Cross_CombinedgammaLUTuSampler); + } return vec4(mix(bgColor, fgColor, alpha), 1.0); } +vec4 sampleColor(vec2 colorTexCoord, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + return texture(SPIRV_Cross_CombinedcolorTextureuSampler, colorTexCoord); +} +vec4 filterNone(vec2 colorTexCoord, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler) +{ + vec2 param = colorTexCoord; + return sampleColor(param, SPIRV_Cross_CombinedcolorTextureuSampler); +} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -vec4 filterRadialGradient(vec2 colorTexCoord, - sampler2D colorTexture, - vec2 colorTextureSize, - vec2 fragCoord, - vec2 framebufferSize, - vec4 filterParams0, - vec4 filterParams1){ - vec2 lineFrom = filterParams0 . xy, lineVector = filterParams0 . zw; - vec2 radii = filterParams1 . xy, uvOrigin = filterParams1 . zw; - - vec2 dP = colorTexCoord - lineFrom, dC = lineVector; - float dR = radii . y - radii . x; - - float a = dot(dC, dC)- dR * dR; - float b = dot(dP, dC)+ radii . x * dR; - float c = dot(dP, dP)- radii . x * radii . x; - float discrim = b * b - a * c; - - vec4 color = vec4(0.0); - if(abs(discrim)>= 0.00001){ - vec2 ts = vec2(sqrt(discrim)* vec2(1.0, - 1.0)+ vec2(b))/ vec2(a); - if(ts . x > ts . y) - ts = ts . yx; - float t = ts . x >= 0.0 ? ts . x : ts . y; - color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); +vec4 filterColor(vec2 colorTexCoord, vec2 colorTextureSize, vec2 fragCoord, vec2 framebufferSize, vec4 filterParams0, vec4 filterParams1, vec4 filterParams2, int colorFilter, sampler2D SPIRV_Cross_CombinedcolorTextureuSampler, sampler2D SPIRV_Cross_CombinedgammaLUTuSampler) +{ + switch (colorFilter) + { + case 1: + { + vec2 param = colorTexCoord; + vec2 param_1 = colorTextureSize; + vec2 param_2 = fragCoord; + vec2 param_3 = framebufferSize; + vec4 param_4 = filterParams0; + vec4 param_5 = filterParams1; + return filterRadialGradient(param, param_1, param_2, param_3, param_4, param_5, SPIRV_Cross_CombinedcolorTextureuSampler); + } + case 3: + { + vec2 param_6 = colorTexCoord; + vec2 param_7 = colorTextureSize; + vec4 param_8 = filterParams0; + vec4 param_9 = filterParams1; + return filterBlur(param_6, param_7, param_8, param_9, SPIRV_Cross_CombinedcolorTextureuSampler); + } + case 2: + { + vec2 param_10 = colorTexCoord; + vec2 param_11 = colorTextureSize; + vec4 param_12 = filterParams0; + vec4 param_13 = filterParams1; + vec4 param_14 = filterParams2; + return filterText(param_10, param_11, param_12, param_13, param_14, SPIRV_Cross_CombinedcolorTextureuSampler, SPIRV_Cross_CombinedgammaLUTuSampler); + } } - - return color; + vec2 param_15 = colorTexCoord; + return filterNone(param_15, SPIRV_Cross_CombinedcolorTextureuSampler); } - - - - - -vec4 filterBlur(vec2 colorTexCoord, - sampler2D colorTexture, - vec2 colorTextureSize, - vec4 filterParams0, - vec4 filterParams1){ - - vec2 srcOffsetScale = filterParams0 . xy / colorTextureSize; - int support = int(filterParams0 . z); - vec3 gaussCoeff = filterParams1 . xyz; - - - float gaussSum = gaussCoeff . x; - vec4 color = texture(colorTexture, colorTexCoord)* gaussCoeff . x; - gaussCoeff . xy *= gaussCoeff . yz; - - - - - - - - - - for(int i = 1;i <= support;i += 2){ - float gaussPartialSum = gaussCoeff . x; - gaussCoeff . xy *= gaussCoeff . yz; - gaussPartialSum += gaussCoeff . x; - - vec2 srcOffset = srcOffsetScale *(float(i)+ gaussCoeff . x / gaussPartialSum); - color +=(texture(colorTexture, colorTexCoord - srcOffset)+ - texture(colorTexture, colorTexCoord + srcOffset))* gaussPartialSum; - - gaussSum += 2.0 * gaussPartialSum; - gaussCoeff . xy *= gaussCoeff . yz; +vec4 combineColor0(vec4 destColor, vec4 srcColor, int op) +{ + switch (op) + { + case 1: + { + return vec4(srcColor.xyz, srcColor.w * destColor.w); + } + case 2: + { + return vec4(destColor.xyz, srcColor.w * destColor.w); + } } - - - return color / gaussSum; + return destColor; } -vec4 filterNone(vec2 colorTexCoord, sampler2D colorTexture){ - return sampleColor(colorTexture, colorTexCoord); +vec3 compositeScreen(vec3 destColor, vec3 srcColor) +{ + return (destColor + srcColor) - (destColor * srcColor); } -vec4 filterColor(vec2 colorTexCoord, - sampler2D colorTexture, - sampler2D gammaLUT, - vec2 colorTextureSize, - vec2 fragCoord, - vec2 framebufferSize, - vec4 filterParams0, - vec4 filterParams1, - vec4 filterParams2, - int colorFilter){ - switch(colorFilter){ - case 0x1 : - return filterRadialGradient(colorTexCoord, - colorTexture, - colorTextureSize, - fragCoord, - framebufferSize, - filterParams0, - filterParams1); - case 0x3 : - return filterBlur(colorTexCoord, - colorTexture, - colorTextureSize, - filterParams0, - filterParams1); - case 0x2 : - return filterText(colorTexCoord, - colorTexture, - gammaLUT, - colorTextureSize, - filterParams0, - filterParams1, - filterParams2); +vec3 compositeSelect(bvec3 cond, vec3 ifTrue, vec3 ifFalse) +{ + float _745; + if (cond.x) + { + _745 = ifTrue.x; + } + else + { + _745 = ifFalse.x; + } + float _756; + if (cond.y) + { + _756 = ifTrue.y; + } + else + { + _756 = ifFalse.y; + } + float _767; + if (cond.z) + { + _767 = ifTrue.z; + } + else + { + _767 = ifFalse.z; } - return filterNone(colorTexCoord, colorTexture); + return vec3(_745, _756, _767); } - - -vec3 compositeSelect(bvec3 cond, vec3 ifTrue, vec3 ifFalse){ - return vec3(cond . x ? ifTrue . x : ifFalse . x, - cond . y ? ifTrue . y : ifFalse . y, - cond . z ? ifTrue . z : ifFalse . z); +vec3 compositeHardLight(vec3 destColor, vec3 srcColor) +{ + vec3 param = destColor; + vec3 param_1 = (vec3(2.0) * srcColor) - vec3(1.0); + bvec3 param_2 = lessThanEqual(srcColor, vec3(0.5)); + vec3 param_3 = (destColor * vec3(2.0)) * srcColor; + vec3 param_4 = compositeScreen(param, param_1); + return compositeSelect(param_2, param_3, param_4); } -float compositeDivide(float num, float denom){ - return denom != 0.0 ? num / denom : 0.0; +vec3 compositeColorDodge(vec3 destColor, vec3 srcColor) +{ + bvec3 destZero = equal(destColor, vec3(0.0)); + bvec3 srcOne = equal(srcColor, vec3(1.0)); + bvec3 param = srcOne; + vec3 param_1 = vec3(1.0); + vec3 param_2 = destColor / (vec3(1.0) - srcColor); + bvec3 param_3 = destZero; + vec3 param_4 = vec3(0.0); + vec3 param_5 = compositeSelect(param, param_1, param_2); + return compositeSelect(param_3, param_4, param_5); } -vec3 compositeColorDodge(vec3 destColor, vec3 srcColor){ - bvec3 destZero = equal(destColor, vec3(0.0)), srcOne = equal(srcColor, vec3(1.0)); - return compositeSelect(destZero, - vec3(0.0), - compositeSelect(srcOne, vec3(1.0), destColor /(vec3(1.0)- srcColor))); +vec3 compositeSoftLight(vec3 destColor, vec3 srcColor) +{ + bvec3 param = lessThanEqual(destColor, vec3(0.25)); + vec3 param_1 = ((((vec3(16.0) * destColor) - vec3(12.0)) * destColor) + vec3(4.0)) * destColor; + vec3 param_2 = sqrt(destColor); + vec3 darkenedDestColor = compositeSelect(param, param_1, param_2); + bvec3 param_3 = lessThanEqual(srcColor, vec3(0.5)); + vec3 param_4 = destColor * (vec3(1.0) - destColor); + vec3 param_5 = darkenedDestColor - destColor; + vec3 factor = compositeSelect(param_3, param_4, param_5); + return destColor + (((srcColor * 2.0) - vec3(1.0)) * factor); } - -vec3 compositeHSLToRGB(vec3 hsl){ - float a = hsl . y * min(hsl . z, 1.0 - hsl . z); - vec3 ks = mod(vec3(0.0, 8.0, 4.0)+ vec3(hsl . x * 1.9098593171027443), 12.0); - return hsl . zzz - clamp(min(ks - vec3(3.0), vec3(9.0)- ks), - 1.0, 1.0)* a; +float compositeDivide(float num, float denom) +{ + float _781; + if (denom != 0.0) + { + _781 = num / denom; + } + else + { + _781 = 0.0; + } + return _781; } - -vec3 compositeRGBToHSL(vec3 rgb){ - float v = max(max(rgb . r, rgb . g), rgb . b), xMin = min(min(rgb . r, rgb . g), rgb . b); - float c = v - xMin, l = mix(xMin, v, 0.5); - vec3 terms = rgb . r == v ? vec3(0.0, rgb . gb): - rgb . g == v ? vec3(2.0, rgb . br): - vec3(4.0, rgb . rg); - float h = 1.0471975511965976 * compositeDivide(terms . x * c + terms . y - terms . z, c); - float s = compositeDivide(c, v); +vec3 compositeRGBToHSL(vec3 rgb) +{ + float v = max(max(rgb.x, rgb.y), rgb.z); + float xMin = min(min(rgb.x, rgb.y), rgb.z); + float c = v - xMin; + float l = mix(xMin, v, 0.5); + vec3 _887; + if (rgb.x == v) + { + _887 = vec3(0.0, rgb.yz); + } + else + { + vec3 _900; + if (rgb.y == v) + { + _900 = vec3(2.0, rgb.zx); + } + else + { + _900 = vec3(4.0, rgb.xy); + } + _887 = _900; + } + vec3 terms = _887; + float param = ((terms.x * c) + terms.y) - terms.z; + float param_1 = c; + float h = 1.0471975803375244140625 * compositeDivide(param, param_1); + float param_2 = c; + float param_3 = v; + float s = compositeDivide(param_2, param_3); return vec3(h, s, l); } -vec3 compositeScreen(vec3 destColor, vec3 srcColor){ - return destColor + srcColor - destColor * srcColor; -} - -vec3 compositeHardLight(vec3 destColor, vec3 srcColor){ - return compositeSelect(lessThanEqual(srcColor, vec3(0.5)), - destColor * vec3(2.0)* srcColor, - compositeScreen(destColor, vec3(2.0)* srcColor - vec3(1.0))); -} - -vec3 compositeSoftLight(vec3 destColor, vec3 srcColor){ - vec3 darkenedDestColor = - compositeSelect(lessThanEqual(destColor, vec3(0.25)), - ((vec3(16.0)* destColor - 12.0)* destColor + 4.0)* destColor, - sqrt(destColor)); - vec3 factor = compositeSelect(lessThanEqual(srcColor, vec3(0.5)), - destColor *(vec3(1.0)- destColor), - darkenedDestColor - destColor); - return destColor +(srcColor * 2.0 - 1.0)* factor; +vec3 compositeHSL(vec3 destColor, vec3 srcColor, int op) +{ + switch (op) + { + case 12: + { + return vec3(srcColor.x, destColor.y, destColor.z); + } + case 13: + { + return vec3(destColor.x, srcColor.y, destColor.z); + } + case 14: + { + return vec3(srcColor.x, srcColor.y, destColor.z); + } + default: + { + return vec3(destColor.x, destColor.y, srcColor.z); + } + } } -vec3 compositeHSL(vec3 destColor, vec3 srcColor, int op){ - switch(op){ - case 0xc : - return vec3(srcColor . x, destColor . y, destColor . z); - case 0xd : - return vec3(destColor . x, srcColor . y, destColor . z); - case 0xe : - return vec3(srcColor . x, srcColor . y, destColor . z); - default : - return vec3(destColor . x, destColor . y, srcColor . z); - } +vec3 compositeHSLToRGB(vec3 hsl) +{ + float a = hsl.y * min(hsl.z, 1.0 - hsl.z); + vec3 ks = mod(vec3(0.0, 8.0, 4.0) + vec3(hsl.x * 1.90985929965972900390625), vec3(12.0)); + return hsl.zzz - (clamp(min(ks - vec3(3.0), vec3(9.0) - ks), vec3(-1.0), vec3(1.0)) * a); } -vec3 compositeRGB(vec3 destColor, vec3 srcColor, int op){ - switch(op){ - case 0x1 : - return destColor * srcColor; - case 0x2 : - return compositeScreen(destColor, srcColor); - case 0x3 : - return compositeHardLight(srcColor, destColor); - case 0x4 : - return min(destColor, srcColor); - case 0x5 : - return max(destColor, srcColor); - case 0x6 : - return compositeColorDodge(destColor, srcColor); - case 0x7 : - return vec3(1.0)- compositeColorDodge(vec3(1.0)- destColor, vec3(1.0)- srcColor); - case 0x8 : - return compositeHardLight(destColor, srcColor); - case 0x9 : - return compositeSoftLight(destColor, srcColor); - case 0xa : - return abs(destColor - srcColor); - case 0xb : - return destColor + srcColor - vec3(2.0)* destColor * srcColor; - case 0xc : - case 0xd : - case 0xe : - case 0xf : - return compositeHSLToRGB(compositeHSL(compositeRGBToHSL(destColor), - compositeRGBToHSL(srcColor), - op)); +vec3 compositeRGB(vec3 destColor, vec3 srcColor, int op) +{ + switch (op) + { + case 1: + { + return destColor * srcColor; + } + case 2: + { + vec3 param = destColor; + vec3 param_1 = srcColor; + return compositeScreen(param, param_1); + } + case 3: + { + vec3 param_2 = srcColor; + vec3 param_3 = destColor; + return compositeHardLight(param_2, param_3); + } + case 4: + { + return min(destColor, srcColor); + } + case 5: + { + return max(destColor, srcColor); + } + case 6: + { + vec3 param_4 = destColor; + vec3 param_5 = srcColor; + return compositeColorDodge(param_4, param_5); + } + case 7: + { + vec3 param_6 = vec3(1.0) - destColor; + vec3 param_7 = vec3(1.0) - srcColor; + return vec3(1.0) - compositeColorDodge(param_6, param_7); + } + case 8: + { + vec3 param_8 = destColor; + vec3 param_9 = srcColor; + return compositeHardLight(param_8, param_9); + } + case 9: + { + vec3 param_10 = destColor; + vec3 param_11 = srcColor; + return compositeSoftLight(param_10, param_11); + } + case 10: + { + return abs(destColor - srcColor); + } + case 11: + { + return (destColor + srcColor) - ((vec3(2.0) * destColor) * srcColor); + } + case 12: + case 13: + case 14: + case 15: + { + vec3 param_12 = destColor; + vec3 param_13 = srcColor; + vec3 param_14 = compositeRGBToHSL(param_12); + vec3 param_15 = compositeRGBToHSL(param_13); + int param_16 = op; + vec3 param_17 = compositeHSL(param_14, param_15, param_16); + return compositeHSLToRGB(param_17); + } } return srcColor; } -vec4 composite(vec4 srcColor, - sampler2D destTexture, - vec2 destTextureSize, - vec2 fragCoord, - int op){ - if(op == 0x0) +vec4 composite(vec4 srcColor, vec2 destTextureSize, vec2 fragCoord, int op, sampler2D SPIRV_Cross_CombineddestTextureuSampler) +{ + if (op == 0) + { return srcColor; - - + } vec2 destTexCoord = fragCoord / destTextureSize; - vec4 destColor = texture(destTexture, destTexCoord); - vec3 blendedRGB = compositeRGB(destColor . rgb, srcColor . rgb, op); - return vec4(srcColor . a *(1.0 - destColor . a)* srcColor . rgb + - srcColor . a * destColor . a * blendedRGB + - (1.0 - srcColor . a)* destColor . rgb, - 1.0); + vec4 destColor = texture(SPIRV_Cross_CombineddestTextureuSampler, destTexCoord); + vec3 param = destColor.xyz; + vec3 param_1 = srcColor.xyz; + int param_2 = op; + vec3 blendedRGB = compositeRGB(param, param_1, param_2); + return vec4(((srcColor.xyz * (srcColor.w * (1.0 - destColor.w))) + (blendedRGB * (srcColor.w * destColor.w))) + (destColor.xyz * (1.0 - srcColor.w)), 1.0); } - - -float sampleMask(float maskAlpha, - sampler2D maskTexture, - vec2 maskTextureSize, - vec3 maskTexCoord, - int maskCtrl){ - if(maskCtrl == 0) - return maskAlpha; - - ivec2 maskTexCoordI = ivec2(floor(maskTexCoord . xy)); - vec4 texel = texture(maskTexture,(vec2(maskTexCoordI / ivec2(1, 4))+ 0.5)/ maskTextureSize); - float coverage = texel[maskTexCoordI . y % 4]+ maskTexCoord . z; - - if((maskCtrl & 0x1)!= 0) - coverage = abs(coverage); - else - coverage = 1.0 - abs(1.0 - mod(coverage, 2.0)); - return min(maskAlpha, coverage); -} - - - -void calculateColor(int tileCtrl, int ctrl){ - - int maskCtrl0 =(tileCtrl >> 0)& 0x3; +void calculateColor(int tileCtrl, int ctrl) +{ + int maskCtrl0 = (tileCtrl >> 0) & 3; float maskAlpha = 1.0; - maskAlpha = sampleMask(maskAlpha, uMaskTexture0, uMaskTextureSize0, vMaskTexCoord0, maskCtrl0); - - + float param = maskAlpha; + vec2 param_1 = uMaskTextureSize0[0].xy; + vec3 param_2 = vMaskTexCoord0; + int param_3 = maskCtrl0; + maskAlpha = sampleMask(param, param_1, param_2, param_3, SPIRV_Cross_CombineduMaskTexture0uSampler); vec4 color = vBaseColor; - int color0Combine =(ctrl >> 6)& - 0x3; - if(color0Combine != 0){ - int color0Filter =(ctrl >> 4)& 0x3; - vec4 color0 = filterColor(vColorTexCoord0, - uColorTexture0, - uGammaLUT, - uColorTextureSize0, - gl_FragCoord . xy, - uFramebufferSize, - uFilterParams0, - uFilterParams1, - uFilterParams2, - color0Filter); - color = combineColor0(color, color0, color0Combine); + int color0Combine = (ctrl >> 6) & 3; + if (color0Combine != 0) + { + int color0Filter = (ctrl >> 4) & 3; + vec2 param_4 = vColorTexCoord0; + vec2 param_5 = uColorTextureSize0[0].xy; + vec2 param_6 = gl_FragCoord.xy; + vec2 param_7 = uFramebufferSize[0].xy; + vec4 param_8 = uFilterParams0[0]; + vec4 param_9 = uFilterParams1[0]; + vec4 param_10 = uFilterParams2[0]; + int param_11 = color0Filter; + vec4 color0 = filterColor(param_4, param_5, param_6, param_7, param_8, param_9, param_10, param_11, SPIRV_Cross_CombineduColorTexture0uSampler, SPIRV_Cross_CombineduGammaLUTuSampler); + vec4 param_12 = color; + vec4 param_13 = color0; + int param_14 = color0Combine; + color = combineColor0(param_12, param_13, param_14); } - - - color . a *= maskAlpha; - - - int compositeOp =(ctrl >> 8)& 0xf; - color = composite(color, uDestTexture, uFramebufferSize, gl_FragCoord . xy, compositeOp); - - - color . rgb *= color . a; + color.w *= maskAlpha; + int compositeOp = (ctrl >> 8) & 15; + vec4 param_15 = color; + vec2 param_16 = uFramebufferSize[0].xy; + vec2 param_17 = gl_FragCoord.xy; + int param_18 = compositeOp; + color = composite(param_15, param_16, param_17, param_18, SPIRV_Cross_CombineduDestTextureuSampler); + vec3 _1389 = color.xyz * color.w; + color = vec4(_1389.x, _1389.y, _1389.z, color.w); oFragColor = color; } - - - - -void main(){ - calculateColor(int(vTileCtrl), uCtrl); +void main() +{ + int param = int(vTileCtrl); + int param_1 = uCtrl[0].x; + calculateColor(param, param_1); } diff --git a/resources/shaders/gl4/tile.vs.glsl b/resources/shaders/gl4/tile.vs.glsl index 6f3819c00..443710a2f 100644 --- a/resources/shaders/gl4/tile.vs.glsl +++ b/resources/shaders/gl4/tile.vs.glsl @@ -2,58 +2,40 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uTransform; -uniform vec2 uTileSize; -uniform sampler2D uTextureMetadata; -uniform ivec2 uTextureMetadataSize; - -in ivec2 aTileOffset; -in ivec2 aTileOrigin; -in uvec2 aMaskTexCoord0; -in ivec2 aMaskBackdrop; -in int aColor; -in int aTileCtrl; - -out vec3 vMaskTexCoord0; -out vec2 vColorTexCoord0; -out vec4 vBaseColor; -out float vTileCtrl; - -void main(){ - vec2 tileOrigin = vec2(aTileOrigin), tileOffset = vec2(aTileOffset); - vec2 position =(tileOrigin + tileOffset)* uTileSize; - - vec2 maskTexCoord0 =(vec2(aMaskTexCoord0)+ tileOffset)* uTileSize; - - vec2 textureMetadataScale = vec2(1.0)/ vec2(uTextureMetadataSize); - vec2 metadataEntryCoord = vec2(aColor % 128 * 4, aColor / 128); - vec2 colorTexMatrix0Coord =(metadataEntryCoord + vec2(0.5, 0.5))* textureMetadataScale; - vec2 colorTexOffsetsCoord =(metadataEntryCoord + vec2(1.5, 0.5))* textureMetadataScale; - vec2 baseColorCoord =(metadataEntryCoord + vec2(2.5, 0.5))* textureMetadataScale; - vec4 colorTexMatrix0 = texture(uTextureMetadata, colorTexMatrix0Coord); - vec4 colorTexOffsets = texture(uTextureMetadata, colorTexOffsetsCoord); - vec4 baseColor = texture(uTextureMetadata, baseColorCoord); - - vColorTexCoord0 = mat2(colorTexMatrix0)* position + colorTexOffsets . xy; - vMaskTexCoord0 = vec3(maskTexCoord0, float(aMaskBackdrop . x)); +uniform vec4 uTileSize[1]; +uniform ivec4 uTextureMetadataSize[1]; +uniform vec4 uTransform[4]; +layout(binding = 2) uniform sampler2D SPIRV_Cross_CombineduTextureMetadatauSampler; + +layout(location = 1) in ivec2 aTileOrigin; +layout(location = 0) in ivec2 aTileOffset; +layout(location = 2) in uvec2 aMaskTexCoord0; +layout(location = 4) in int aColor; +layout(location = 1) out vec2 vColorTexCoord0; +layout(location = 0) out vec3 vMaskTexCoord0; +layout(location = 3) in ivec2 aMaskBackdrop; +layout(location = 2) out vec4 vBaseColor; +layout(location = 3) out float vTileCtrl; +layout(location = 5) in int aTileCtrl; + +void main() +{ + vec2 tileOrigin = vec2(aTileOrigin); + vec2 tileOffset = vec2(aTileOffset); + vec2 position = (tileOrigin + tileOffset) * uTileSize[0].xy; + vec2 maskTexCoord0 = (vec2(aMaskTexCoord0) + tileOffset) * uTileSize[0].xy; + vec2 textureMetadataScale = vec2(1.0) / vec2(uTextureMetadataSize[0].xy); + vec2 metadataEntryCoord = vec2(float((aColor % 128) * 4), float(aColor / 128)); + vec2 colorTexMatrix0Coord = (metadataEntryCoord + vec2(0.5)) * textureMetadataScale; + vec2 colorTexOffsetsCoord = (metadataEntryCoord + vec2(1.5, 0.5)) * textureMetadataScale; + vec2 baseColorCoord = (metadataEntryCoord + vec2(2.5, 0.5)) * textureMetadataScale; + vec4 colorTexMatrix0 = textureLod(SPIRV_Cross_CombineduTextureMetadatauSampler, colorTexMatrix0Coord, 0.0); + vec4 colorTexOffsets = textureLod(SPIRV_Cross_CombineduTextureMetadatauSampler, colorTexOffsetsCoord, 0.0); + vec4 baseColor = textureLod(SPIRV_Cross_CombineduTextureMetadatauSampler, baseColorCoord, 0.0); + vColorTexCoord0 = (mat2(vec2(colorTexMatrix0.xy), vec2(colorTexMatrix0.zw)) * position) + colorTexOffsets.xy; + vMaskTexCoord0 = vec3(maskTexCoord0, float(aMaskBackdrop.x)); vBaseColor = baseColor; vTileCtrl = float(aTileCtrl); - gl_Position = uTransform * vec4(position, 0.0, 1.0); + gl_Position = mat4(uTransform[0], uTransform[1], uTransform[2], uTransform[3]) * vec4(position, 0.0, 1.0); } diff --git a/resources/shaders/gl4/tile_clip.fs.glsl b/resources/shaders/gl4/tile_clip.fs.glsl index 9b8b6cd3f..871231fc0 100644 --- a/resources/shaders/gl4/tile_clip.fs.glsl +++ b/resources/shaders/gl4/tile_clip.fs.glsl @@ -2,30 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +layout(binding = 0) uniform sampler2D SPIRV_Cross_CombineduSrcuSampler; +layout(location = 0) out vec4 oFragColor; +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in float vBackdrop; - - - - - - - - -precision highp float; - - - - - -uniform sampler2D uSrc; - -in vec2 vTexCoord; -in float vBackdrop; - -out vec4 oFragColor; - -void main(){ - oFragColor = clamp(abs(texture(uSrc, vTexCoord)+ vBackdrop), 0.0, 1.0); +void main() +{ + oFragColor = clamp(abs(texture(SPIRV_Cross_CombineduSrcuSampler, vTexCoord) + vec4(vBackdrop)), vec4(0.0), vec4(1.0)); } diff --git a/resources/shaders/gl4/tile_clip.vs.glsl b/resources/shaders/gl4/tile_clip.vs.glsl index 6693ec921..bf6c55d9e 100644 --- a/resources/shaders/gl4/tile_clip.vs.glsl +++ b/resources/shaders/gl4/tile_clip.vs.glsl @@ -2,35 +2,19 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -in ivec2 aTileOffset; -in ivec2 aDestTileOrigin; -in ivec2 aSrcTileOrigin; -in int aSrcBackdrop; - -out vec2 vTexCoord; -out float vBackdrop; - -void main(){ - vec2 destPosition = vec2(aDestTileOrigin + aTileOffset)/ vec2(256.0); - vec2 srcPosition = vec2(aSrcTileOrigin + aTileOffset)/ vec2(256.0); +layout(location = 1) in ivec2 aDestTileOrigin; +layout(location = 0) in ivec2 aTileOffset; +layout(location = 2) in ivec2 aSrcTileOrigin; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out float vBackdrop; +layout(location = 3) in int aSrcBackdrop; + +void main() +{ + vec2 destPosition = vec2(aDestTileOrigin + aTileOffset) / vec2(256.0); + vec2 srcPosition = vec2(aSrcTileOrigin + aTileOffset) / vec2(256.0); vTexCoord = srcPosition; vBackdrop = float(aSrcBackdrop); - gl_Position = vec4(mix(vec2(- 1.0), vec2(1.0), destPosition), 0.0, 1.0); + gl_Position = vec4(mix(vec2(-1.0), vec2(1.0), destPosition), 0.0, 1.0); } diff --git a/resources/shaders/gl4/tile_copy.fs.glsl b/resources/shaders/gl4/tile_copy.fs.glsl index af33abfd2..48abe4391 100644 --- a/resources/shaders/gl4/tile_copy.fs.glsl +++ b/resources/shaders/gl4/tile_copy.fs.glsl @@ -2,29 +2,14 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! +uniform vec4 uFramebufferSize[1]; +layout(binding = 3) uniform sampler2D SPIRV_Cross_CombineduSrcuSampler; +layout(location = 0) out vec4 oFragColor; - - - - - - - - -precision highp float; - - - - - -uniform vec2 uFramebufferSize; -uniform sampler2D uSrc; - -out vec4 oFragColor; - -void main(){ - vec2 texCoord = gl_FragCoord . xy / uFramebufferSize; - oFragColor = texture(uSrc, texCoord); +void main() +{ + vec2 texCoord = gl_FragCoord.xy / uFramebufferSize[0].xy; + oFragColor = texture(SPIRV_Cross_CombineduSrcuSampler, texCoord); } diff --git a/resources/shaders/gl4/tile_copy.vs.glsl b/resources/shaders/gl4/tile_copy.vs.glsl index 87925fda3..d20f31e40 100644 --- a/resources/shaders/gl4/tile_copy.vs.glsl +++ b/resources/shaders/gl4/tile_copy.vs.glsl @@ -2,29 +2,13 @@ // Automatically generated from files in pathfinder/shaders/. Do not edit! - - - - - - - - - - -precision highp float; - - - - - -uniform mat4 uTransform; -uniform vec2 uTileSize; - -in ivec2 aTilePosition; - -void main(){ - vec2 position = vec2(aTilePosition)* uTileSize; - gl_Position = uTransform * vec4(position, 0.0, 1.0); +uniform vec4 uTileSize[1]; +uniform vec4 uTransform[4]; +layout(location = 0) in ivec2 aTilePosition; + +void main() +{ + vec2 position = vec2(aTilePosition) * uTileSize[0].xy; + gl_Position = mat4(uTransform[0], uTransform[1], uTransform[2], uTransform[3]) * vec4(position, 0.0, 1.0); } diff --git a/resources/shaders/metal/blit.fs.metal b/resources/shaders/metal/blit.fs.metal index cb0ab32ae..7ccae4524 100644 --- a/resources/shaders/metal/blit.fs.metal +++ b/resources/shaders/metal/blit.fs.metal @@ -14,10 +14,10 @@ struct main0_in float2 vTexCoord [[user(locn0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], texture2d uSrc [[texture(0)]], sampler uSrcSmplr [[sampler(0)]]) +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSrc [[texture(0)]], sampler uSampler [[sampler(0)]]) { main0_out out = {}; - float4 color = uSrc.sample(uSrcSmplr, in.vTexCoord); + float4 color = uSrc.sample(uSampler, in.vTexCoord); out.oFragColor = float4(color.xyz * color.w, color.w); return out; } diff --git a/resources/shaders/metal/clear.fs.metal b/resources/shaders/metal/clear.fs.metal index d8be9fb68..f4d373c28 100644 --- a/resources/shaders/metal/clear.fs.metal +++ b/resources/shaders/metal/clear.fs.metal @@ -4,15 +4,20 @@ using namespace metal; +struct uColor +{ + float4 color; +}; + struct main0_out { float4 oFragColor [[color(0)]]; }; -fragment main0_out main0(constant float4& uColor [[buffer(0)]]) +fragment main0_out main0(constant uColor& _12 [[buffer(0)]]) { main0_out out = {}; - out.oFragColor = float4(uColor.xyz, 1.0) * uColor.w; + out.oFragColor = float4(_12.color.xyz, 1.0) * _12.color.w; return out; } diff --git a/resources/shaders/metal/clear.vs.metal b/resources/shaders/metal/clear.vs.metal index a61648fbd..7f4126fe0 100644 --- a/resources/shaders/metal/clear.vs.metal +++ b/resources/shaders/metal/clear.vs.metal @@ -4,6 +4,16 @@ using namespace metal; +struct uRect +{ + float4 rect; +}; + +struct uFramebufferSize +{ + float2 framebufferSize; +}; + struct main0_out { float4 gl_Position [[position]]; @@ -14,10 +24,10 @@ struct main0_in int2 aPosition [[attribute(0)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant float4& uRect [[buffer(0)]], constant float2& uFramebufferSize [[buffer(1)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uRect& _13 [[buffer(0)]], constant uFramebufferSize& _31 [[buffer(1)]]) { main0_out out = {}; - float2 position = ((mix(uRect.xy, uRect.zw, float2(in.aPosition)) / uFramebufferSize) * 2.0) - float2(1.0); + float2 position = ((mix(_13.rect.xy, _13.rect.zw, float2(in.aPosition)) / _31.framebufferSize) * 2.0) - float2(1.0); out.gl_Position = float4(position.x, -position.y, 0.0, 1.0); return out; } diff --git a/resources/shaders/metal/debug_solid.fs.metal b/resources/shaders/metal/debug_solid.fs.metal index d8be9fb68..f4d373c28 100644 --- a/resources/shaders/metal/debug_solid.fs.metal +++ b/resources/shaders/metal/debug_solid.fs.metal @@ -4,15 +4,20 @@ using namespace metal; +struct uColor +{ + float4 color; +}; + struct main0_out { float4 oFragColor [[color(0)]]; }; -fragment main0_out main0(constant float4& uColor [[buffer(0)]]) +fragment main0_out main0(constant uColor& _12 [[buffer(0)]]) { main0_out out = {}; - out.oFragColor = float4(uColor.xyz, 1.0) * uColor.w; + out.oFragColor = float4(_12.color.xyz, 1.0) * _12.color.w; return out; } diff --git a/resources/shaders/metal/debug_solid.vs.metal b/resources/shaders/metal/debug_solid.vs.metal index 286c43944..7c3d80868 100644 --- a/resources/shaders/metal/debug_solid.vs.metal +++ b/resources/shaders/metal/debug_solid.vs.metal @@ -4,6 +4,11 @@ using namespace metal; +struct uFramebufferSize +{ + float2 framebufferSize; +}; + struct main0_out { float4 gl_Position [[position]]; @@ -14,10 +19,10 @@ struct main0_in int2 aPosition [[attribute(0)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant float2& uFramebufferSize [[buffer(0)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uFramebufferSize& _18 [[buffer(0)]]) { main0_out out = {}; - float2 position = ((float2(in.aPosition) / uFramebufferSize) * 2.0) - float2(1.0); + float2 position = ((float2(in.aPosition) / _18.framebufferSize) * 2.0) - float2(1.0); out.gl_Position = float4(position.x, -position.y, 0.0, 1.0); return out; } diff --git a/resources/shaders/metal/debug_texture.fs.metal b/resources/shaders/metal/debug_texture.fs.metal index 8888110ae..7d3443a2f 100644 --- a/resources/shaders/metal/debug_texture.fs.metal +++ b/resources/shaders/metal/debug_texture.fs.metal @@ -4,6 +4,11 @@ using namespace metal; +struct uColor +{ + float4 color; +}; + struct main0_out { float4 oFragColor [[color(0)]]; @@ -14,11 +19,11 @@ struct main0_in float2 vTexCoord [[user(locn0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], constant float4& uColor [[buffer(0)]], texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +fragment main0_out main0(main0_in in [[stage_in]], constant uColor& _30 [[buffer(0)]], texture2d uTexture [[texture(0)]], sampler uSampler [[sampler(0)]]) { main0_out out = {}; - float alpha = uTexture.sample(uTextureSmplr, in.vTexCoord).x * uColor.w; - out.oFragColor = float4(uColor.xyz, 1.0) * alpha; + float alpha = uTexture.sample(uSampler, in.vTexCoord).x * _30.color.w; + out.oFragColor = float4(_30.color.xyz, 1.0) * alpha; return out; } diff --git a/resources/shaders/metal/debug_texture.vs.metal b/resources/shaders/metal/debug_texture.vs.metal index 1f824608d..85e44c4c5 100644 --- a/resources/shaders/metal/debug_texture.vs.metal +++ b/resources/shaders/metal/debug_texture.vs.metal @@ -4,6 +4,16 @@ using namespace metal; +struct uTextureSize +{ + float2 _textureSize; +}; + +struct uFramebufferSize +{ + float2 framebufferSize; +}; + struct main0_out { float2 vTexCoord [[user(locn0)]]; @@ -16,11 +26,11 @@ struct main0_in int2 aTexCoord [[attribute(1)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant float2& uTextureSize [[buffer(0)]], constant float2& uFramebufferSize [[buffer(1)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uTextureSize& _18 [[buffer(0)]], constant uFramebufferSize& _31 [[buffer(1)]]) { main0_out out = {}; - out.vTexCoord = float2(in.aTexCoord) / uTextureSize; - float2 position = ((float2(in.aPosition) / uFramebufferSize) * 2.0) - float2(1.0); + out.vTexCoord = float2(in.aTexCoord) / _18._textureSize; + float2 position = ((float2(in.aPosition) / _31.framebufferSize) * 2.0) - float2(1.0); out.gl_Position = float4(position.x, -position.y, 0.0, 1.0); return out; } diff --git a/resources/shaders/metal/demo_ground.fs.metal b/resources/shaders/metal/demo_ground.fs.metal index 9b6d05ae0..3cc797044 100644 --- a/resources/shaders/metal/demo_ground.fs.metal +++ b/resources/shaders/metal/demo_ground.fs.metal @@ -4,6 +4,16 @@ using namespace metal; +struct uGridlineColor +{ + float4 gridlineColor; +}; + +struct uGroundColor +{ + float4 groundColor; +}; + struct main0_out { float4 oFragColor [[color(0)]]; @@ -14,11 +24,20 @@ struct main0_in float2 vTexCoord [[user(locn0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], constant float4& uGridlineColor [[buffer(0)]], constant float4& uGroundColor [[buffer(1)]]) +fragment main0_out main0(main0_in in [[stage_in]], constant uGridlineColor& _33 [[buffer(0)]], constant uGroundColor& _42 [[buffer(1)]]) { main0_out out = {}; float2 texCoordPx = fract(in.vTexCoord) / fwidth(in.vTexCoord); - out.oFragColor = select(uGroundColor, uGridlineColor, bool4(any(texCoordPx <= float2(1.0)))); + float4 _28; + if (any(texCoordPx <= float2(1.0))) + { + _28 = _33.gridlineColor; + } + else + { + _28 = _42.groundColor; + } + out.oFragColor = _28; return out; } diff --git a/resources/shaders/metal/demo_ground.vs.metal b/resources/shaders/metal/demo_ground.vs.metal index 2ec42d001..24dc8e6fa 100644 --- a/resources/shaders/metal/demo_ground.vs.metal +++ b/resources/shaders/metal/demo_ground.vs.metal @@ -4,6 +4,16 @@ using namespace metal; +struct uGridlineCount +{ + int gridlineCount; +}; + +struct uTransform +{ + float4x4 transform; +}; + struct main0_out { float2 vTexCoord [[user(locn0)]]; @@ -15,11 +25,11 @@ struct main0_in int2 aPosition [[attribute(0)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant int& uGridlineCount [[buffer(0)]], constant float4x4& uTransform [[buffer(1)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uGridlineCount& _17 [[buffer(0)]], constant uTransform& _35 [[buffer(1)]]) { main0_out out = {}; - out.vTexCoord = float2(in.aPosition * int2(uGridlineCount)); - out.gl_Position = uTransform * float4(int4(in.aPosition.x, 0, in.aPosition.y, 1)); + out.vTexCoord = float2(in.aPosition * int2(_17.gridlineCount)); + out.gl_Position = _35.transform * float4(int4(in.aPosition.x, 0, in.aPosition.y, 1)); return out; } diff --git a/resources/shaders/metal/fill.cs.metal b/resources/shaders/metal/fill.cs.metal index b1ad19ce2..a6e16e550 100644 --- a/resources/shaders/metal/fill.cs.metal +++ b/resources/shaders/metal/fill.cs.metal @@ -6,6 +6,11 @@ using namespace metal; +struct uFirstTileIndex +{ + int firstTileIndex; +}; + struct bFillTileMap { int iFillTileMap[1]; @@ -24,7 +29,7 @@ struct bNextFills constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 4u, 1u); static inline __attribute__((always_inline)) -float4 computeCoverage(thread const float2& from, thread const float2& to, thread const texture2d areaLUT, thread const sampler areaLUTSmplr) +float4 computeCoverage(thread const float2& from, thread const float2& to, thread const texture2d areaLUT, thread const sampler areaLUTSampler) { float2 left = select(to, from, bool2(from.x < to.x)); float2 right = select(from, to, bool2(from.x < to.x)); @@ -34,15 +39,15 @@ float4 computeCoverage(thread const float2& from, thread const float2& to, threa float y = mix(left.y, right.y, t); float d = (right.y - left.y) / (right.x - left.x); float dX = window.x - window.y; - return areaLUT.sample(areaLUTSmplr, (float2(y + 8.0, abs(d * dX)) / float2(16.0)), level(0.0)) * dX; + return areaLUT.sample(areaLUTSampler, (float2(y + 8.0, abs(d * dX)) / float2(16.0)), level(0.0)) * dX; } -kernel void main0(constant int& uFirstTileIndex [[buffer(0)]], const device bFillTileMap& _150 [[buffer(1)]], const device bFills& _173 [[buffer(2)]], const device bNextFills& _256 [[buffer(3)]], texture2d uAreaLUT [[texture(0)]], texture2d uDest [[texture(1)]], sampler uAreaLUTSmplr [[sampler(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +kernel void main0(constant uFirstTileIndex& _147 [[buffer(0)]], const device bFillTileMap& _159 [[buffer(1)]], const device bFills& _180 [[buffer(2)]], const device bNextFills& _264 [[buffer(3)]], texture2d uAreaLUT [[texture(0)]], texture2d uDest [[texture(1)]], sampler uSampler [[sampler(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { int2 tileSubCoord = int2(gl_LocalInvocationID.xy) * int2(1, 4); uint tileIndexOffset = gl_WorkGroupID.z; - uint tileIndex = tileIndexOffset + uint(uFirstTileIndex); - int fillIndex = _150.iFillTileMap[tileIndex]; + uint tileIndex = tileIndexOffset + uint(_147.firstTileIndex); + int fillIndex = _159.iFillTileMap[tileIndex]; if (fillIndex < 0) { return; @@ -50,13 +55,13 @@ kernel void main0(constant int& uFirstTileIndex [[buffer(0)]], const device bFil float4 coverages = float4(0.0); do { - uint2 fill = _173.iFills[fillIndex]; + uint2 fill = _180.iFills[fillIndex]; float2 from = float2(float(fill.y & 15u), float((fill.y >> 4u) & 15u)) + (float2(float(fill.x & 255u), float((fill.x >> 8u) & 255u)) / float2(256.0)); float2 to = float2(float((fill.y >> 8u) & 15u), float((fill.y >> 12u) & 15u)) + (float2(float((fill.x >> 16u) & 255u), float((fill.x >> 24u) & 255u)) / float2(256.0)); float2 param = from - (float2(tileSubCoord) + float2(0.5)); float2 param_1 = to - (float2(tileSubCoord) + float2(0.5)); - coverages += computeCoverage(param, param_1, uAreaLUT, uAreaLUTSmplr); - fillIndex = _256.iNextFills[fillIndex]; + coverages += computeCoverage(param, param_1, uAreaLUT, uSampler); + fillIndex = _264.iNextFills[fillIndex]; } while (fillIndex >= 0); int2 tileOrigin = int2(int(tileIndex & 255u), int((tileIndex >> 8u) & 255u)) * int2(16, 4); int2 destCoord = tileOrigin + int2(gl_LocalInvocationID.xy); diff --git a/resources/shaders/metal/fill.fs.metal b/resources/shaders/metal/fill.fs.metal index 77892f268..707127376 100644 --- a/resources/shaders/metal/fill.fs.metal +++ b/resources/shaders/metal/fill.fs.metal @@ -18,7 +18,7 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 computeCoverage(thread const float2& from, thread const float2& to, thread const texture2d areaLUT, thread const sampler areaLUTSmplr) +float4 computeCoverage(thread const float2& from, thread const float2& to, thread const texture2d areaLUT, thread const sampler areaLUTSampler) { float2 left = select(to, from, bool2(from.x < to.x)); float2 right = select(from, to, bool2(from.x < to.x)); @@ -28,15 +28,15 @@ float4 computeCoverage(thread const float2& from, thread const float2& to, threa float y = mix(left.y, right.y, t); float d = (right.y - left.y) / (right.x - left.x); float dX = window.x - window.y; - return areaLUT.sample(areaLUTSmplr, (float2(y + 8.0, abs(d * dX)) / float2(16.0))) * dX; + return areaLUT.sample(areaLUTSampler, (float2(y + 8.0, abs(d * dX)) / float2(16.0))) * dX; } -fragment main0_out main0(main0_in in [[stage_in]], texture2d uAreaLUT [[texture(0)]], sampler uAreaLUTSmplr [[sampler(0)]]) +fragment main0_out main0(main0_in in [[stage_in]], texture2d uAreaLUT [[texture(0)]], sampler uSampler [[sampler(0)]]) { main0_out out = {}; float2 param = in.vFrom; float2 param_1 = in.vTo; - out.oFragColor = computeCoverage(param, param_1, uAreaLUT, uAreaLUTSmplr); + out.oFragColor = computeCoverage(param, param_1, uAreaLUT, uSampler); return out; } diff --git a/resources/shaders/metal/fill.vs.metal b/resources/shaders/metal/fill.vs.metal index a8cf9a86e..b06c58adb 100644 --- a/resources/shaders/metal/fill.vs.metal +++ b/resources/shaders/metal/fill.vs.metal @@ -6,6 +6,16 @@ using namespace metal; +struct uTileSize +{ + float2 tileSize; +}; + +struct uFramebufferSize +{ + float2 framebufferSize; +}; + struct main0_out { float2 vFrom [[user(locn0)]]; @@ -24,19 +34,19 @@ struct main0_in }; static inline __attribute__((always_inline)) -float2 computeTileOffset(thread const uint& tileIndex, thread const float& stencilTextureWidth, thread float2 uTileSize) +float2 computeTileOffset(thread const uint& tileIndex, thread const float& stencilTextureWidth, constant uTileSize& v_20) { - uint tilesPerRow = uint(stencilTextureWidth / uTileSize.x); + uint tilesPerRow = uint(stencilTextureWidth / v_20.tileSize.x); uint2 tileOffset = uint2(tileIndex % tilesPerRow, tileIndex / tilesPerRow); - return (float2(tileOffset) * uTileSize) * float2(1.0, 0.25); + return (float2(tileOffset) * v_20.tileSize) * float2(1.0, 0.25); } -vertex main0_out main0(main0_in in [[stage_in]], constant float2& uTileSize [[buffer(0)]], constant float2& uFramebufferSize [[buffer(1)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uTileSize& v_20 [[buffer(0)]], constant uFramebufferSize& _57 [[buffer(1)]]) { main0_out out = {}; uint param = in.aTileIndex; - float param_1 = uFramebufferSize.x; - float2 tileOrigin = computeTileOffset(param, param_1, uTileSize); + float param_1 = _57.framebufferSize.x; + float2 tileOrigin = computeTileOffset(param, param_1, v_20); float2 from = float2(float(in.aFromPx & 15u), float(in.aFromPx >> 4u)) + in.aFromSubpx; float2 to = float2(float(in.aToPx & 15u), float(in.aToPx >> 4u)) + in.aToSubpx; float2 position; @@ -54,13 +64,13 @@ vertex main0_out main0(main0_in in [[stage_in]], constant float2& uTileSize [[bu } else { - position.y = uTileSize.y; + position.y = v_20.tileSize.y; } position.y = floor(position.y * 0.25); float2 offset = float2(0.0, 1.5) - (position * float2(1.0, 4.0)); out.vFrom = from + offset; out.vTo = to + offset; - float2 globalPosition = (((tileOrigin + position) / uFramebufferSize) * 2.0) - float2(1.0); + float2 globalPosition = (((tileOrigin + position) / _57.framebufferSize) * 2.0) - float2(1.0); globalPosition.y = -globalPosition.y; out.gl_Position = float4(globalPosition, 0.0, 1.0); return out; diff --git a/resources/shaders/metal/reproject.fs.metal b/resources/shaders/metal/reproject.fs.metal index 61f140468..e39a88ecf 100644 --- a/resources/shaders/metal/reproject.fs.metal +++ b/resources/shaders/metal/reproject.fs.metal @@ -4,6 +4,11 @@ using namespace metal; +struct uOldTransform +{ + float4x4 oldTransform; +}; + struct main0_out { float4 oFragColor [[color(0)]]; @@ -14,12 +19,12 @@ struct main0_in float2 vTexCoord [[user(locn0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], constant float4x4& uOldTransform [[buffer(0)]], texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +fragment main0_out main0(main0_in in [[stage_in]], constant uOldTransform& _13 [[buffer(0)]], texture2d uTexture [[texture(0)]], sampler uSampler [[sampler(0)]]) { main0_out out = {}; - float4 normTexCoord = uOldTransform * float4(in.vTexCoord, 0.0, 1.0); + float4 normTexCoord = _13.oldTransform * float4(in.vTexCoord, 0.0, 1.0); float2 texCoord = ((normTexCoord.xy / float2(normTexCoord.w)) + float2(1.0)) * 0.5; - out.oFragColor = uTexture.sample(uTextureSmplr, texCoord); + out.oFragColor = uTexture.sample(uSampler, texCoord); return out; } diff --git a/resources/shaders/metal/reproject.vs.metal b/resources/shaders/metal/reproject.vs.metal index da03751f4..a7cf025e0 100644 --- a/resources/shaders/metal/reproject.vs.metal +++ b/resources/shaders/metal/reproject.vs.metal @@ -4,6 +4,11 @@ using namespace metal; +struct uNewTransform +{ + float4x4 newTransform; +}; + struct main0_out { float2 vTexCoord [[user(locn0)]]; @@ -15,13 +20,13 @@ struct main0_in int2 aPosition [[attribute(0)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant float4x4& uNewTransform [[buffer(0)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uNewTransform& _36 [[buffer(0)]]) { main0_out out = {}; float2 position = float2(in.aPosition); out.vTexCoord = position; position.y = 1.0 - position.y; - out.gl_Position = uNewTransform * float4(position, 0.0, 1.0); + out.gl_Position = _36.newTransform * float4(position, 0.0, 1.0); return out; } diff --git a/resources/shaders/metal/tile.fs.metal b/resources/shaders/metal/tile.fs.metal index 1b2c7e9db..e2ac15191 100644 --- a/resources/shaders/metal/tile.fs.metal +++ b/resources/shaders/metal/tile.fs.metal @@ -6,7 +6,40 @@ using namespace metal; -constant float3 _1042 = {}; +struct uMaskTextureSize0 +{ + float2 iMaskTextureSize0; +}; + +struct uColorTextureSize0 +{ + float2 iColorTextureSize0; +}; + +struct uFramebufferSize +{ + float2 iFramebufferSize; +}; + +struct uFilterParams0 +{ + float4 iFilterParams0; +}; + +struct uFilterParams1 +{ + float4 iFilterParams1; +}; + +struct uFilterParams2 +{ + float4 iFilterParams2; +}; + +struct uCtrl +{ + int iCtrl; +}; struct main0_out { @@ -29,14 +62,14 @@ inline Tx mod(Tx x, Ty y) } static inline __attribute__((always_inline)) -float sampleMask(thread const float& maskAlpha, thread const texture2d maskTexture, thread const sampler maskTextureSmplr, thread const float2& maskTextureSize, thread const float3& maskTexCoord, thread const int& maskCtrl) +float sampleMask(thread const float& maskAlpha, thread const texture2d maskTexture, thread const float2& maskTextureSize, thread const float3& maskTexCoord, thread const int& maskCtrl, thread sampler uSampler) { if (maskCtrl == 0) { return maskAlpha; } int2 maskTexCoordI = int2(floor(maskTexCoord.xy)); - float4 texel = maskTexture.sample(maskTextureSmplr, ((float2(maskTexCoordI / int2(1, 4)) + float2(0.5)) / maskTextureSize)); + float4 texel = maskTexture.sample(uSampler, ((float2(maskTexCoordI / int2(1, 4)) + float2(0.5)) / maskTextureSize)); float coverage = texel[maskTexCoordI.y % 4] + maskTexCoord.z; if ((maskCtrl & 1) != 0) { @@ -50,7 +83,7 @@ float sampleMask(thread const float& maskAlpha, thread const texture2d ma } static inline __attribute__((always_inline)) -float4 filterRadialGradient(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const float2& colorTextureSize, thread const float2& fragCoord, thread const float2& framebufferSize, thread const float4& filterParams0, thread const float4& filterParams1) +float4 filterRadialGradient(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const float2& colorTextureSize, thread const float2& fragCoord, thread const float2& framebufferSize, thread const float4& filterParams0, thread const float4& filterParams1, thread sampler uSampler) { float2 lineFrom = filterParams0.xy; float2 lineVector = filterParams0.zw; @@ -71,66 +104,66 @@ float4 filterRadialGradient(thread const float2& colorTexCoord, thread const tex { ts = ts.yx; } - float _555; + float _566; if (ts.x >= 0.0) { - _555 = ts.x; + _566 = ts.x; } else { - _555 = ts.y; + _566 = ts.y; } - float t = _555; - color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(fast::clamp(t, 0.0, 1.0), 0.0))); + float t = _566; + color = colorTexture.sample(uSampler, (uvOrigin + float2(fast::clamp(t, 0.0, 1.0), 0.0))); } return color; } static inline __attribute__((always_inline)) -float4 filterBlur(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const float2& colorTextureSize, thread const float4& filterParams0, thread const float4& filterParams1) +float4 filterBlur(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const float2& colorTextureSize, thread const float4& filterParams0, thread const float4& filterParams1, thread sampler uSampler) { float2 srcOffsetScale = filterParams0.xy / colorTextureSize; int support = int(filterParams0.z); float3 gaussCoeff = filterParams1.xyz; float gaussSum = gaussCoeff.x; - float4 color = colorTexture.sample(colorTextureSmplr, colorTexCoord) * gaussCoeff.x; - float2 _600 = gaussCoeff.xy * gaussCoeff.yz; - gaussCoeff = float3(_600.x, _600.y, gaussCoeff.z); + float4 color = colorTexture.sample(uSampler, colorTexCoord) * gaussCoeff.x; + float2 _615 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = float3(_615.x, _615.y, gaussCoeff.z); for (int i = 1; i <= support; i += 2) { float gaussPartialSum = gaussCoeff.x; - float2 _620 = gaussCoeff.xy * gaussCoeff.yz; - gaussCoeff = float3(_620.x, _620.y, gaussCoeff.z); + float2 _635 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = float3(_635.x, _635.y, gaussCoeff.z); gaussPartialSum += gaussCoeff.x; float2 srcOffset = srcOffsetScale * (float(i) + (gaussCoeff.x / gaussPartialSum)); - color += ((colorTexture.sample(colorTextureSmplr, (colorTexCoord - srcOffset)) + colorTexture.sample(colorTextureSmplr, (colorTexCoord + srcOffset))) * gaussPartialSum); + color += ((colorTexture.sample(uSampler, (colorTexCoord - srcOffset)) + colorTexture.sample(uSampler, (colorTexCoord + srcOffset))) * gaussPartialSum); gaussSum += (2.0 * gaussPartialSum); - float2 _660 = gaussCoeff.xy * gaussCoeff.yz; - gaussCoeff = float3(_660.x, _660.y, gaussCoeff.z); + float2 _679 = gaussCoeff.xy * gaussCoeff.yz; + gaussCoeff = float3(_679.x, _679.y, gaussCoeff.z); } return color / float4(gaussSum); } static inline __attribute__((always_inline)) -float filterTextSample1Tap(thread const float& offset, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const float2& colorTexCoord) +float filterTextSample1Tap(thread const float& offset, thread const texture2d colorTexture, thread const float2& colorTexCoord, thread sampler uSampler) { - return colorTexture.sample(colorTextureSmplr, (colorTexCoord + float2(offset, 0.0))).x; + return colorTexture.sample(uSampler, (colorTexCoord + float2(offset, 0.0))).x; } static inline __attribute__((always_inline)) -void filterTextSample9Tap(thread float4& outAlphaLeft, thread float& outAlphaCenter, thread float4& outAlphaRight, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const float2& colorTexCoord, thread const float4& kernel0, thread const float& onePixel) +void filterTextSample9Tap(thread float4& outAlphaLeft, thread float& outAlphaCenter, thread float4& outAlphaRight, thread const texture2d colorTexture, thread const float2& colorTexCoord, thread const float4& kernel0, thread const float& onePixel, thread sampler uSampler) { bool wide = kernel0.x > 0.0; - float _236; + float _243; if (wide) { float param = (-4.0) * onePixel; float2 param_1 = colorTexCoord; - _236 = filterTextSample1Tap(param, colorTexture, colorTextureSmplr, param_1); + _243 = filterTextSample1Tap(param, colorTexture, param_1, uSampler); } else { - _236 = 0.0; + _243 = 0.0; } float param_2 = (-3.0) * onePixel; float2 param_3 = colorTexCoord; @@ -138,28 +171,28 @@ void filterTextSample9Tap(thread float4& outAlphaLeft, thread float& outAlphaCen float2 param_5 = colorTexCoord; float param_6 = (-1.0) * onePixel; float2 param_7 = colorTexCoord; - outAlphaLeft = float4(_236, filterTextSample1Tap(param_2, colorTexture, colorTextureSmplr, param_3), filterTextSample1Tap(param_4, colorTexture, colorTextureSmplr, param_5), filterTextSample1Tap(param_6, colorTexture, colorTextureSmplr, param_7)); + outAlphaLeft = float4(_243, filterTextSample1Tap(param_2, colorTexture, param_3, uSampler), filterTextSample1Tap(param_4, colorTexture, param_5, uSampler), filterTextSample1Tap(param_6, colorTexture, param_7, uSampler)); float param_8 = 0.0; float2 param_9 = colorTexCoord; - outAlphaCenter = filterTextSample1Tap(param_8, colorTexture, colorTextureSmplr, param_9); + outAlphaCenter = filterTextSample1Tap(param_8, colorTexture, param_9, uSampler); float param_10 = 1.0 * onePixel; float2 param_11 = colorTexCoord; float param_12 = 2.0 * onePixel; float2 param_13 = colorTexCoord; float param_14 = 3.0 * onePixel; float2 param_15 = colorTexCoord; - float _296; + float _303; if (wide) { float param_16 = 4.0 * onePixel; float2 param_17 = colorTexCoord; - _296 = filterTextSample1Tap(param_16, colorTexture, colorTextureSmplr, param_17); + _303 = filterTextSample1Tap(param_16, colorTexture, param_17, uSampler); } else { - _296 = 0.0; + _303 = 0.0; } - outAlphaRight = float4(filterTextSample1Tap(param_10, colorTexture, colorTextureSmplr, param_11), filterTextSample1Tap(param_12, colorTexture, colorTextureSmplr, param_13), filterTextSample1Tap(param_14, colorTexture, colorTextureSmplr, param_15), _296); + outAlphaRight = float4(filterTextSample1Tap(param_10, colorTexture, param_11, uSampler), filterTextSample1Tap(param_12, colorTexture, param_13, uSampler), filterTextSample1Tap(param_14, colorTexture, param_15, uSampler), _303); } static inline __attribute__((always_inline)) @@ -169,13 +202,13 @@ float filterTextConvolve7Tap(thread const float4& alpha0, thread const float3& a } static inline __attribute__((always_inline)) -float filterTextGammaCorrectChannel(thread const float& bgColor, thread const float& fgColor, thread const texture2d gammaLUT, thread const sampler gammaLUTSmplr) +float filterTextGammaCorrectChannel(thread const float& bgColor, thread const float& fgColor, thread const texture2d gammaLUT, thread sampler uSampler) { - return gammaLUT.sample(gammaLUTSmplr, float2(fgColor, 1.0 - bgColor)).x; + return gammaLUT.sample(uSampler, float2(fgColor, 1.0 - bgColor)).x; } static inline __attribute__((always_inline)) -float3 filterTextGammaCorrect(thread const float3& bgColor, thread const float3& fgColor, thread const texture2d gammaLUT, thread const sampler gammaLUTSmplr) +float3 filterTextGammaCorrect(thread const float3& bgColor, thread const float3& fgColor, thread const texture2d gammaLUT, thread sampler uSampler) { float param = bgColor.x; float param_1 = fgColor.x; @@ -183,11 +216,11 @@ float3 filterTextGammaCorrect(thread const float3& bgColor, thread const float3& float param_3 = fgColor.y; float param_4 = bgColor.z; float param_5 = fgColor.z; - return float3(filterTextGammaCorrectChannel(param, param_1, gammaLUT, gammaLUTSmplr), filterTextGammaCorrectChannel(param_2, param_3, gammaLUT, gammaLUTSmplr), filterTextGammaCorrectChannel(param_4, param_5, gammaLUT, gammaLUTSmplr)); + return float3(filterTextGammaCorrectChannel(param, param_1, gammaLUT, uSampler), filterTextGammaCorrectChannel(param_2, param_3, gammaLUT, uSampler), filterTextGammaCorrectChannel(param_4, param_5, gammaLUT, uSampler)); } static inline __attribute__((always_inline)) -float4 filterText(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const texture2d gammaLUT, thread const sampler gammaLUTSmplr, thread const float2& colorTextureSize, thread const float4& filterParams0, thread const float4& filterParams1, thread const float4& filterParams2) +float4 filterText(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const texture2d gammaLUT, thread const float2& colorTextureSize, thread const float4& filterParams0, thread const float4& filterParams1, thread const float4& filterParams2, thread sampler uSampler) { float4 kernel0 = filterParams0; float3 bgColor = filterParams1.xyz; @@ -196,7 +229,7 @@ float4 filterText(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const float2& colorTexCoord) +float4 sampleColor(thread const texture2d colorTexture, thread const float2& colorTexCoord, thread sampler uSampler) { - return colorTexture.sample(colorTextureSmplr, colorTexCoord); + return colorTexture.sample(uSampler, colorTexCoord); } static inline __attribute__((always_inline)) -float4 filterNone(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const sampler colorTextureSmplr) +float4 filterNone(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread sampler uSampler) { float2 param = colorTexCoord; - return sampleColor(colorTexture, colorTextureSmplr, param); + return sampleColor(colorTexture, param, uSampler); } static inline __attribute__((always_inline)) -float4 filterColor(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const sampler colorTextureSmplr, thread const texture2d gammaLUT, thread const sampler gammaLUTSmplr, thread const float2& colorTextureSize, thread const float2& fragCoord, thread const float2& framebufferSize, thread const float4& filterParams0, thread const float4& filterParams1, thread const float4& filterParams2, thread const int& colorFilter) +float4 filterColor(thread const float2& colorTexCoord, thread const texture2d colorTexture, thread const texture2d gammaLUT, thread const float2& colorTextureSize, thread const float2& fragCoord, thread const float2& framebufferSize, thread const float4& filterParams0, thread const float4& filterParams1, thread const float4& filterParams2, thread const int& colorFilter, thread sampler uSampler) { switch (colorFilter) { @@ -259,7 +292,7 @@ float4 filterColor(thread const float2& colorTexCoord, thread const texture2d destTexture, thread const sampler destTextureSmplr, thread const float2& destTextureSize, thread const float2& fragCoord, thread const int& op) +float4 composite(thread const float4& srcColor, thread const texture2d destTexture, thread const float2& destTextureSize, thread const float2& fragCoord, thread const int& op, thread sampler uSampler) { if (op == 0) { return srcColor; } float2 destTexCoord = fragCoord / destTextureSize; - float4 destColor = destTexture.sample(destTextureSmplr, destTexCoord); + float4 destColor = destTexture.sample(uSampler, destTexCoord); float3 param = destColor.xyz; float3 param_1 = srcColor.xyz; int param_2 = op; @@ -555,29 +588,29 @@ float4 composite(thread const float4& srcColor, thread const texture2d de } static inline __attribute__((always_inline)) -void calculateColor(thread const int& tileCtrl, thread const int& ctrl, thread texture2d uMaskTexture0, thread const sampler uMaskTexture0Smplr, thread float2 uMaskTextureSize0, thread float3& vMaskTexCoord0, thread float4& vBaseColor, thread float2& vColorTexCoord0, thread texture2d uColorTexture0, thread const sampler uColorTexture0Smplr, thread texture2d uGammaLUT, thread const sampler uGammaLUTSmplr, thread float2 uColorTextureSize0, thread float4& gl_FragCoord, thread float2 uFramebufferSize, thread float4 uFilterParams0, thread float4 uFilterParams1, thread float4 uFilterParams2, thread texture2d uDestTexture, thread const sampler uDestTextureSmplr, thread float4& oFragColor) +void calculateColor(thread const int& tileCtrl, thread const int& ctrl, thread sampler uSampler, thread texture2d uMaskTexture0, constant uMaskTextureSize0& v_1279, thread float3& vMaskTexCoord0, thread float4& vBaseColor, thread float2& vColorTexCoord0, thread texture2d uColorTexture0, thread texture2d uGammaLUT, constant uColorTextureSize0& v_1317, thread float4& gl_FragCoord, constant uFramebufferSize& v_1321, constant uFilterParams0& v_1324, constant uFilterParams1& v_1327, constant uFilterParams2& v_1330, thread texture2d uDestTexture, thread float4& oFragColor) { int maskCtrl0 = (tileCtrl >> 0) & 3; float maskAlpha = 1.0; float param = maskAlpha; - float2 param_1 = uMaskTextureSize0; + float2 param_1 = v_1279.iMaskTextureSize0; float3 param_2 = vMaskTexCoord0; int param_3 = maskCtrl0; - maskAlpha = sampleMask(param, uMaskTexture0, uMaskTexture0Smplr, param_1, param_2, param_3); + maskAlpha = sampleMask(param, uMaskTexture0, param_1, param_2, param_3, uSampler); float4 color = vBaseColor; int color0Combine = (ctrl >> 6) & 3; if (color0Combine != 0) { int color0Filter = (ctrl >> 4) & 3; float2 param_4 = vColorTexCoord0; - float2 param_5 = uColorTextureSize0; + float2 param_5 = v_1317.iColorTextureSize0; float2 param_6 = gl_FragCoord.xy; - float2 param_7 = uFramebufferSize; - float4 param_8 = uFilterParams0; - float4 param_9 = uFilterParams1; - float4 param_10 = uFilterParams2; + float2 param_7 = v_1321.iFramebufferSize; + float4 param_8 = v_1324.iFilterParams0; + float4 param_9 = v_1327.iFilterParams1; + float4 param_10 = v_1330.iFilterParams2; int param_11 = color0Filter; - float4 color0 = filterColor(param_4, uColorTexture0, uColorTexture0Smplr, uGammaLUT, uGammaLUTSmplr, param_5, param_6, param_7, param_8, param_9, param_10, param_11); + float4 color0 = filterColor(param_4, uColorTexture0, uGammaLUT, param_5, param_6, param_7, param_8, param_9, param_10, param_11, uSampler); float4 param_12 = color; float4 param_13 = color0; int param_14 = color0Combine; @@ -586,21 +619,21 @@ void calculateColor(thread const int& tileCtrl, thread const int& ctrl, thread t color.w *= maskAlpha; int compositeOp = (ctrl >> 8) & 15; float4 param_15 = color; - float2 param_16 = uFramebufferSize; + float2 param_16 = v_1321.iFramebufferSize; float2 param_17 = gl_FragCoord.xy; int param_18 = compositeOp; - color = composite(param_15, uDestTexture, uDestTextureSmplr, param_16, param_17, param_18); - float3 _1347 = color.xyz * color.w; - color = float4(_1347.x, _1347.y, _1347.z, color.w); + color = composite(param_15, uDestTexture, param_16, param_17, param_18, uSampler); + float3 _1389 = color.xyz * color.w; + color = float4(_1389.x, _1389.y, _1389.z, color.w); oFragColor = color; } -fragment main0_out main0(main0_in in [[stage_in]], constant int& uCtrl [[buffer(6)]], constant float2& uMaskTextureSize0 [[buffer(0)]], constant float2& uColorTextureSize0 [[buffer(1)]], constant float2& uFramebufferSize [[buffer(2)]], constant float4& uFilterParams0 [[buffer(3)]], constant float4& uFilterParams1 [[buffer(4)]], constant float4& uFilterParams2 [[buffer(5)]], texture2d uMaskTexture0 [[texture(0)]], texture2d uColorTexture0 [[texture(1)]], texture2d uGammaLUT [[texture(2)]], texture2d uDestTexture [[texture(3)]], sampler uMaskTexture0Smplr [[sampler(0)]], sampler uColorTexture0Smplr [[sampler(1)]], sampler uGammaLUTSmplr [[sampler(2)]], sampler uDestTextureSmplr [[sampler(3)]], float4 gl_FragCoord [[position]]) +fragment main0_out main0(main0_in in [[stage_in]], constant uMaskTextureSize0& v_1279 [[buffer(0)]], constant uColorTextureSize0& v_1317 [[buffer(1)]], constant uFramebufferSize& v_1321 [[buffer(2)]], constant uFilterParams0& v_1324 [[buffer(3)]], constant uFilterParams1& v_1327 [[buffer(4)]], constant uFilterParams2& v_1330 [[buffer(5)]], constant uCtrl& _1401 [[buffer(6)]], texture2d uMaskTexture0 [[texture(0)]], texture2d uColorTexture0 [[texture(1)]], texture2d uGammaLUT [[texture(2)]], texture2d uDestTexture [[texture(3)]], sampler uSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; int param = int(in.vTileCtrl); - int param_1 = uCtrl; - calculateColor(param, param_1, uMaskTexture0, uMaskTexture0Smplr, uMaskTextureSize0, in.vMaskTexCoord0, in.vBaseColor, in.vColorTexCoord0, uColorTexture0, uColorTexture0Smplr, uGammaLUT, uGammaLUTSmplr, uColorTextureSize0, gl_FragCoord, uFramebufferSize, uFilterParams0, uFilterParams1, uFilterParams2, uDestTexture, uDestTextureSmplr, out.oFragColor); + int param_1 = _1401.iCtrl; + calculateColor(param, param_1, uSampler, uMaskTexture0, v_1279, in.vMaskTexCoord0, in.vBaseColor, in.vColorTexCoord0, uColorTexture0, uGammaLUT, v_1317, gl_FragCoord, v_1321, v_1324, v_1327, v_1330, uDestTexture, out.oFragColor); return out; } diff --git a/resources/shaders/metal/tile.vs.metal b/resources/shaders/metal/tile.vs.metal index 6b297b65c..35a40cc57 100644 --- a/resources/shaders/metal/tile.vs.metal +++ b/resources/shaders/metal/tile.vs.metal @@ -4,6 +4,21 @@ using namespace metal; +struct uTileSize +{ + float2 tileSize; +}; + +struct uTextureMetadataSize +{ + int2 textureMetadataSize; +}; + +struct uTransform +{ + float4x4 transform; +}; + struct main0_out { float3 vMaskTexCoord0 [[user(locn0)]]; @@ -23,26 +38,26 @@ struct main0_in int aTileCtrl [[attribute(5)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant int2& uTextureMetadataSize [[buffer(1)]], constant float2& uTileSize [[buffer(0)]], constant float4x4& uTransform [[buffer(2)]], texture2d uTextureMetadata [[texture(0)]], sampler uTextureMetadataSmplr [[sampler(0)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uTileSize& _26 [[buffer(0)]], constant uTextureMetadataSize& _49 [[buffer(1)]], constant uTransform& _161 [[buffer(2)]], texture2d uTextureMetadata [[texture(0)]], sampler uSampler [[sampler(0)]]) { main0_out out = {}; float2 tileOrigin = float2(in.aTileOrigin); float2 tileOffset = float2(in.aTileOffset); - float2 position = (tileOrigin + tileOffset) * uTileSize; - float2 maskTexCoord0 = (float2(in.aMaskTexCoord0) + tileOffset) * uTileSize; - float2 textureMetadataScale = float2(1.0) / float2(uTextureMetadataSize); + float2 position = (tileOrigin + tileOffset) * _26.tileSize; + float2 maskTexCoord0 = (float2(in.aMaskTexCoord0) + tileOffset) * _26.tileSize; + float2 textureMetadataScale = float2(1.0) / float2(_49.textureMetadataSize); float2 metadataEntryCoord = float2(float((in.aColor % 128) * 4), float(in.aColor / 128)); float2 colorTexMatrix0Coord = (metadataEntryCoord + float2(0.5)) * textureMetadataScale; float2 colorTexOffsetsCoord = (metadataEntryCoord + float2(1.5, 0.5)) * textureMetadataScale; float2 baseColorCoord = (metadataEntryCoord + float2(2.5, 0.5)) * textureMetadataScale; - float4 colorTexMatrix0 = uTextureMetadata.sample(uTextureMetadataSmplr, colorTexMatrix0Coord, level(0.0)); - float4 colorTexOffsets = uTextureMetadata.sample(uTextureMetadataSmplr, colorTexOffsetsCoord, level(0.0)); - float4 baseColor = uTextureMetadata.sample(uTextureMetadataSmplr, baseColorCoord, level(0.0)); + float4 colorTexMatrix0 = uTextureMetadata.sample(uSampler, colorTexMatrix0Coord, level(0.0)); + float4 colorTexOffsets = uTextureMetadata.sample(uSampler, colorTexOffsetsCoord, level(0.0)); + float4 baseColor = uTextureMetadata.sample(uSampler, baseColorCoord, level(0.0)); out.vColorTexCoord0 = (float2x2(float2(colorTexMatrix0.xy), float2(colorTexMatrix0.zw)) * position) + colorTexOffsets.xy; out.vMaskTexCoord0 = float3(maskTexCoord0, float(in.aMaskBackdrop.x)); out.vBaseColor = baseColor; out.vTileCtrl = float(in.aTileCtrl); - out.gl_Position = uTransform * float4(position, 0.0, 1.0); + out.gl_Position = _161.transform * float4(position, 0.0, 1.0); return out; } diff --git a/resources/shaders/metal/tile_clip.fs.metal b/resources/shaders/metal/tile_clip.fs.metal index de4bf10a0..03baf4b4d 100644 --- a/resources/shaders/metal/tile_clip.fs.metal +++ b/resources/shaders/metal/tile_clip.fs.metal @@ -15,10 +15,10 @@ struct main0_in float vBackdrop [[user(locn1)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], texture2d uSrc [[texture(0)]], sampler uSrcSmplr [[sampler(0)]]) +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSrc [[texture(0)]], sampler uSampler [[sampler(0)]]) { main0_out out = {}; - out.oFragColor = fast::clamp(abs(uSrc.sample(uSrcSmplr, in.vTexCoord) + float4(in.vBackdrop)), float4(0.0), float4(1.0)); + out.oFragColor = fast::clamp(abs(uSrc.sample(uSampler, in.vTexCoord) + float4(in.vBackdrop)), float4(0.0), float4(1.0)); return out; } diff --git a/resources/shaders/metal/tile_copy.fs.metal b/resources/shaders/metal/tile_copy.fs.metal index 67e61befa..4106ef58b 100644 --- a/resources/shaders/metal/tile_copy.fs.metal +++ b/resources/shaders/metal/tile_copy.fs.metal @@ -4,16 +4,21 @@ using namespace metal; +struct uFramebufferSize +{ + float2 framebufferSize; +}; + struct main0_out { float4 oFragColor [[color(0)]]; }; -fragment main0_out main0(constant float2& uFramebufferSize [[buffer(0)]], texture2d uSrc [[texture(0)]], sampler uSrcSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +fragment main0_out main0(constant uFramebufferSize& _17 [[buffer(0)]], texture2d uSrc [[texture(0)]], sampler uSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; - float2 texCoord = gl_FragCoord.xy / uFramebufferSize; - out.oFragColor = uSrc.sample(uSrcSmplr, texCoord); + float2 texCoord = gl_FragCoord.xy / _17.framebufferSize; + out.oFragColor = uSrc.sample(uSampler, texCoord); return out; } diff --git a/resources/shaders/metal/tile_copy.vs.metal b/resources/shaders/metal/tile_copy.vs.metal index 6ac89c860..baa3b9026 100644 --- a/resources/shaders/metal/tile_copy.vs.metal +++ b/resources/shaders/metal/tile_copy.vs.metal @@ -4,6 +4,16 @@ using namespace metal; +struct uTileSize +{ + float2 tileSize; +}; + +struct uTransform +{ + float4x4 transform; +}; + struct main0_out { float4 gl_Position [[position]]; @@ -14,11 +24,11 @@ struct main0_in int2 aTilePosition [[attribute(0)]]; }; -vertex main0_out main0(main0_in in [[stage_in]], constant float2& uTileSize [[buffer(0)]], constant float4x4& uTransform [[buffer(1)]]) +vertex main0_out main0(main0_in in [[stage_in]], constant uTileSize& _18 [[buffer(0)]], constant uTransform& _34 [[buffer(1)]]) { main0_out out = {}; - float2 position = float2(in.aTilePosition) * uTileSize; - out.gl_Position = uTransform * float4(position, 0.0, 1.0); + float2 position = float2(in.aTilePosition) * _18.tileSize; + out.gl_Position = _34.transform * float4(position, 0.0, 1.0); return out; } diff --git a/resources/shaders/vulkan/blit.fs.spv b/resources/shaders/vulkan/blit.fs.spv new file mode 100644 index 0000000000000000000000000000000000000000..dca202be50a67299bf520ca5fa7a76ba0a91c827 GIT binary patch literal 1040 zcmZ9K*-8UJ5JlU>n7FTryH4B}5Fb9@}eaLMhF@nNQNu4*!2 zNcI)>9cU34#qa!bXO8$^BC3gTChsDew_oeZxM#Z4gxOFiTm!2P#0?}T+nZFVJ`*3II1-^mYc?W^BUUSMhhk+h-JoaqLS zwZ?!x^#i)vLruT=DWG=74V-T})zn>Wz-RJFONCwV2j;gfdjJ3c literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/blit.vs.spv b/resources/shaders/vulkan/blit.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..354b57fbf1c7528888691dd8a1ba34117d9603f5 GIT binary patch literal 1140 zcmYk4U279T6o$vdP1V-cTHE?j>(=@OO7KEO5EZEqFM1KFcq_p!vJkV9tRi0d&jf#! zH-gVIlZl;ha?W|rJLhY*+u2_V;Z!)o?_Nk}J#;`qSPs3Y2Zu+8{aJh5fAsjFjMdPM zL^*5R^PEOLkLro`d1M{Af^_+H(7z!Uuuk#{kh8?v>ia>{Oph@^igv+6~70l+0o&l3N_ipr(Z_n9(!wmN8SxzcsEbZD?2n)zMOe^nU(&z?<0b&KwiZoa>46GIM-KF(q?uMo#ME4z_*R;}i0_H)r*T{{bn` z?#A8w-CO%PzPnyU+-HL?zBb2Ra9ggvTw@mzF=OsnKj*oDeKJppFSbHe@9rV)xQ{ru xbCt+jx^p-Ch#XJGZeizpL$WyIZA7jy_uyV$k;6UQMSKJIZjbu%|5EuW@((r~MZN$4 literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/clear.fs.spv b/resources/shaders/vulkan/clear.fs.spv new file mode 100644 index 0000000000000000000000000000000000000000..a03bd936c09ec1c21bd84c676c4b58ea490e2440 GIT binary patch literal 792 zcmYk4-AY1H5QVp%G|N)U)P7C#GLSARf~b%nyAUdR0x5`~60Giff*z`;>L%#>Jm-j8 zX3w5AYu3yhjIy2i5Hg{_Z#TqeC1gQDD2DvR_Xqcb?)%4M_weXIMkz!SqMS0EIlT5d ze10>rfK}j#A1*E9UiloL%foI}2~d(&JTw~5VHx%KVI4oHFh4c8u2o|g=Mh)Brfsx*t?9kx7zAe@Ybp?-`pA&!q#eANUK_qdC?cWBtB zhRN}ySe>_++!Sjhn6}E1E-+VKB_RL8ug9}GP7zjiB9)8$PG+NTJ!j!`quM} z=G(U?^_4K=V*Na8iuumO(-!la@GWUZ6LcVd4or^r6jlvgN2bZ}i_PM#pooQFeSK#y zW-rdzKCR_G%oCHV@0?SudbH)+i*LGwaGodsO5uKgX7AUr>xEzP^=}~FJwtpEZ4I$m zENAXJ#EdESbqnq6joX*L-=diJTK6{Mk?)^^J(hLKK35HLjIW{1^{!RE9pC3}JmP;q zs%YY{n^XR2?8Et!VB#r%3R_IEKl}17 z_j?X;hr9URbv|MvbgMsuc%L(}4{OQs{yKUNaj&U=bLJ!d6OR4@Vjb~c5xX35cixQH zRcv>z{D{~!Y`Mms(z){!^L}@87ZG!3zR5k^L&Ov3KDHdcjl@~T7XKD=RLloS_9yz5 z*_nC2cix#@QYZ{i zRHKvSm;d;^KTecrIEQ>|xBu?ayi4v*O{SICO(qXX+$JuA#n>|S?q%*SG4BfAuOfbw z<<2D5;qCn1$*tnm7n5u5JYp^Kd3=l&u$?Tg5qs=i$J<+N^%{6<)tB$x5*EV8sd}qK zu_?!U^EE85UnjQSx&ywQv3q&se1nwmXT0sTfH|)-9mBNmA|`&tmvFvjhKYOJMco@T z?9;;Jcyg>wEG9R{mNU%SYdYC$1+!kh_wIUzs(Wl;`E2g!eD>SS?mp?ShX0B>;wNmG L|35!;Kg50k75^b$ literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/debug_solid.vs.spv b/resources/shaders/vulkan/debug_solid.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..850396e9921f2e3521eeab893685f59b04c71e58 GIT binary patch literal 1324 zcmZ9LO>0w85Qa~a-dL@+*4oyO8k5HFYILC@h+inCi!K5Mw-WV6E~H6GZa~~9xN+r= z@>jVLe4d+o+Tw)C%)Il?oH=unYNd4|gt@T5=YE*UN~nN@uo!BE?d)lI7W`s1vic*F6Fg`kw`x zz8&}W(+|^rKOOI7UsE8ao8|QT|D_YoK4$_+U^cOz2k*P-_+2{A(=Xz+64y5uPqnXn z?^od2Fh72#Iqya8^&mTVlTGs8@MBucW6tfEn+^ttIp=XFN{3B&&w3Gsu)~DjQ90sN z3(RxmdzUQO@u>oz%^=@%#3KJRzVnGcC2#D0#Oj>oZtP|66|8k)a*f@M*fz0! zS5Za&d8|3>%{%7>6nPorOGWtog|l73m*XCs-8X8WihSd%sIzSnH?Z=>>Ud3T?9srV z>3s2a?$5k)Z(&=gSnPWZUvcj1SZB6(oO2srF@Fzht!F*v{k@|zE8>4Z60B$W9{$(t z_l(#*FQM*uL@d5sVy~!jXKSc?b(hx2Sx3cx!ZF@JtrP!MVi!x?9d}FYGQK-jf0WoJ zzFc$9nb`TnJm0(DK*ijN=eviSsCeYu!k6RjBj+~0__wm=4!&5IiQUy*)IQ?w)0yn& TKHI2o;+>tzSpHvL`w99FGM7}s literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/debug_texture.fs.spv b/resources/shaders/vulkan/debug_texture.fs.spv new file mode 100644 index 0000000000000000000000000000000000000000..526a0c377e4b9f5ceed4473a6ef46283389e4516 GIT binary patch literal 1324 zcmYk6Sx*#E5JvAX3nvY6!ncYJ=AK`cuU6(b15RKV(xsjqyfAdqIbTtQ`BXDwch^N%rS zz&!R}kDTOp@x6n-v()4I#@&o@=Sn?Z*JkK}D+8F$mFmf@*VDJ2d$OK0rg{rxnb)O; z{X8#m>R_`{TjkE(yVy!N#aEph*t#S?qsQqOkozq9?m=0l%UP_vnGy-5FHhh5D{IU# zkF~}!u?4I%IHS4evGx=!Tt3 zc=?3i31i+*fNOmpWY;&H(IUs4!W56jeoF8 zI0e=P>vY@6cKRj3WWpR*@ASFK^gJyHS??V3pmmsb(pEO3nDaI2J+K^x!$q*}t9D~A zdEedLP1?Oaxes^P{m*T$OFE!3^V~vyY`&`}?YBvrp~Rh2T+$c2R_H12E;Bsc@AUW7 z=kD-rG}D8Z>0zg_{~@7Tp64a>b(_s2pYynPX_IZc-?_}nZFj3}&(}=sUZsUxkW+G<{(54up1bO=r)@pS{J5vl96G}6C#H;X))aFO5mOiQ zJM&%Q4kwww_!^io>eFZyWEGwvgMWt1)>p+IK^iOmq_Ewm*cA40WEFNM^X)4Z^G_5$ zar3p^zwvWaarf4?*96i$F=Msez1SkQbthrT_%ld-G5>6#$64*=ZDKEP5M#ZUxnlOx z_71U^J6V9Cb$e@H$;@xheb4LYV(!>I+(1@g$$0IXu)Sxo7m>z`&7padSVN!eJKaXQ zTm8fQm9j9*6jPS%cduAxi%A0n-1uQk3c-_MyP@!ue2q`lmqzZ2GbitWwD zVDHt!79TIL7i78rDcBo%7jul6hQ)snqdfzgC;p7Cem`Qd#|3on6no5~i^U#QbZ^t& zqlPUWd(5MoC;qeOdl_BaJJt*AD!O-+zZcjwbYt~7pF0q{51g4V_2uqhfgU{m1 zH}Gk^Bqn}ePakZ1Qd9N+Rezm2)tyajPDV6hieD$j&q7SVL`+9s`tIKQz0SwuUgzHnWXlSO-+D)sk>(HAGf zUZoDY<{|IXucg#J7}L?^7T$HOhMh0rw{%Z4Y@XL-CFd^GJIBU(Zj9yJu=+GZT`!mP z&QjNl)tg`BU*D#i{ft+La(oM0<$T|b*jx)dg_qOBm+*}WKd-QNmQ%lgSMU3@{tDi+ zL=Zf2y z+%k9r-@+Q0bBNPU)!znNn|izB)cbywle4$jJzM{jJLtW?kN5lu)5KfrKK-_xTkIWf zR`>;2eg<==Gi*nE8FNl|Z!Xo%5?lAZ(#;XeeXjO6Ppnq{C6jorT+%NQ%YCKZ-Co1w z-2WGPy7%jt{15c$JN`{h{uXu@^M1y!>EqtEFn8@fJ|v!{CdB>gtA e`>gAC!175iuIufS&U#4f8P@u(iT|*{XV_oMNlkwM literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/demo_ground.vs.spv b/resources/shaders/vulkan/demo_ground.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..998fc9eaeb97f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ftR8!k-j1U_dx`5~)YeM1btfKR-(cTjkK^kcML@k|PLe+f>`Qhfh52G( zVWBX8y|~hB7B|`t>Xl->wq7ZgYpu#kyS7!)Z!qImTVJVfma`81cw}q$lXpKgRvK%~ z&30wBu~li6Rx78ss*}@NdvapBIWe6Ww->)^tFgua@1@ryX*a}u$q2aAs+8t$F2M(q zegE^t(ps}#X?6V$qSq_cHbW=w6l1HldQZVT*dD%E}w!os@07O4%VE7cYS-4 zcfjtQ`Ui~V6fcYKsP}i~8*?mawoz}SJ-F9fbKQj)>%MO-H9G#^fj4K;g@DcRz1n}P zQ0q&6Kx>v-B{xI9o#6$zeI3XAAv-U3-kY@_Fa5?~ za`7S10OKfjn0W7#+__QsAfuXgB-zPdcfN-)`vo^2S+*-RCt>rx% zqrx6WHEU|-G3Fp1hZsjOzcVR6+@+n|Pk^KM1Jry9ZjCWUvFkC;dgm~{KZ2j{@@tXz zGQ0;n#@;8H7qLzF+VOV@EO1!97xsex3p6dwv#8J$#-6 z=X*YlrXD>%4>nFcdVB$FT<|ksYemm5f{oLn=a<0h#_Dg+o}+s7^D;Q!^I0_Y@RKl}BbIUl{e3RcUW`7~TT ze6FNEml@qJ@6Oc@?$(rF!>nm83Pj+uV zLsO61E8x4Bx^Af0o?;f&T)xGu$2k literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/fill.vs.spv b/resources/shaders/vulkan/fill.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..697f1166815c8568c6a279e86ef5ca3183540968 GIT binary patch literal 4468 zcmZ9N_j6QL6vrRLBq9hRh#iAiP@0Zd5QU8>v7iKry}*)eaCMW7TM#>_px8V1Ua_G6 zf#Wa!NtPKMKcDyRVcz6rzB%W7Pr2vbbKl#ZnM?b#Y({o0f4^qMGe4UNlV!8BzFZD% z-nMyFyEC?G&7~I^F*obU1C5!7<#P;}sMaUdF9U;MGZ+SUf_uSR;1DnP$J@2evhKy}#xGt+8ach$9ApRQ4U=QFJvrB(9gl2x zYLlb&#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$*}YGaFn^Tt9M7(q|!$ z2j2I2NPqYBp8%BFi;-s~+x^)8d|+O@AE%%KsQf5xQo!`SA+kUfwr^zAIu$n=>Px# literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/reproject.fs.spv b/resources/shaders/vulkan/reproject.fs.spv new file mode 100644 index 0000000000000000000000000000000000000000..e40464c80521aa71b774b97c5159e90ef511c1d7 GIT binary patch literal 1512 zcmY+DTTc^F6opTzQ}D(`Szd+Fvj2WaJ;6%2uuj)LoM5zy9c|Cqd~i|zVT4S zc&KJVH4|YpoM9Ke*5|&C8E_v=qLb$WPF1po@Q0uXwycl1=PbT{lJ*We-?oz^ZDXRV zQ9}sBy>9z3ZS{{nBEYVZQQnoDb`etz7mr<>qpX&%rKEDp_y?!%iL!c=w`uFscG68! z?~a0x9TGbjrX5qtt;-#>dSAL7R3Yr}lA@L&0=sdc-w?Qhw()^fbI@kM^?F8j6hJIQHO>grh9o@Y7L*kdrqeb%k*++zNZ zvCD~h>~r~9|1z<@O-}6vc5}+T$Zg*%H-kOS9)k*4%k2ryF5~T&TJu@UG`qFP>A%cw zti1WP?N^ac?Hq8KUwb~YzP~p9Dretey!F)CW8hM+y#nlwdgog7qsVs`j+N!R$3d+c z>(O>zatnOv4R&j&fbuGA?|6_q)S5%vnYtEv`D1ossQ*O?Go^@(tQA z=i{=Lzc7BY#yL-agGJ5u#P3V{4Jv0a1)Q6+c}a}(xCG?2?cXf0_wR`DjSD%)cET;@ zobTP|2Jct`YV|oQ=kuE!`mO-)QS*w*ty9iB^8s(|BvV z0p$157=JV8YbSoYT+Wk?NF|TP=^U&HZ%+0-9Omh8BdOOo;-c5 zVlFfap_+Nlxh`PG{cPy|Dz<>##2WnS_+N+VJRcpgPpEAL|7Gy8mySN9qe*%Oge`gZ#$uLcm?`wuT=3a&a*%yb)y0@~65AbQ zCvUUyq(A(WPGfd#>~t`g#u9q7N0;@i;ZNVC-wsFp;rMetItH6t-ZlI`#F<7|FGHcr zWbFGqw&#fVP}{F-wsawKTDKIb$8}m)SM(Eo_DJ<`o-jf&H@Nv?cK6f-n12Z!dCD ze}%m>kbgm3>`dj%XU*PiKI39%EN8w&y!SgF@4JC-VXo~8FR?e@8h9D6UT&S8^Ncx+ zY2LevFYhSt6_@{wGOs<{!d$E9Z{y8l9qXKQ#&YJmgSTHfdk{PKID?I9uil!iuYgVFcUjrN1bl>cfurvxqYl9|!?=ko6Ht&S& zE3Hpo+%v89;Pw`Pbe;e6V&GDrF87syJ=P7^WA61W-sAARJ4#HR!MwwL5B}T)JONz7 B5`zE$ literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/stencil.vs.spv b/resources/shaders/vulkan/stencil.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..6fc53e39d29bcb62c6bc11b4e87fc9599b0cc022 GIT binary patch literal 828 zcmYk2UrPc}5XC2L)v`1*wSS1wV<0_L1W^$M_TYmd^cqr2ENpA&2GLWWtxwfU(E07| z-J0d>%$zxQX6`K(_RD4qR?)X(sWq%1#;j_k#1Dq!VSgS!^^cAZQPixM2+`C{$7PGc z%Or@1SA}(a`@BTIrHHfacA_`u?%WZB{}$uPpNpkuQ=s3SSbDWGPA=!#8OKbg>tr1LN1DdG eO@Z_1sk7IW`m)ouz&mi)3vEJ<{zo@C6@CGWDm0q_ literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/tile.fs.spv b/resources/shaders/vulkan/tile.fs.spv new file mode 100644 index 0000000000000000000000000000000000000000..ec9928be028ba5c20138bc9543a75fe33ae2810d GIT binary patch literal 34884 zcmZvl2Y^-8wT2HeGa#VY6)RX#Y+yw!6cwW=C@6LuV1SV+I0dnTvG?A4Z_yZyNz_Nz_E6CeNDa`@Vb6n%T4EJonrG|F5;zUb~%h?ww)Mdx>@W6h*J1FaNi& zwy0do7E7QMMgO9%Qjec7dBUdc9WyuGa;wdCSi0z4@zZA@UNzK~=K97K4ZVmnkTRIE zKII5X2W1)B=|_j4-tZw#`z8U^-cU5TV^zM&P*L@@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2K(x=9>wxqkq5EGqBThzPJw;CT=~e zb#3C%o=xn1)?}x^A&rbLU}>4}3ncnpe|Za{;j$`Mcnj;4j7&VcvT&ZfW8V zr*W5n9V_p=?ysEsW%$dmOR?$H$K{EOdRKtUeOw7vBOiTSMcmuR)o}9B$2G)`mA8*U zyqq;w<8Q#cA7d@<^^J*-{acf`qiJnx!QR30*7R)1*}M1Ut=KKtTj<5NC+;@1F`&$)Y~wzb>!{Mb1E16dN;9Lyx+~la+|Qw z+)M15Vh`^lRwr*w&$?Xbw-T3YZU@VG$A@MIak=ILV0H4=+=7=2{RnZn<}R?@LnY0_ z#O0cgfYr%c({E1Bnvdh3#P%fo6n+dF#dfiGjUhWXZHET;kw*`#PyZ97ZPXf82e)4`tfmoUm~`q zHG+GY*zxM+{QZ0dQ)@2PbdcD4=6L!RUL{s{5R3j_BX<9`^FHU{U&rJ$AA62(<4_(K z8sG6OST5!}N<4^pm-w6c7IqAK6H{|4{%uS?zSnmW7klt7*g8JJy+A}gPl-RlqL0sr<NFwdN+UYcb!KXX`i2dDPg;as2Pt*OD Ezr#zdz5oCK literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/tile_clip.fs.spv b/resources/shaders/vulkan/tile_clip.fs.spv new file mode 100644 index 0000000000000000000000000000000000000000..f1169cdb2c6a9c1d8a554138d6309b789e6582c1 GIT binary patch literal 968 zcmZ9K%}WAN6vbcKn5AiEX=)#1whN?1MGzGv zsW*Nmuq>;{>asOyiK&ThX;n7nONoxyWR4?-JpU%}9y|WT4?;~|+*>~w$VuU-9@v}C zCL<|Aj$ZS-(R;`DgJHzcdw%T=o`!)x)4i*1)ZdkHz|`Ki=npp&m|n>^m^gcrPv2xc zdV-0UwJEzc?bgQLE4pXIxw5MAc@r@2;Oc)?o|lC`k1#XC)inKzJbLOUPmHONivnn= z0cKB5T~id~(G@Mjw+wY)_Tx0vab2Do%()>?U-lt)Q=Xpi^Z@e~aKvlTogCs|-iG+0 zF#Mj36Jyt+kE>ICWBTwW9CrT}p9-m;2B1`Xx}W XB@5pytW6#CmwFX`7sP+0IFtPXk#8-7 literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/tile_clip.vs.spv b/resources/shaders/vulkan/tile_clip.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..e6618d85f515e8de32be7d91d886affbe2eb9993 GIT binary patch literal 1668 zcmYk6T~8BH5QYyeEhq>g0)8O2)^D(W0is3?mZV;gh$->bY}$ovtX;CZ65>@a{Z}Ub zDsN1DpR=91rxNS$HNWHs{f?*;T4;%KOtd z&qsr-6a5JBGaJ2;t<{fC_M$Wk2HkLMqwCnd_xod8Mg63&thTyIpSTk_!1M>q0^3Z; z1IAXgbNAwT<_0GB2i=(avS#va%#ja{-TcS_S3HXj$K2bp5D&jaeY4la;e);`t*X5y zS?8F-Ox_`_+kfJ|FGADu@f6RxGsUieoOm=gu1bV8zYW8-IdN+`p2E`X|G9G z)C|5aA;zlk1MT?3tx2Qb76ThX-gWKNfStVH{P&v2rJhF;mi4CT(eRh`=CLpwVm|&4 z!wuh=&r{jp5cAoT&Z3ST?bJby+v+*9J#aASax~yds@9VEC%^VvcLV_`q9^>(b#Z z$EtKV%fUV1h)GR1C2-{DJ%OEQJE>iX>X)yYd4%h4)` zavnt|?qSu*@Zy(=2j~{M0#BROQNjk0`j@h9_5n@;AG(VcWc|J5=@?WCA*T2>xU^KzzVICZ}svC^lHn7hii=RT^`aTmYNd#7EKhIBe@>>|2ONke-VygN3So791@2+#G_}eP>24cI^c30oZ zUBOycOs=u}i>(ts#-^xmkE(bLU-A7DtlYZZQ+)TRdmDQ%u`T{F+gN9{UQ_DWnmbiO zt}_{XQ)QcO-d^5bft24uo^e`XJ9ON~x5jI}xifkn#aV7a60GmMr~hSlct`B)4^eOS z1yp>w!o(Hl{XhlxUq`)}ck#Xa4OILu9OF&Y8shJnzhiSMN{-E@7<$^ c$`P-79N=5$8ysgoMCFOw!@G<9W7;?9e}9%dLI3~& literal 0 HcmV?d00001 diff --git a/resources/shaders/vulkan/tile_copy.vs.spv b/resources/shaders/vulkan/tile_copy.vs.spv new file mode 100644 index 0000000000000000000000000000000000000000..d48eab7232b802f6f398e05684257b0ecf0a4226 GIT binary patch literal 1464 zcmYk6O;1x%5Qa}bMNtqD@B{Ids;Fpnp~l3hF`ASGixP-i(`Yp}DJ^Ml6XVK_Kfu4_ zuX1DJ^W59hcACkYdFP!uGjlFf%FS~jl)@6fC!vtFPzDKMIn;C8K0H2bjk7PUXV0I? zSP7M!C}%a0j#SapZaVOM3Ee>}{L0ur5Nj|NIW>^;#LkA}G)sqhUXAvl6ZpFz0&M=KQVysnZ*M?2WSCcSGiiE5_nYb!HKFt{hJX z+4MRxikR~dd*4sbKBVKUJNVq2#oUUqNxwgf*^j$WoFlsta)N`_1(AFKE8F=QAPe$ ztTFSw`x@3>-KD)<$0n#^zWxo=ySMRgV&#kNaB}ythB4K9ZeiVzar@FQ{x0QL!)<)? zyw{l$teCkCY_W?XSATbgRr9wrF5e#QXAf1Pe?RwrzO~+C&i3McFZd?R^>+2d658QrXWmEU8rwtN&2MTLdxUzA9D8wBE!4NN N7kky0_m8SC(f?_+TIB!$ literal 0 HcmV?d00001 diff --git a/shaders/Makefile b/shaders/Makefile index c121d3a13..67aebe922 100644 --- a/shaders/Makefile +++ b/shaders/Makefile @@ -40,18 +40,23 @@ OUT=\ $(SHADERS:%=$(TARGET_DIR)/gl4/%) \ $(SHADERS:%.glsl=$(TARGET_DIR)/metal/%.metal) \ $(SHADERS:%.glsl=build/metal/%.spv) \ - $(COMPUTE_SHADERS:%=$(TARGET_DIR)/gl4/%) \ + $(SHADERS:%.glsl=$(TARGET_DIR)/vulkan/%.spv) \ $(COMPUTE_SHADERS:%.glsl=$(TARGET_DIR)/metal/%.metal) \ $(COMPUTE_SHADERS:%.glsl=build/metal/%.spv) \ + $(COMPUTE_SHADERS:%.glsl=$(TARGET_DIR)/gl4/%.glsl) \ + $(COMPUTE_SHADERS:%.glsl=$(TARGET_DIR)/vulkan/%.spv) \ $(EMPTY) GLSL_3_VERSION=330 GLSL_4_VERSION=430 GLSLANGFLAGS=--auto-map-locations -I. GLSLANGFLAGS_METAL=$(GLSLANGFLAGS) -DPF_ORIGIN_UPPER_LEFT=1 +GLSLANGFLAGS_VULKAN=$(GLSLANGFLAGS) SPIRVCROSS?=spirv-cross -SPIRVCROSSFLAGS=--msl --msl-version 020100 +SPIRVCROSSFLAGS_METAL=--msl --msl-version 020100 +SPIRVCROSSFLAGS_GL3=--version $(GLSL_3_VERSION) --no-420pack-extension --glsl-emit-ubo-as-plain-uniforms --flatten-ubo --combined-samplers-inherit-bindings +SPIRVCROSSFLAGS_GL4=--version $(GLSL_4_VERSION) --glsl-emit-ubo-as-plain-uniforms --flatten-ubo --combined-samplers-inherit-bindings GLSL_VERSION_HEADER="\#version {{version}}" HEADER="// Automatically generated from files in pathfinder/shaders/. Do not edit!" @@ -66,28 +71,28 @@ clean: rm -f $(OUT) build/metal/%.fs.spv: %.fs.glsl $(INCLUDES) - mkdir -p build/metal && glslangValidator $(GLSLANGFLAGS_METAL) -G$(GLSL_VERSION) -S frag -o $@ $< + mkdir -p build/metal && glslangValidator $(GLSLANGFLAGS_METAL) -V -S frag -o $@ $< -$(TARGET_DIR)/gl3/%.fs.glsl: %.fs.glsl $(INCLUDES) - mkdir -p $(TARGET_DIR)/gl3 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( glslangValidator $(GLSLANGFLAGS) -S frag -E $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) +build/metal/%.vs.spv: %.vs.glsl $(INCLUDES) + mkdir -p build/metal && glslangValidator $(GLSLANGFLAGS_METAL) -V -S vert -o $@ $< -$(TARGET_DIR)/gl4/%.fs.glsl: %.fs.glsl $(INCLUDES) - mkdir -p $(TARGET_DIR)/gl4 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( glslangValidator $(GLSLANGFLAGS) -S frag -E $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) +build/metal/%.cs.spv: %.cs.glsl $(INCLUDES) + mkdir -p build/metal && glslangValidator $(GLSLANGFLAGS_METAL) -V -S comp -o $@ $< -build/metal/%.vs.spv: %.vs.glsl $(INCLUDES) - mkdir -p build/metal && glslangValidator $(GLSLANGFLAGS_METAL) -G$(GLSL_VERSION) -S vert -o $@ $< +$(TARGET_DIR)/metal/%.metal: build/metal/%.spv + mkdir -p $(TARGET_DIR)/metal && echo $(HEADER) > $@ && ( $(SPIRVCROSS) $(SPIRVCROSSFLAGS_METAL) $< >> $@ ) || ( rm $@ && exit 1 ) -$(TARGET_DIR)/gl3/%.vs.glsl: %.vs.glsl $(INCLUDES) - mkdir -p $(TARGET_DIR)/gl3 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( glslangValidator $(GLSLANGFLAGS) -S vert -E $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) +$(TARGET_DIR)/vulkan/%.vs.spv: %.vs.glsl $(INCLUDES) + mkdir -p $(TARGET_DIR)/vulkan && glslangValidator $(GLSLANGFLAGS_VULKAN) -V -S vert -o $@ $< -$(TARGET_DIR)/gl4/%.vs.glsl: %.vs.glsl $(INCLUDES) - mkdir -p $(TARGET_DIR)/gl3 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( glslangValidator $(GLSLANGFLAGS) -S vert -E $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) +$(TARGET_DIR)/vulkan/%.fs.spv: %.fs.glsl $(INCLUDES) + mkdir -p $(TARGET_DIR)/vulkan && glslangValidator $(GLSLANGFLAGS_VULKAN) -V -S frag -o $@ $< -build/metal/%.cs.spv: %.cs.glsl $(INCLUDES) - mkdir -p build/metal && glslangValidator $(GLSLANGFLAGS_METAL) -G$(GLSL_COMPUTE_VERSION) -S comp -o $@ $< +$(TARGET_DIR)/vulkan/%.cs.spv: %.cs.glsl $(INCLUDES) + mkdir -p $(TARGET_DIR)/vulkan && glslangValidator $(GLSLANGFLAGS_VULKAN) -V -S comp -o $@ $< -$(TARGET_DIR)/gl4/%.cs.glsl: %.cs.glsl $(INCLUDES) - mkdir -p $(TARGET_DIR)/gl4 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( glslangValidator $(GLSLANGFLAGS) -S vert -E $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) +$(TARGET_DIR)/gl3/%.glsl: $(TARGET_DIR)/vulkan/%.spv + mkdir -p $(TARGET_DIR)/gl3 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( $(SPIRVCROSS) $(SPIRVCROSSFLAGS_GL3) $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) -$(TARGET_DIR)/metal/%.metal: build/metal/%.spv - mkdir -p $(TARGET_DIR)/metal && echo $(HEADER) > $@ && ( $(SPIRVCROSS) $(SPIRVCROSSFLAGS) $< >> $@ ) || ( rm $@ && exit 1 ) +$(TARGET_DIR)/gl4/%.glsl: $(TARGET_DIR)/vulkan/%.spv + mkdir -p $(TARGET_DIR)/gl4 && echo $(GLSL_VERSION_HEADER) > $@ && echo $(HEADER) >> $@ && ( $(SPIRVCROSS) $(SPIRVCROSSFLAGS_GL4) $< | sed $(GLSL_SED_ARGS) >> $@ ) || ( rm $@ && exit 1 ) \ No newline at end of file diff --git a/shaders/blit.fs.glsl b/shaders/blit.fs.glsl index 8d461ed41..027a3f110 100644 --- a/shaders/blit.fs.glsl +++ b/shaders/blit.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/blit.fs.glsl // @@ -16,13 +16,14 @@ precision highp float; precision highp sampler2D; #endif -uniform sampler2D uSrc; +layout(set=0, binding=0) uniform texture2D uSrc; +layout(set=0, binding=1) uniform sampler uSampler; in vec2 vTexCoord; out vec4 oFragColor; void main() { - vec4 color = texture(uSrc, vTexCoord); + vec4 color = texture(sampler2D(uSrc, uSampler), vTexCoord); oFragColor = vec4(color.rgb * color.a, color.a); } diff --git a/shaders/blit.vs.glsl b/shaders/blit.vs.glsl index ca3b0f7c4..cd83081a1 100644 --- a/shaders/blit.vs.glsl +++ b/shaders/blit.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/blit.vs.glsl // diff --git a/shaders/clear.fs.glsl b/shaders/clear.fs.glsl index 624f66e91..c46ab5dcb 100644 --- a/shaders/clear.fs.glsl +++ b/shaders/clear.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/clear.fs.glsl // @@ -16,10 +16,12 @@ precision highp float; precision highp sampler2D; #endif -uniform vec4 uColor; +layout(set=0, binding=2) uniform uColor { + vec4 color; +}; out vec4 oFragColor; void main() { - oFragColor = vec4(uColor.rgb, 1.0) * uColor.a; + oFragColor = vec4(color.rgb, 1.0) * color.a; } diff --git a/shaders/clear.vs.glsl b/shaders/clear.vs.glsl index 2bf5cc46f..1e169bb32 100644 --- a/shaders/clear.vs.glsl +++ b/shaders/clear.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/clear.vs.glsl // @@ -16,12 +16,16 @@ precision highp float; precision highp sampler2D; #endif -uniform vec4 uRect; -uniform vec2 uFramebufferSize; +layout(set=0, binding=0) uniform uRect { + vec4 rect; +}; +layout(set=0, binding=1) uniform uFramebufferSize { + vec2 framebufferSize; +}; in ivec2 aPosition; void main() { - vec2 position = mix(uRect.xy, uRect.zw, vec2(aPosition)) / uFramebufferSize * 2.0 - 1.0; + vec2 position = mix(rect.xy, rect.zw, vec2(aPosition)) / framebufferSize * 2.0 - 1.0; gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/shaders/debug_solid.fs.glsl b/shaders/debug_solid.fs.glsl index 5ceb65f9f..556449dee 100644 --- a/shaders/debug_solid.fs.glsl +++ b/shaders/debug_solid.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/debug_solid.fs.glsl // @@ -16,10 +16,12 @@ precision highp float; precision highp sampler2D; #endif -uniform vec4 uColor; +layout(set=0, binding=1) uniform uColor { + vec4 color; +}; out vec4 oFragColor; void main() { - oFragColor = vec4(uColor.rgb, 1.0) * uColor.a; + oFragColor = vec4(color.rgb, 1.0) * color.a; } diff --git a/shaders/debug_solid.vs.glsl b/shaders/debug_solid.vs.glsl index b10dde448..3bf49b72a 100644 --- a/shaders/debug_solid.vs.glsl +++ b/shaders/debug_solid.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/debug_solid.vs.glsl // @@ -16,11 +16,13 @@ precision highp float; precision highp sampler2D; #endif -uniform vec2 uFramebufferSize; +layout(set=0, binding=0) uniform uFramebufferSize { + vec2 framebufferSize; +}; in ivec2 aPosition; void main() { - vec2 position = vec2(aPosition) / uFramebufferSize * 2.0 - 1.0; + vec2 position = vec2(aPosition) / framebufferSize * 2.0 - 1.0; gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/shaders/debug_texture.fs.glsl b/shaders/debug_texture.fs.glsl index c01d386a0..bdffc15c0 100644 --- a/shaders/debug_texture.fs.glsl +++ b/shaders/debug_texture.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/debug_texture.fs.glsl // @@ -16,14 +16,17 @@ precision highp float; precision highp sampler2D; #endif -uniform sampler2D uTexture; -uniform vec4 uColor; +layout(set=0, binding=2) uniform texture2D uTexture; +layout(set=0, binding=3) uniform sampler uSampler; +layout(set=0, binding=4) uniform uColor { + vec4 color; +}; in vec2 vTexCoord; out vec4 oFragColor; void main() { - float alpha = texture(uTexture, vTexCoord).r * uColor.a; - oFragColor = alpha * vec4(uColor.rgb, 1.0); + float alpha = texture(sampler2D(uTexture, uSampler), vTexCoord).r * color.a; + oFragColor = alpha * vec4(color.rgb, 1.0); } diff --git a/shaders/debug_texture.vs.glsl b/shaders/debug_texture.vs.glsl index 2f918e294..0b9ac6b9d 100644 --- a/shaders/debug_texture.vs.glsl +++ b/shaders/debug_texture.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/debug_texture.vs.glsl // @@ -16,8 +16,12 @@ precision highp float; precision highp sampler2D; #endif -uniform vec2 uFramebufferSize; -uniform vec2 uTextureSize; +layout(set=0, binding=0) uniform uFramebufferSize { + vec2 framebufferSize; +}; +layout(set=0, binding=1) uniform uTextureSize { + vec2 textureSize; +}; in ivec2 aPosition; in ivec2 aTexCoord; @@ -25,7 +29,7 @@ in ivec2 aTexCoord; out vec2 vTexCoord; void main() { - vTexCoord = vec2(aTexCoord) / uTextureSize; - vec2 position = vec2(aPosition) / uFramebufferSize * 2.0 - 1.0; + vTexCoord = vec2(aTexCoord) / textureSize; + vec2 position = vec2(aPosition) / framebufferSize * 2.0 - 1.0; gl_Position = vec4(position.x, -position.y, 0.0, 1.0); } diff --git a/shaders/demo_ground.fs.glsl b/shaders/demo_ground.fs.glsl index edfbe1a27..86f197722 100644 --- a/shaders/demo_ground.fs.glsl +++ b/shaders/demo_ground.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/resources/shaders/demo_ground.fs.glsl // @@ -16,8 +16,12 @@ precision highp float; precision highp sampler2D; #endif -uniform vec4 uGroundColor; -uniform vec4 uGridlineColor; +layout(set=0, binding=2) uniform uGroundColor { + vec4 groundColor; +}; +layout(set=0, binding=3) uniform uGridlineColor { + vec4 gridlineColor; +}; in vec2 vTexCoord; @@ -25,5 +29,5 @@ out vec4 oFragColor; void main() { vec2 texCoordPx = fract(vTexCoord) / fwidth(vTexCoord); - oFragColor = any(lessThanEqual(texCoordPx, vec2(1.0))) ? uGridlineColor : uGroundColor; + oFragColor = any(lessThanEqual(texCoordPx, vec2(1.0))) ? gridlineColor : groundColor; } diff --git a/shaders/demo_ground.vs.glsl b/shaders/demo_ground.vs.glsl index 723d79dbd..2ee19ee2c 100644 --- a/shaders/demo_ground.vs.glsl +++ b/shaders/demo_ground.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/resources/shaders/demo_ground.vs.glsl // @@ -16,14 +16,18 @@ precision highp float; precision highp sampler2D; #endif -uniform mat4 uTransform; -uniform int uGridlineCount; +layout(set=0, binding=0) uniform uTransform { + mat4 transform; +}; +layout(set=0, binding=1) uniform uGridlineCount { + int gridlineCount; +}; in ivec2 aPosition; out vec2 vTexCoord; void main() { - vTexCoord = vec2(aPosition * uGridlineCount); - gl_Position = uTransform * vec4(ivec4(aPosition.x, 0, aPosition.y, 1)); + vTexCoord = vec2(aPosition * gridlineCount); + gl_Position = transform * vec4(ivec4(aPosition.x, 0, aPosition.y, 1)); } diff --git a/shaders/fill.cs.glsl b/shaders/fill.cs.glsl index 700c2946b..d03de8657 100644 --- a/shaders/fill.cs.glsl +++ b/shaders/fill.cs.glsl @@ -22,19 +22,22 @@ precision highp sampler2D; layout(local_size_x = 16, local_size_y = 4) in; -uniform writeonly image2D uDest; -uniform sampler2D uAreaLUT; -uniform int uFirstTileIndex; +layout (set=0, binding = 0) uniform writeonly image2D uDest; +layout (set=0, binding = 1) uniform texture2D uAreaLUT; +layout (set=0, binding = 2) uniform sampler uSampler; +layout (set=0, binding = 3) uniform uFirstTileIndex { + int firstTileIndex; +}; -layout(std430, binding = 0) buffer bFills { +layout(std430, set=0, binding = 4) buffer bFills { restrict readonly uvec2 iFills[]; }; -layout(std430, binding = 1) buffer bNextFills { +layout(std430, set=0, binding = 5) buffer bNextFills { restrict readonly int iNextFills[]; }; -layout(std430, binding = 2) buffer bFillTileMap { +layout(std430, set=0, binding = 6) buffer bFillTileMap { restrict readonly int iFillTileMap[]; }; @@ -42,7 +45,7 @@ void main() { ivec2 tileSubCoord = ivec2(gl_LocalInvocationID.xy) * ivec2(1, 4); uint tileIndexOffset = gl_WorkGroupID.z; - uint tileIndex = tileIndexOffset + uint(uFirstTileIndex); + uint tileIndex = tileIndexOffset + uint(firstTileIndex); int fillIndex = iFillTileMap[tileIndex]; if (fillIndex < 0) @@ -58,7 +61,7 @@ void main() { coverages += computeCoverage(from - (vec2(tileSubCoord) + vec2(0.5)), to - (vec2(tileSubCoord) + vec2(0.5)), - uAreaLUT); + uAreaLUT, uSampler); fillIndex = iNextFills[fillIndex]; } while (fillIndex >= 0); diff --git a/shaders/fill.fs.glsl b/shaders/fill.fs.glsl index 6ed65f9cc..74428d81a 100644 --- a/shaders/fill.fs.glsl +++ b/shaders/fill.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/fill.fs.glsl // @@ -20,7 +20,8 @@ precision highp sampler2D; #include "fill.inc.glsl" -uniform sampler2D uAreaLUT; +layout(set=0, binding=2) uniform texture2D uAreaLUT; +layout(set=0, binding=3) uniform sampler uSampler; in vec2 vFrom; in vec2 vTo; @@ -28,5 +29,5 @@ in vec2 vTo; out vec4 oFragColor; void main() { - oFragColor = computeCoverage(vFrom, vTo, uAreaLUT); + oFragColor = computeCoverage(vFrom, vTo, uAreaLUT, uSampler); } diff --git a/shaders/fill.inc.glsl b/shaders/fill.inc.glsl index c22125ae8..5f0f68768 100644 --- a/shaders/fill.inc.glsl +++ b/shaders/fill.inc.glsl @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT) { +vec4 computeCoverage(vec2 from, vec2 to, texture2D areaLUT, sampler areaLUTSampler) { // Determine winding, and sort into a consistent order so we only need to find one root below. vec2 left = from.x < to.x ? from : to, right = from.x < to.x ? to : from; @@ -23,5 +23,5 @@ vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT) { // Look up area under that line, and scale horizontally to the window size. float dX = window.x - window.y; - return texture(areaLUT, vec2(y + 8.0, abs(d * dX)) / 16.0) * dX; + return texture(sampler2D(areaLUT, areaLUTSampler), vec2(y + 8.0, abs(d * dX)) / 16.0) * dX; } diff --git a/shaders/fill.vs.glsl b/shaders/fill.vs.glsl index d513b5efd..7e41f4c74 100644 --- a/shaders/fill.vs.glsl +++ b/shaders/fill.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/fill.vs.glsl // @@ -16,8 +16,12 @@ precision highp float; precision highp sampler2D; #endif -uniform vec2 uFramebufferSize; -uniform vec2 uTileSize; +layout(std140, set=0, binding=0) uniform uFramebufferSize { + vec2 framebufferSize; +}; +layout(std140, set=0, binding=1) uniform uTileSize { + vec2 tileSize; +}; in uvec2 aTessCoord; in uint aFromPx; @@ -30,13 +34,13 @@ out vec2 vFrom; out vec2 vTo; vec2 computeTileOffset(uint tileIndex, float stencilTextureWidth) { - uint tilesPerRow = uint(stencilTextureWidth / uTileSize.x); + uint tilesPerRow = uint(stencilTextureWidth / tileSize.x); uvec2 tileOffset = uvec2(tileIndex % tilesPerRow, tileIndex / tilesPerRow); - return vec2(tileOffset) * uTileSize * vec2(1.0, 0.25); + return vec2(tileOffset) * tileSize * vec2(1.0, 0.25); } void main() { - vec2 tileOrigin = computeTileOffset(aTileIndex, uFramebufferSize.x); + vec2 tileOrigin = computeTileOffset(aTileIndex, framebufferSize.x); vec2 from = vec2(aFromPx & 15u, aFromPx >> 4u) + aFromSubpx; vec2 to = vec2(aToPx & 15u, aToPx >> 4u) + aToSubpx; @@ -49,7 +53,7 @@ void main() { if (aTessCoord.y == 0u) position.y = floor(min(from.y, to.y)); else - position.y = uTileSize.y; + position.y = tileSize.y; position.y = floor(position.y * 0.25); // Since each fragment corresponds to 4 pixels on a scanline, the varying interpolation will @@ -60,7 +64,7 @@ void main() { vFrom = from + offset; vTo = to + offset; - vec2 globalPosition = (tileOrigin + position) / uFramebufferSize * 2.0 - 1.0; + vec2 globalPosition = (tileOrigin + position) / framebufferSize * 2.0 - 1.0; #ifdef PF_ORIGIN_UPPER_LEFT globalPosition.y = -globalPosition.y; #endif diff --git a/shaders/reproject.fs.glsl b/shaders/reproject.fs.glsl index 81d3e0eb8..ef604ff20 100644 --- a/shaders/reproject.fs.glsl +++ b/shaders/reproject.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/reproject.fs.glsl // @@ -16,15 +16,18 @@ precision highp float; precision highp sampler2D; #endif -uniform mat4 uOldTransform; -uniform sampler2D uTexture; +layout(set=0, binding=1) uniform uOldTransform { + mat4 oldTransform; +}; +layout(set=0, binding=2) uniform texture2D uTexture; +layout(set=0, binding=3) uniform sampler uSampler; in vec2 vTexCoord; out vec4 oFragColor; void main() { - vec4 normTexCoord = uOldTransform * vec4(vTexCoord, 0.0, 1.0); + vec4 normTexCoord = oldTransform * vec4(vTexCoord, 0.0, 1.0); vec2 texCoord = ((normTexCoord.xy / normTexCoord.w) + 1.0) * 0.5; - oFragColor = texture(uTexture, texCoord); + oFragColor = texture(sampler2D(uTexture, uSampler), texCoord); } diff --git a/shaders/reproject.vs.glsl b/shaders/reproject.vs.glsl index 9c5f7f2ac..a1385be72 100644 --- a/shaders/reproject.vs.glsl +++ b/shaders/reproject.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/reproject.vs.glsl // @@ -16,7 +16,9 @@ precision highp float; precision highp sampler2D; #endif -uniform mat4 uNewTransform; +layout(set=0, binding=0) uniform uNewTransform { + mat4 newTransform; +}; in ivec2 aPosition; @@ -30,5 +32,5 @@ void main() { // FIXME(pcwalton): This is wrong. position.y = 1.0 - position.y; #endif - gl_Position = uNewTransform * vec4(position, 0.0, 1.0); + gl_Position = newTransform * vec4(position, 0.0, 1.0); } diff --git a/shaders/stencil.fs.glsl b/shaders/stencil.fs.glsl index a3ab4d066..5522e683e 100644 --- a/shaders/stencil.fs.glsl +++ b/shaders/stencil.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/stencil.fs.glsl // diff --git a/shaders/stencil.vs.glsl b/shaders/stencil.vs.glsl index 0f66d5304..802635ee8 100644 --- a/shaders/stencil.vs.glsl +++ b/shaders/stencil.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/stencil.vs.glsl // diff --git a/shaders/tile.fs.glsl b/shaders/tile.fs.glsl index 487fcb5cd..3d5a604c5 100644 --- a/shaders/tile.fs.glsl +++ b/shaders/tile.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/tile.fs.glsl // @@ -81,17 +81,33 @@ precision highp sampler2D; #define COMBINER_CTRL_COLOR_COMBINE_SHIFT 6 #define COMBINER_CTRL_COMPOSITE_SHIFT 8 -uniform sampler2D uColorTexture0; -uniform sampler2D uMaskTexture0; -uniform sampler2D uDestTexture; -uniform sampler2D uGammaLUT; -uniform vec2 uColorTextureSize0; -uniform vec2 uMaskTextureSize0; -uniform vec4 uFilterParams0; -uniform vec4 uFilterParams1; -uniform vec4 uFilterParams2; -uniform vec2 uFramebufferSize; -uniform int uCtrl; +layout(set=1, binding=0) uniform sampler uSampler; +layout(set=1, binding=1) uniform texture2D uColorTexture0; +layout(set=1, binding=2) uniform texture2D uMaskTexture0; +layout(set=1, binding=3) uniform texture2D uDestTexture; +layout(set=1, binding=4) uniform texture2D uGammaLUT; + +layout(set=2, binding=0) uniform uColorTextureSize0 { + vec2 iColorTextureSize0; +}; +layout(set=2, binding=1) uniform uMaskTextureSize0 { + vec2 iMaskTextureSize0; +}; +layout(set=2, binding=2) uniform uFilterParams0 { + vec4 iFilterParams0; +}; +layout(set=2, binding=3) uniform uFilterParams1 { + vec4 iFilterParams1; +}; +layout(set=2, binding=4) uniform uFilterParams2 { + vec4 iFilterParams2; +}; +layout(set=2, binding=5) uniform uFramebufferSize { + vec2 iFramebufferSize; +}; +layout(set=2, binding=6) uniform uCtrl { + int iCtrl; +}; in vec3 vMaskTexCoord0; in vec2 vColorTexCoord0; @@ -102,8 +118,8 @@ out vec4 oFragColor; // Color sampling -vec4 sampleColor(sampler2D colorTexture, vec2 colorTexCoord) { - return texture(colorTexture, colorTexCoord); +vec4 sampleColor(texture2D colorTexture, vec2 colorTexCoord) { + return texture(sampler2D(colorTexture, uSampler), colorTexCoord); } // Color combining @@ -120,15 +136,15 @@ vec4 combineColor0(vec4 destColor, vec4 srcColor, int op) { // Text filter -float filterTextSample1Tap(float offset, sampler2D colorTexture, vec2 colorTexCoord) { - return texture(colorTexture, colorTexCoord + vec2(offset, 0.0)).r; +float filterTextSample1Tap(float offset, texture2D colorTexture, vec2 colorTexCoord) { + return texture(sampler2D(colorTexture, uSampler), colorTexCoord + vec2(offset, 0.0)).r; } // Samples 9 taps around the current pixel. void filterTextSample9Tap(out vec4 outAlphaLeft, out float outAlphaCenter, out vec4 outAlphaRight, - sampler2D colorTexture, + texture2D colorTexture, vec2 colorTexCoord, vec4 kernel, float onePixel) { @@ -150,12 +166,12 @@ float filterTextConvolve7Tap(vec4 alpha0, vec3 alpha1, vec4 kernel) { return dot(alpha0, kernel) + dot(alpha1, kernel.zyx); } -float filterTextGammaCorrectChannel(float bgColor, float fgColor, sampler2D gammaLUT) { - return texture(gammaLUT, vec2(fgColor, 1.0 - bgColor)).r; +float filterTextGammaCorrectChannel(float bgColor, float fgColor, texture2D gammaLUT) { + return texture(sampler2D(gammaLUT, uSampler), vec2(fgColor, 1.0 - bgColor)).r; } // `fgColor` is in linear space. -vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, sampler2D gammaLUT) { +vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, texture2D gammaLUT) { return vec3(filterTextGammaCorrectChannel(bgColor.r, fgColor.r, gammaLUT), filterTextGammaCorrectChannel(bgColor.g, fgColor.g, gammaLUT), filterTextGammaCorrectChannel(bgColor.b, fgColor.b, gammaLUT)); @@ -167,8 +183,8 @@ vec3 filterTextGammaCorrect(vec3 bgColor, vec3 fgColor, sampler2D gammaLUT) { // filterParams1 | bgColor.r bgColor.g bgColor.b - // filterParams2 | fgColor.r fgColor.g fgColor.b gammaCorrectionEnabled vec4 filterText(vec2 colorTexCoord, - sampler2D colorTexture, - sampler2D gammaLUT, + texture2D colorTexture, + texture2D gammaLUT, vec2 colorTextureSize, vec4 filterParams0, vec4 filterParams1, @@ -182,7 +198,7 @@ vec4 filterText(vec2 colorTexCoord, // Apply defringing if necessary. vec3 alpha; if (kernel.w == 0.0) { - alpha = texture(colorTexture, colorTexCoord).rrr; + alpha = texture(sampler2D(colorTexture, uSampler), colorTexCoord).rrr; } else { vec4 alphaLeft, alphaRight; float alphaCenter; @@ -302,7 +318,7 @@ vec4 filterText(vec2 colorTexCoord, // filterParams1 | radii.x radii.y uvOrigin.x uvOrigin.y // filterParams2 | - - - - vec4 filterRadialGradient(vec2 colorTexCoord, - sampler2D colorTexture, + texture2D colorTexture, vec2 colorTextureSize, vec2 fragCoord, vec2 framebufferSize, @@ -325,7 +341,7 @@ vec4 filterRadialGradient(vec2 colorTexCoord, if (ts.x > ts.y) ts = ts.yx; float t = ts.x >= 0.0 ? ts.x : ts.y; - color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); + color = texture(sampler2D(colorTexture, uSampler), uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); } return color; @@ -337,7 +353,7 @@ vec4 filterRadialGradient(vec2 colorTexCoord, // filterParams1 | gaussCoeff.x gaussCoeff.y gaussCoeff.z - // filterParams2 | - - - - vec4 filterBlur(vec2 colorTexCoord, - sampler2D colorTexture, + texture2D colorTexture, vec2 colorTextureSize, vec4 filterParams0, vec4 filterParams1) { @@ -348,7 +364,7 @@ vec4 filterBlur(vec2 colorTexCoord, // Set up our incremental calculation. float gaussSum = gaussCoeff.x; - vec4 color = texture(colorTexture, colorTexCoord) * gaussCoeff.x; + vec4 color = texture(sampler2D(colorTexture, uSampler), colorTexCoord) * gaussCoeff.x; gaussCoeff.xy *= gaussCoeff.yz; // This is a common trick that lets us use the texture filtering hardware to evaluate two @@ -365,8 +381,8 @@ vec4 filterBlur(vec2 colorTexCoord, gaussPartialSum += gaussCoeff.x; vec2 srcOffset = srcOffsetScale * (float(i) + gaussCoeff.x / gaussPartialSum); - color += (texture(colorTexture, colorTexCoord - srcOffset) + - texture(colorTexture, colorTexCoord + srcOffset)) * gaussPartialSum; + color += (texture(sampler2D(colorTexture, uSampler), colorTexCoord - srcOffset) + + texture(sampler2D(colorTexture, uSampler), colorTexCoord + srcOffset)) * gaussPartialSum; gaussSum += 2.0 * gaussPartialSum; gaussCoeff.xy *= gaussCoeff.yz; @@ -376,13 +392,13 @@ vec4 filterBlur(vec2 colorTexCoord, return color / gaussSum; } -vec4 filterNone(vec2 colorTexCoord, sampler2D colorTexture) { +vec4 filterNone(vec2 colorTexCoord, texture2D colorTexture) { return sampleColor(colorTexture, colorTexCoord); } vec4 filterColor(vec2 colorTexCoord, - sampler2D colorTexture, - sampler2D gammaLUT, + texture2D colorTexture, + texture2D gammaLUT, vec2 colorTextureSize, vec2 fragCoord, vec2 framebufferSize, @@ -525,7 +541,7 @@ vec3 compositeRGB(vec3 destColor, vec3 srcColor, int op) { } vec4 composite(vec4 srcColor, - sampler2D destTexture, + texture2D destTexture, vec2 destTextureSize, vec2 fragCoord, int op) { @@ -534,7 +550,7 @@ vec4 composite(vec4 srcColor, // FIXME(pcwalton): What should the output alpha be here? vec2 destTexCoord = fragCoord / destTextureSize; - vec4 destColor = texture(destTexture, destTexCoord); + vec4 destColor = texture(sampler2D(destTexture, uSampler), destTexCoord); vec3 blendedRGB = compositeRGB(destColor.rgb, srcColor.rgb, op); return vec4(srcColor.a * (1.0 - destColor.a) * srcColor.rgb + srcColor.a * destColor.a * blendedRGB + @@ -545,7 +561,7 @@ vec4 composite(vec4 srcColor, // Masks float sampleMask(float maskAlpha, - sampler2D maskTexture, + texture2D maskTexture, vec2 maskTextureSize, vec3 maskTexCoord, int maskCtrl) { @@ -553,7 +569,7 @@ float sampleMask(float maskAlpha, return maskAlpha; ivec2 maskTexCoordI = ivec2(floor(maskTexCoord.xy)); - vec4 texel = texture(maskTexture, (vec2(maskTexCoordI / ivec2(1, 4)) + 0.5) / maskTextureSize); + vec4 texel = texture(sampler2D(maskTexture, uSampler), (vec2(maskTexCoordI / ivec2(1, 4)) + 0.5) / maskTextureSize); float coverage = texel[maskTexCoordI.y % 4] + maskTexCoord.z; if ((maskCtrl & TILE_CTRL_MASK_WINDING) != 0) @@ -569,7 +585,7 @@ void calculateColor(int tileCtrl, int ctrl) { // Sample mask. int maskCtrl0 = (tileCtrl >> TILE_CTRL_MASK_0_SHIFT) & TILE_CTRL_MASK_MASK; float maskAlpha = 1.0; - maskAlpha = sampleMask(maskAlpha, uMaskTexture0, uMaskTextureSize0, vMaskTexCoord0, maskCtrl0); + maskAlpha = sampleMask(maskAlpha, uMaskTexture0, iMaskTextureSize0, vMaskTexCoord0, maskCtrl0); // Sample color. vec4 color = vBaseColor; @@ -580,12 +596,12 @@ void calculateColor(int tileCtrl, int ctrl) { vec4 color0 = filterColor(vColorTexCoord0, uColorTexture0, uGammaLUT, - uColorTextureSize0, + iColorTextureSize0, gl_FragCoord.xy, - uFramebufferSize, - uFilterParams0, - uFilterParams1, - uFilterParams2, + iFramebufferSize, + iFilterParams0, + iFilterParams1, + iFilterParams2, color0Filter); color = combineColor0(color, color0, color0Combine); } @@ -595,7 +611,7 @@ void calculateColor(int tileCtrl, int ctrl) { // Apply composite. int compositeOp = (ctrl >> COMBINER_CTRL_COMPOSITE_SHIFT) & COMBINER_CTRL_COMPOSITE_MASK; - color = composite(color, uDestTexture, uFramebufferSize, gl_FragCoord.xy, compositeOp); + color = composite(color, uDestTexture, iFramebufferSize, gl_FragCoord.xy, compositeOp); // Premultiply alpha. color.rgb *= color.a; @@ -607,5 +623,5 @@ void calculateColor(int tileCtrl, int ctrl) { // TODO(pcwalton): Generate this dynamically. void main() { - calculateColor(int(vTileCtrl), uCtrl); + calculateColor(int(vTileCtrl), iCtrl); } diff --git a/shaders/tile.vs.glsl b/shaders/tile.vs.glsl index 3366e1297..5d817c925 100644 --- a/shaders/tile.vs.glsl +++ b/shaders/tile.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/tile.vs.glsl // @@ -16,10 +16,17 @@ precision highp float; precision highp sampler2D; #endif -uniform mat4 uTransform; -uniform vec2 uTileSize; -uniform sampler2D uTextureMetadata; -uniform ivec2 uTextureMetadataSize; +layout(set=0, binding=0) uniform uTransform { + mat4 transform; +}; +layout(set=0, binding=1) uniform uTileSize { + vec2 tileSize; +}; +layout(set=0, binding=2) uniform texture2D uTextureMetadata; +layout(set=0, binding=3) uniform sampler uSampler; +layout(set=0, binding=4) uniform uTextureMetadataSize { + ivec2 textureMetadataSize; +}; in ivec2 aTileOffset; in ivec2 aTileOrigin; @@ -35,22 +42,22 @@ out float vTileCtrl; void main() { vec2 tileOrigin = vec2(aTileOrigin), tileOffset = vec2(aTileOffset); - vec2 position = (tileOrigin + tileOffset) * uTileSize; + vec2 position = (tileOrigin + tileOffset) * tileSize; - vec2 maskTexCoord0 = (vec2(aMaskTexCoord0) + tileOffset) * uTileSize; + vec2 maskTexCoord0 = (vec2(aMaskTexCoord0) + tileOffset) * tileSize; - vec2 textureMetadataScale = vec2(1.0) / vec2(uTextureMetadataSize); + vec2 textureMetadataScale = vec2(1.0) / vec2(textureMetadataSize); vec2 metadataEntryCoord = vec2(aColor % 128 * 4, aColor / 128); vec2 colorTexMatrix0Coord = (metadataEntryCoord + vec2(0.5, 0.5)) * textureMetadataScale; vec2 colorTexOffsetsCoord = (metadataEntryCoord + vec2(1.5, 0.5)) * textureMetadataScale; vec2 baseColorCoord = (metadataEntryCoord + vec2(2.5, 0.5)) * textureMetadataScale; - vec4 colorTexMatrix0 = texture(uTextureMetadata, colorTexMatrix0Coord); - vec4 colorTexOffsets = texture(uTextureMetadata, colorTexOffsetsCoord); - vec4 baseColor = texture(uTextureMetadata, baseColorCoord); + vec4 colorTexMatrix0 = texture(sampler2D(uTextureMetadata, uSampler), colorTexMatrix0Coord); + vec4 colorTexOffsets = texture(sampler2D(uTextureMetadata, uSampler), colorTexOffsetsCoord); + vec4 baseColor = texture(sampler2D(uTextureMetadata, uSampler), baseColorCoord); vColorTexCoord0 = mat2(colorTexMatrix0) * position + colorTexOffsets.xy; vMaskTexCoord0 = vec3(maskTexCoord0, float(aMaskBackdrop.x)); vBaseColor = baseColor; vTileCtrl = float(aTileCtrl); - gl_Position = uTransform * vec4(position, 0.0, 1.0); + gl_Position = transform * vec4(position, 0.0, 1.0); } diff --git a/shaders/tile_clip.fs.glsl b/shaders/tile_clip.fs.glsl index e6c7b6ada..352548561 100644 --- a/shaders/tile_clip.fs.glsl +++ b/shaders/tile_clip.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/tile_clip.fs.glsl // @@ -16,7 +16,8 @@ precision highp float; precision highp sampler2D; #endif -uniform sampler2D uSrc; +layout(set=0, binding=0) uniform texture2D uSrc; +layout(set=0, binding=1) uniform sampler uSampler; in vec2 vTexCoord; in float vBackdrop; @@ -24,5 +25,5 @@ in float vBackdrop; out vec4 oFragColor; void main() { - oFragColor = clamp(abs(texture(uSrc, vTexCoord) + vBackdrop), 0.0, 1.0); + oFragColor = clamp(abs(texture(sampler2D(uSrc, uSampler), vTexCoord) + vBackdrop), 0.0, 1.0); } diff --git a/shaders/tile_clip.vs.glsl b/shaders/tile_clip.vs.glsl index 47186462c..b0c19a704 100644 --- a/shaders/tile_clip.vs.glsl +++ b/shaders/tile_clip.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/tile_clip.vs.glsl // diff --git a/shaders/tile_copy.fs.glsl b/shaders/tile_copy.fs.glsl index bad183c0b..4494995c1 100644 --- a/shaders/tile_copy.fs.glsl +++ b/shaders/tile_copy.fs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/tile_copy.fs.glsl // @@ -16,12 +16,15 @@ precision highp float; precision highp sampler2D; #endif -uniform vec2 uFramebufferSize; -uniform sampler2D uSrc; +layout(set=0, binding=2) uniform uFramebufferSize { + vec2 framebufferSize; +}; +layout(set=0, binding=3) uniform texture2D uSrc; +layout(set=0, binding=4) uniform sampler uSampler; out vec4 oFragColor; void main() { - vec2 texCoord = gl_FragCoord.xy / uFramebufferSize; - oFragColor = texture(uSrc, texCoord); + vec2 texCoord = gl_FragCoord.xy / framebufferSize; + oFragColor = texture(sampler2D(uSrc, uSampler), texCoord); } diff --git a/shaders/tile_copy.vs.glsl b/shaders/tile_copy.vs.glsl index 6b9971d23..5b0515c32 100644 --- a/shaders/tile_copy.vs.glsl +++ b/shaders/tile_copy.vs.glsl @@ -1,4 +1,4 @@ -#version 330 +#version 450 // pathfinder/shaders/tile_copy.vs.glsl // @@ -16,12 +16,16 @@ precision highp float; precision highp sampler2D; #endif -uniform mat4 uTransform; -uniform vec2 uTileSize; +layout(set=0, binding=0) uniform uTransform { + mat4 transform; +}; +layout(set=0, binding=1) uniform uTileSize { + vec2 tileSize; +}; in ivec2 aTilePosition; void main() { - vec2 position = vec2(aTilePosition) * uTileSize; - gl_Position = uTransform * vec4(position, 0.0, 1.0); + vec2 position = vec2(aTilePosition) * tileSize; + gl_Position = transform * vec4(position, 0.0, 1.0); }