Files
Towards/external/loft/examples/viewer/shaders/Upsample.frag.spirv
T

92 lines
9.9 KiB
Plaintext
Raw Normal View History

2026-07-18 14:31:15 +02:00
# A
SPV_KHR_non_semantic_info NonSemantic.Shader.DebugInfo.100 GLSL.std.450main2/home/martin/projects/loft/examples/viewer/shaders/Upsample.fraguintfloatupscaleö// OpModuleProcessed client vulkan100
// OpModuleProcessed target-env vulkan1.0
// OpModuleProcessed entry-point main
#line 1
#version 450
layout(location = 0) out vec4 fragColor;
layout(location = 0) in vec2 inUV;
layout(set = 1, binding = 0) uniform sampler2D source;
layout(set = 1, binding = 1) uniform sampler2D upscaled;
layout( push_constant ) uniform constants
{
ivec2 resolution;
} PushConstants;
/* ? - e - ?
* | a | b |
* f - ? - g
* | c | d |
* ? - h - ?
*/
vec4 upscale() {
vec2 srcTexelSize = 1.0f / PushConstants.resolution * 2.0f;
float x = srcTexelSize.x;
float y = srcTexelSize.y;
vec3 color = vec3(0.0f);
vec3 a = texture(upscaled, vec2(inUV.x - x, inUV.y + y)).rgb;
vec3 b = texture(upscaled, vec2(inUV.x + x, inUV.y + y)).rgb;
vec3 c = texture(upscaled, vec2(inUV.x - x, inUV.y - y)).rgb;
vec3 d = texture(upscaled, vec2(inUV.x + x, inUV.y - y)).rgb;
vec3 e = texture(upscaled, vec2(inUV.x, inUV.y + 2.0*y)).rgb;
vec3 h = texture(upscaled, vec2(inUV.x, inUV.y - 2.0*y)).rgb;
vec3 f = texture(upscaled, vec2(inUV.x - 2.0*x, inUV.y)).rgb;
vec3 g = texture(upscaled, vec2(inUV.x + 2.0*x, inUV.y)).rgb;
return vec4((a + b + c + d) * (1.0f/6.0f) + (e + f + g + h) * (1.0f/12.0f), 1.0);
/* vec3
color = texture(upscaled, vec2(inUV.x + x, inUV.y + y)).rgb;
color += texture(upscaled, vec2(inUV.x + x, inUV.y - y)).rgb;
color += texture(upscaled, vec2(inUV.x - x, inUV.y + y)).rgb;
color += texture(upscaled, vec2(inUV.x - x, inUV.y - y)).rgb;
color += 2.0f * texture(upscaled, vec2(inUV.x + x, inUV.y)).rgb;
color += 2.0f * texture(upscaled, vec2(inUV.x - x, inUV.y)).rgb;
color += 2.0f * texture(upscaled, vec2(inUV.x, inUV.y + y)).rgb;
color += 2.0f * texture(upscaled, vec2(inUV.x, inUV.y - y)).rgb;
color += 4.0f * texture(upscaled, inUV).rgb;
return vec4(color * (1.0f / 16.0f), 1.0f); */
}
void main() {
fragColor = texture(source, inUV) + upscale();
}"main/srcTexelSize6int<resolution?constantsEPushConstantsUx]yicolorqawtype.2d.imagex@type.2d.image|type.sampled.image}@type.sampled.imageupscaledˆinUV˜bªc¼dÎeÞhïfg4fragColor8sourcemainupscale(-srcTexelSize:constants:resolutionCPushConstantsSx[ygcoloroaupscaledinUVb¨cºdÌeÜhífþg2fragColor6sourceG:H:#G!G"GG2G6!G6"! +
+ +  
+
 
 
+ ! 
 #++ +!  !  
+$8 #"$ "
$( )! *(++ ,)+ +0 ./)0  2+4€?5  76
 85 97!:8+=
; <9==
>
? 0 ?
; @ :+A B>A ;@C +F DE>0 ECF+5G H 8 I9A +O@ Q R+ +V TUV +^ \]^ c d
ec fd+ +j hidj +m,cnmmm+r pqdr  u y v
w r xy
zu {
| r }y
~z { ;~ {r F ( ) ; ˆ)r ˆF  Š + ˜d +« ©ªd« +½ »¼d½  ÍÎd
+ß! ÝÞdß +ð# îïdð +$ ÿd +&+«ª*>+!«ªª=+,6 0 1
;02+59 345 42F;~6 78{5 86F+@:6ø .#
/g$$ -e#
:g55 =z96=(;W<9;9=><=>2>
?g@@ ý86ø;*-;QS;Q[;eg;eo;e;e¨;eº;eÌ;eÜ;eí;eþ &
'g %e
3g00 1.-2AHJCG=8KJo(LKP(M44ˆ(NMLŽ(PNO>-P
XgVV WTS2AQY- =ZY>SZ
`g^^ _\[2AQa- =ba>[b
lgjj khg2>gn