770 lines
44 KiB
Plaintext
770 lines
44 KiB
Plaintext
/*
|
|
#version:1# (machine generated, don't edit!)
|
|
|
|
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
|
|
|
Cmdline:
|
|
sokol-shdc -i shader_ssao.glsl -o ./jai/shader_ssao.jai -l glsl430:glsl300es:metal_macos -f sokol_jai
|
|
|
|
Overview:
|
|
=========
|
|
Shader program: 'ssao':
|
|
Get shader desc: ssao_shader_desc(sg_query_backend())
|
|
Vertex Shader: vs_ssao
|
|
Fragment Shader: fs_ssao
|
|
Attributes:
|
|
ATTR_ssao_position => 0
|
|
ATTR_ssao_uv => 1
|
|
Bindings:
|
|
Uniform block 'ssao_fs_params':
|
|
Jai struct: Ssao_Fs_Params
|
|
Bind slot: UB_ssao_fs_params => 1
|
|
Image 'g_position':
|
|
Image type: ._2D
|
|
Sample type: .FLOAT
|
|
Multisampled: false
|
|
Bind slot: IMG_g_position => 0
|
|
Image 'g_normal':
|
|
Image type: ._2D
|
|
Sample type: .FLOAT
|
|
Multisampled: false
|
|
Bind slot: IMG_g_normal => 1
|
|
Image 'tex_noise':
|
|
Image type: ._2D
|
|
Sample type: .FLOAT
|
|
Multisampled: false
|
|
Bind slot: IMG_tex_noise => 2
|
|
Sampler 'ssao_smp':
|
|
Type: .FILTERING
|
|
Bind slot: SMP_ssao_smp => 0
|
|
*/
|
|
ATTR_ssao_position :: 0;
|
|
ATTR_ssao_uv :: 1;
|
|
UB_ssao_fs_params :: 1;
|
|
IMG_g_position :: 0;
|
|
IMG_g_normal :: 1;
|
|
IMG_tex_noise :: 2;
|
|
SMP_ssao_smp :: 0;
|
|
Ssao_Fs_Params :: struct {
|
|
projection: [16]float;
|
|
samples: [64][4]float;
|
|
ssao_power: float;
|
|
_: [12]u8;
|
|
};
|
|
/*
|
|
#version 430
|
|
|
|
layout(location = 0) in vec2 position;
|
|
layout(location = 0) out vec2 quad_uv;
|
|
layout(location = 1) in vec2 uv;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = vec4(position, 0.0, 1.0);
|
|
quad_uv = uv;
|
|
}
|
|
|
|
*/
|
|
vs_ssao_source_glsl430 := u8.[
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61,
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,
|
|
0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
|
|
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,
|
|
0x63,0x32,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
|
|
0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,
|
|
0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,
|
|
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,
|
|
0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,
|
|
0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x71,0x75,0x61,0x64,
|
|
0x5f,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
];
|
|
/*
|
|
#version 430
|
|
|
|
vec4 _220;
|
|
|
|
uniform vec4 ssao_fs_params[69];
|
|
layout(binding = 16) uniform sampler2D g_position_ssao_smp;
|
|
layout(binding = 17) uniform sampler2D g_normal_ssao_smp;
|
|
layout(binding = 18) uniform sampler2D tex_noise_ssao_smp;
|
|
|
|
layout(location = 0) in vec2 quad_uv;
|
|
layout(location = 0) out vec4 out_color;
|
|
|
|
void main()
|
|
{
|
|
vec3 _26 = texture(g_position_ssao_smp, quad_uv).xyz;
|
|
vec3 _35 = normalize(texture(g_normal_ssao_smp, quad_uv).xyz);
|
|
vec3 _51 = normalize(texture(tex_noise_ssao_smp, quad_uv * vec2(480.0, 270.0)).xyz);
|
|
vec3 _60 = normalize(_51 - (_35 * dot(_51, _35)));
|
|
mat3 _85 = mat3(_60, cross(_35, _60), _35);
|
|
float occlusion = 0.0;
|
|
for (int i = 0; i < 64; i++)
|
|
{
|
|
vec3 _121 = _26 + ((_85 * ssao_fs_params[i * 1 + 4].xyz) * 0.5);
|
|
vec4 _133 = mat4(ssao_fs_params[0], ssao_fs_params[1], ssao_fs_params[2], ssao_fs_params[3]) * vec4(_121, 1.0);
|
|
vec3 _140 = _133.xyz / vec3(_133.w);
|
|
vec4 _204;
|
|
_204.x = _140.x;
|
|
_204.y = _140.y;
|
|
vec3 _154 = (_204.xyz * 0.5) + vec3(0.5);
|
|
vec4 _210;
|
|
_210.x = _154.x;
|
|
_210.y = _154.y;
|
|
vec4 _167 = texture(g_position_ssao_smp, _210.xy);
|
|
if (length(_167.xyz) > 0.00999999977648258209228515625)
|
|
{
|
|
occlusion += float(_167.z >= _121.z);
|
|
}
|
|
}
|
|
float _185 = occlusion;
|
|
float _188 = 1.0 - (_185 * 0.015625);
|
|
occlusion = _188;
|
|
float _196 = pow(_188, ssao_fs_params[68].x);
|
|
out_color = vec4(_196, _196, _196, 1.0);
|
|
}
|
|
|
|
*/
|
|
fs_ssao_source_glsl430 := u8.[
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x76,0x65,
|
|
0x63,0x34,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,
|
|
0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,
|
|
0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x39,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
|
|
0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,
|
|
0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,
|
|
0x44,0x20,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,
|
|
0x6f,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,
|
|
0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x37,0x29,0x20,0x75,0x6e,0x69,0x66,
|
|
0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x67,0x5f,
|
|
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x3b,
|
|
0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,
|
|
0x3d,0x20,0x31,0x38,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,
|
|
0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,0x73,
|
|
0x65,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,
|
|
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
|
|
0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,
|
|
0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
|
|
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
|
|
0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
|
|
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,
|
|
0x65,0x63,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,
|
|
0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,
|
|
0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,
|
|
0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,
|
|
0x35,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,
|
|
0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x73,
|
|
0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,
|
|
0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,
|
|
0x20,0x5f,0x35,0x31,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
|
|
0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,
|
|
0x73,0x65,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,
|
|
0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x34,0x38,0x30,0x2e,
|
|
0x30,0x2c,0x20,0x32,0x37,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,
|
|
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20,
|
|
0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20,
|
|
0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x74,0x33,
|
|
0x20,0x5f,0x38,0x35,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x5f,0x36,0x30,0x2c,
|
|
0x20,0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,
|
|
0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x2e,
|
|
0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,
|
|
0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x36,0x34,0x3b,0x20,0x69,
|
|
0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x32,0x31,0x20,0x3d,0x20,0x5f,0x32,
|
|
0x36,0x20,0x2b,0x20,0x28,0x28,0x5f,0x38,0x35,0x20,0x2a,0x20,0x73,0x73,0x61,0x6f,
|
|
0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x69,0x20,0x2a,0x20,0x31,
|
|
0x20,0x2b,0x20,0x34,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,
|
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,
|
|
0x5f,0x31,0x33,0x33,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x73,0x73,0x61,0x6f,
|
|
0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x73,
|
|
0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,
|
|
0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
|
0x5b,0x32,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,
|
|
0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,
|
|
0x31,0x32,0x31,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x34,0x30,0x20,0x3d,0x20,0x5f,
|
|
0x31,0x33,0x33,0x2e,0x78,0x79,0x7a,0x20,0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,
|
|
0x31,0x33,0x33,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x30,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x5f,0x32,0x30,0x34,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,
|
|
0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x30,0x34,
|
|
0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x35,0x34,0x20,0x3d,
|
|
0x20,0x28,0x5f,0x32,0x30,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,
|
|
0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x31,0x30,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x31,0x30,0x2e,0x78,
|
|
0x20,0x3d,0x20,0x5f,0x31,0x35,0x34,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x5f,0x32,0x31,0x30,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x35,0x34,
|
|
0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,
|
|
0x20,0x5f,0x31,0x36,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,
|
|
0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,
|
|
0x73,0x6d,0x70,0x2c,0x20,0x5f,0x32,0x31,0x30,0x2e,0x78,0x79,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x6c,0x65,0x6e,0x67,0x74,
|
|
0x68,0x28,0x5f,0x31,0x36,0x37,0x2e,0x78,0x79,0x7a,0x29,0x20,0x3e,0x20,0x30,0x2e,
|
|
0x30,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,
|
|
0x38,0x32,0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x2b,
|
|
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,0x36,0x37,0x2e,0x7a,0x20,0x3e,
|
|
0x3d,0x20,0x5f,0x31,0x32,0x31,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x35,0x20,0x3d,0x20,0x6f,0x63,0x63,0x6c,
|
|
0x75,0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x5f,0x31,0x38,0x38,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,
|
|
0x31,0x38,0x35,0x20,0x2a,0x20,0x30,0x2e,0x30,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,
|
|
0x20,0x5f,0x31,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x5f,0x31,0x39,0x36,0x20,0x3d,0x20,0x70,0x6f,0x77,0x28,0x5f,0x31,0x38,0x38,
|
|
0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
|
0x5b,0x36,0x38,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
|
|
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,
|
|
0x39,0x36,0x2c,0x20,0x5f,0x31,0x39,0x36,0x2c,0x20,0x5f,0x31,0x39,0x36,0x2c,0x20,
|
|
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
];
|
|
/*
|
|
#version 300 es
|
|
|
|
layout(location = 0) in vec2 position;
|
|
out vec2 quad_uv;
|
|
layout(location = 1) in vec2 uv;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = vec4(position, 0.0, 1.0);
|
|
quad_uv = uv;
|
|
}
|
|
|
|
*/
|
|
vs_ssao_source_glsl300es := u8.[
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
|
0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,
|
|
0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,
|
|
0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,
|
|
0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
|
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,
|
|
0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,
|
|
0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
|
|
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,
|
|
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,
|
|
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,
|
|
0x76,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
];
|
|
/*
|
|
#version 300 es
|
|
precision mediump float;
|
|
precision highp int;
|
|
|
|
vec4 _220;
|
|
|
|
uniform highp vec4 ssao_fs_params[69];
|
|
uniform highp sampler2D g_position_ssao_smp;
|
|
uniform highp sampler2D g_normal_ssao_smp;
|
|
uniform highp sampler2D tex_noise_ssao_smp;
|
|
|
|
in highp vec2 quad_uv;
|
|
layout(location = 0) out highp vec4 out_color;
|
|
|
|
void main()
|
|
{
|
|
highp vec3 _26 = texture(g_position_ssao_smp, quad_uv).xyz;
|
|
highp vec3 _35 = normalize(texture(g_normal_ssao_smp, quad_uv).xyz);
|
|
highp vec3 _51 = normalize(texture(tex_noise_ssao_smp, quad_uv * vec2(480.0, 270.0)).xyz);
|
|
highp vec3 _60 = normalize(_51 - (_35 * dot(_51, _35)));
|
|
highp mat3 _85 = mat3(_60, cross(_35, _60), _35);
|
|
highp float occlusion = 0.0;
|
|
for (int i = 0; i < 64; i++)
|
|
{
|
|
highp vec3 _121 = _26 + ((_85 * ssao_fs_params[i * 1 + 4].xyz) * 0.5);
|
|
highp vec4 _133 = mat4(ssao_fs_params[0], ssao_fs_params[1], ssao_fs_params[2], ssao_fs_params[3]) * vec4(_121, 1.0);
|
|
highp vec3 _140 = _133.xyz / vec3(_133.w);
|
|
highp vec4 _204;
|
|
_204.x = _140.x;
|
|
_204.y = _140.y;
|
|
highp vec3 _154 = (_204.xyz * 0.5) + vec3(0.5);
|
|
highp vec4 _210;
|
|
_210.x = _154.x;
|
|
_210.y = _154.y;
|
|
highp vec4 _167 = texture(g_position_ssao_smp, _210.xy);
|
|
if (length(_167.xyz) > 0.00999999977648258209228515625)
|
|
{
|
|
occlusion += float(_167.z >= _121.z);
|
|
}
|
|
}
|
|
highp float _185 = occlusion;
|
|
highp float _188 = 1.0 - (_185 * 0.015625);
|
|
occlusion = _188;
|
|
highp float _196 = pow(_188, ssao_fs_params[68].x);
|
|
out_color = vec4(_196, _196, _196, 1.0);
|
|
}
|
|
|
|
*/
|
|
fs_ssao_source_glsl300es := u8.[
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
|
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
|
|
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
|
|
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x76,
|
|
0x65,0x63,0x34,0x20,0x5f,0x32,0x32,0x30,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,
|
|
0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x73,
|
|
0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x39,0x5d,
|
|
0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,
|
|
0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x67,0x5f,0x70,0x6f,0x73,0x69,
|
|
0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x75,
|
|
0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,
|
|
0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,
|
|
0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,
|
|
0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,
|
|
0x44,0x20,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,0x73,0x65,0x5f,0x73,0x73,0x61,0x6f,
|
|
0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,
|
|
0x76,0x65,0x63,0x32,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x3b,0x0a,0x6c,0x61,
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
|
|
0x34,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,
|
|
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,
|
|
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,
|
|
0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,
|
|
0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x35,0x20,0x3d,
|
|
0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,0x78,0x74,0x75,
|
|
0x72,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x73,0x73,0x61,0x6f,
|
|
0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,
|
|
0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
|
|
0x65,0x63,0x33,0x20,0x5f,0x35,0x31,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
|
0x69,0x7a,0x65,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,
|
|
0x6e,0x6f,0x69,0x73,0x65,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,
|
|
0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x34,
|
|
0x38,0x30,0x2e,0x30,0x2c,0x20,0x32,0x37,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,
|
|
0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
|
|
0x63,0x33,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
|
|
0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20,0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,
|
|
0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20,0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x6d,0x61,0x74,0x33,0x20,
|
|
0x5f,0x38,0x35,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x5f,0x36,0x30,0x2c,0x20,
|
|
0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,0x2c,
|
|
0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,
|
|
0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,
|
|
0x28,0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,
|
|
0x36,0x34,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
|
|
0x33,0x20,0x5f,0x31,0x32,0x31,0x20,0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,
|
|
0x28,0x5f,0x38,0x35,0x20,0x2a,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,
|
|
0x61,0x72,0x61,0x6d,0x73,0x5b,0x69,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x34,0x5d,
|
|
0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,
|
|
0x20,0x5f,0x31,0x33,0x33,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x73,0x73,0x61,
|
|
0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,
|
|
0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,
|
|
0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
|
0x73,0x5b,0x32,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,
|
|
0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,
|
|
0x5f,0x31,0x32,0x31,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,
|
|
0x31,0x34,0x30,0x20,0x3d,0x20,0x5f,0x31,0x33,0x33,0x2e,0x78,0x79,0x7a,0x20,0x2f,
|
|
0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x31,0x33,0x33,0x2e,0x77,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
|
|
0x34,0x20,0x5f,0x32,0x30,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x5f,0x32,0x30,0x34,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x78,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x30,0x34,0x2e,0x79,0x20,
|
|
0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x35,
|
|
0x34,0x20,0x3d,0x20,0x28,0x5f,0x32,0x30,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,
|
|
0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,
|
|
0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x31,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x5f,0x32,0x31,0x30,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35,0x34,
|
|
0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x31,0x30,
|
|
0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x35,0x34,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,
|
|
0x5f,0x31,0x36,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,
|
|
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,
|
|
0x6d,0x70,0x2c,0x20,0x5f,0x32,0x31,0x30,0x2e,0x78,0x79,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x6c,0x65,0x6e,0x67,0x74,0x68,
|
|
0x28,0x5f,0x31,0x36,0x37,0x2e,0x78,0x79,0x7a,0x29,0x20,0x3e,0x20,0x30,0x2e,0x30,
|
|
0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,
|
|
0x32,0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x0a,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x2b,0x3d,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,0x36,0x37,0x2e,0x7a,0x20,0x3e,0x3d,
|
|
0x20,0x5f,0x31,0x32,0x31,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,
|
|
0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x35,0x20,0x3d,
|
|
0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x38,
|
|
0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x38,0x35,0x20,0x2a,
|
|
0x20,0x30,0x2e,0x30,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x38,0x38,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x20,0x5f,0x31,0x39,0x36,0x20,0x3d,0x20,0x70,0x6f,0x77,0x28,0x5f,0x31,0x38,
|
|
0x38,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
|
0x73,0x5b,0x36,0x38,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
|
|
0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,
|
|
0x31,0x39,0x36,0x2c,0x20,0x5f,0x31,0x39,0x36,0x2c,0x20,0x5f,0x31,0x39,0x36,0x2c,
|
|
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
];
|
|
/*
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct main0_out
|
|
{
|
|
float2 quad_uv [[user(locn0)]];
|
|
float4 gl_Position [[position]];
|
|
};
|
|
|
|
struct main0_in
|
|
{
|
|
float2 position [[attribute(0)]];
|
|
float2 uv [[attribute(1)]];
|
|
};
|
|
|
|
vertex main0_out main0(main0_in in [[stage_in]])
|
|
{
|
|
main0_out out = {};
|
|
out.gl_Position = float4(in.position, 0.0, 1.0);
|
|
out.quad_uv = in.uv;
|
|
return out;
|
|
}
|
|
|
|
*/
|
|
vs_ssao_source_metal_macos := u8.[
|
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
|
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
|
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
|
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x32,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x20,0x5b,0x5b,
|
|
0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,
|
|
0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
|
0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
|
0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,
|
|
0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b,0x5b,
|
|
0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,
|
|
0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,
|
|
0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,
|
|
0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
|
|
0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,
|
|
0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
|
|
0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,
|
|
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,
|
|
0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x71,0x75,0x61,0x64,
|
|
0x5f,0x75,0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,
|
|
0x00,
|
|
];
|
|
/*
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct ssao_fs_params
|
|
{
|
|
float4x4 projection;
|
|
float4 samples[64];
|
|
float ssao_power;
|
|
};
|
|
|
|
constant float4 _227 = {};
|
|
|
|
struct main0_out
|
|
{
|
|
float4 out_color [[color(0)]];
|
|
};
|
|
|
|
struct main0_in
|
|
{
|
|
float2 quad_uv [[user(locn0)]];
|
|
};
|
|
|
|
fragment main0_out main0(main0_in in [[stage_in]], constant ssao_fs_params& _109 [[buffer(0)]], texture2d<float> g_position [[texture(0)]], texture2d<float> g_normal [[texture(1)]], texture2d<float> tex_noise [[texture(2)]], sampler ssao_smp [[sampler(0)]])
|
|
{
|
|
main0_out out = {};
|
|
float3 _26 = g_position.sample(ssao_smp, in.quad_uv).xyz;
|
|
float3 _35 = fast::normalize(g_normal.sample(ssao_smp, in.quad_uv).xyz);
|
|
float3 _51 = fast::normalize(tex_noise.sample(ssao_smp, (in.quad_uv * float2(480.0, 270.0))).xyz);
|
|
float3 _60 = fast::normalize(_51 - (_35 * dot(_51, _35)));
|
|
float3x3 _85 = float3x3(_60, cross(_35, _60), _35);
|
|
float occlusion = 0.0;
|
|
for (int i = 0; i < 64; i++)
|
|
{
|
|
float3 _121 = _26 + ((_85 * _109.samples[i].xyz) * 0.5);
|
|
float4 _133 = _109.projection * float4(_121, 1.0);
|
|
float3 _140 = _133.xyz / float3(_133.w);
|
|
float4 _208;
|
|
_208.x = _140.x;
|
|
_208.y = _140.y;
|
|
float3 _154 = (_208.xyz * 0.5) + float3(0.5);
|
|
float4 _214;
|
|
_214.x = _154.x;
|
|
_214.y = 1.0 - _154.y;
|
|
float4 _171 = g_position.sample(ssao_smp, _214.xy);
|
|
if (length(_171.xyz) > 0.00999999977648258209228515625)
|
|
{
|
|
occlusion += float(_171.z >= _121.z);
|
|
}
|
|
}
|
|
float _189 = occlusion;
|
|
float _192 = 1.0 - (_189 * 0.015625);
|
|
occlusion = _192;
|
|
float _200 = powr(_192, _109.ssao_power);
|
|
out.out_color = float4(_200, _200, _200, 1.0);
|
|
return out;
|
|
}
|
|
|
|
*/
|
|
fs_ssao_source_metal_macos := u8.[
|
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
|
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
|
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x73,
|
|
0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x70,0x72,0x6f,
|
|
0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x34,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x73,0x5b,0x36,0x34,0x5d,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x73,0x61,0x6f,0x5f,
|
|
0x70,0x6f,0x77,0x65,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x63,0x6f,0x6e,0x73,0x74,
|
|
0x61,0x6e,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,0x32,0x37,0x20,
|
|
0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,
|
|
0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x34,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,
|
|
0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,
|
|
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,
|
|
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x71,0x75,
|
|
0x61,0x64,0x5f,0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
|
|
0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,
|
|
0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
|
|
0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,
|
|
0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,
|
|
0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,
|
|
0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x30,0x39,0x20,0x5b,0x5b,0x62,0x75,
|
|
0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,
|
|
0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x67,0x5f,0x70,0x6f,
|
|
0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
|
0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,
|
|
0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
|
0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x31,0x29,0x5d,0x5d,0x2c,
|
|
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x3e,0x20,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,0x73,0x65,0x20,0x5b,0x5b,0x74,0x65,
|
|
0x78,0x74,0x75,0x72,0x65,0x28,0x32,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,
|
|
0x6c,0x65,0x72,0x20,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,
|
|
0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,
|
|
0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,0x20,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,
|
|
0x6f,0x6e,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,
|
|
0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,
|
|
0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,
|
|
0x5f,0x33,0x35,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,
|
|
0x61,0x6c,0x69,0x7a,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x73,
|
|
0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,
|
|
0x69,0x6e,0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x35,0x31,
|
|
0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
|
|
0x7a,0x65,0x28,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,0x73,0x65,0x2e,0x73,0x61,0x6d,
|
|
0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x28,0x69,
|
|
0x6e,0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x32,0x28,0x34,0x38,0x30,0x2e,0x30,0x2c,0x20,0x32,0x37,0x30,0x2e,0x30,0x29,
|
|
0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x33,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,
|
|
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20,
|
|
0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20,
|
|
0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x33,0x78,0x33,0x20,0x5f,0x38,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x33,0x78,0x33,0x28,0x5f,0x36,0x30,0x2c,0x20,0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,
|
|
0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,
|
|
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,
|
|
0x20,0x3c,0x20,0x36,0x34,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,
|
|
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,
|
|
0x20,0x5f,0x31,0x32,0x31,0x20,0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,0x28,
|
|
0x5f,0x38,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x39,0x2e,0x73,0x61,0x6d,0x70,0x6c,
|
|
0x65,0x73,0x5b,0x69,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,
|
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x20,0x5f,0x31,0x33,0x33,0x20,0x3d,0x20,0x5f,0x31,0x30,0x39,0x2e,0x70,0x72,
|
|
0x6f,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x28,0x5f,0x31,0x32,0x31,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x34,
|
|
0x30,0x20,0x3d,0x20,0x5f,0x31,0x33,0x33,0x2e,0x78,0x79,0x7a,0x20,0x2f,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x31,0x33,0x33,0x2e,0x77,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,
|
|
0x30,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x30,0x38,
|
|
0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x30,0x38,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,
|
|
0x34,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x35,0x34,0x20,0x3d,0x20,0x28,0x5f,0x32,0x30,
|
|
0x38,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,0x31,0x34,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x31,0x34,0x2e,0x78,0x20,
|
|
0x3d,0x20,0x5f,0x31,0x35,0x34,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x5f,0x32,0x31,0x34,0x2e,0x79,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,
|
|
0x20,0x5f,0x31,0x35,0x34,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x37,0x31,0x20,0x3d,0x20,0x67,
|
|
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
|
0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x32,0x31,0x34,0x2e,
|
|
0x78,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,
|
|
0x28,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,0x5f,0x31,0x37,0x31,0x2e,0x78,0x79,0x7a,
|
|
0x29,0x20,0x3e,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,
|
|
0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,
|
|
0x36,0x32,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,
|
|
0x73,0x69,0x6f,0x6e,0x20,0x2b,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,
|
|
0x37,0x31,0x2e,0x7a,0x20,0x3e,0x3d,0x20,0x5f,0x31,0x32,0x31,0x2e,0x7a,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x39,0x20,
|
|
0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x39,0x32,0x20,0x3d,0x20,0x31,0x2e,
|
|
0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x38,0x39,0x20,0x2a,0x20,0x30,0x2e,0x30,0x31,
|
|
0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,
|
|
0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x30,0x30,0x20,0x3d,0x20,0x70,0x6f,
|
|
0x77,0x72,0x28,0x5f,0x31,0x39,0x32,0x2c,0x20,0x5f,0x31,0x30,0x39,0x2e,0x73,0x73,
|
|
0x61,0x6f,0x5f,0x70,0x6f,0x77,0x65,0x72,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,
|
|
0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x32,0x30,0x30,0x2c,0x20,0x5f,0x32,0x30,0x30,
|
|
0x2c,0x20,0x5f,0x32,0x30,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
|
|
0x0a,0x00,
|
|
];
|
|
ssao_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
|
desc: sg_shader_desc;
|
|
desc.label = "ssao_shader";
|
|
if backend == {
|
|
case .GLCORE;
|
|
desc.vertex_func.source = xx *vs_ssao_source_glsl430;
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = xx *fs_ssao_source_glsl430;
|
|
desc.fragment_func.entry = "main";
|
|
desc.attrs[0].base_type = .FLOAT;
|
|
desc.attrs[0].glsl_name = "position";
|
|
desc.attrs[1].base_type = .FLOAT;
|
|
desc.attrs[1].glsl_name = "uv";
|
|
desc.uniform_blocks[1].stage = .FRAGMENT;
|
|
desc.uniform_blocks[1].layout = .STD140;
|
|
desc.uniform_blocks[1].size = 1104;
|
|
desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4;
|
|
desc.uniform_blocks[1].glsl_uniforms[0].array_count = 69;
|
|
desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "ssao_fs_params";
|
|
desc.images[0].stage = .FRAGMENT;
|
|
desc.images[0].multisampled = false;
|
|
desc.images[0].image_type = ._2D;
|
|
desc.images[0].sample_type = .FLOAT;
|
|
desc.images[1].stage = .FRAGMENT;
|
|
desc.images[1].multisampled = false;
|
|
desc.images[1].image_type = ._2D;
|
|
desc.images[1].sample_type = .FLOAT;
|
|
desc.images[2].stage = .FRAGMENT;
|
|
desc.images[2].multisampled = false;
|
|
desc.images[2].image_type = ._2D;
|
|
desc.images[2].sample_type = .FLOAT;
|
|
desc.samplers[0].stage = .FRAGMENT;
|
|
desc.samplers[0].sampler_type = .FILTERING;
|
|
desc.image_sampler_pairs[0].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[0].image_slot = 0;
|
|
desc.image_sampler_pairs[0].sampler_slot = 0;
|
|
desc.image_sampler_pairs[0].glsl_name = "g_position_ssao_smp";
|
|
desc.image_sampler_pairs[1].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[1].image_slot = 1;
|
|
desc.image_sampler_pairs[1].sampler_slot = 0;
|
|
desc.image_sampler_pairs[1].glsl_name = "g_normal_ssao_smp";
|
|
desc.image_sampler_pairs[2].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[2].image_slot = 2;
|
|
desc.image_sampler_pairs[2].sampler_slot = 0;
|
|
desc.image_sampler_pairs[2].glsl_name = "tex_noise_ssao_smp";
|
|
case .GLES3;
|
|
desc.vertex_func.source = xx *vs_ssao_source_glsl300es;
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = xx *fs_ssao_source_glsl300es;
|
|
desc.fragment_func.entry = "main";
|
|
desc.attrs[0].base_type = .FLOAT;
|
|
desc.attrs[0].glsl_name = "position";
|
|
desc.attrs[1].base_type = .FLOAT;
|
|
desc.attrs[1].glsl_name = "uv";
|
|
desc.uniform_blocks[1].stage = .FRAGMENT;
|
|
desc.uniform_blocks[1].layout = .STD140;
|
|
desc.uniform_blocks[1].size = 1104;
|
|
desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4;
|
|
desc.uniform_blocks[1].glsl_uniforms[0].array_count = 69;
|
|
desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "ssao_fs_params";
|
|
desc.images[0].stage = .FRAGMENT;
|
|
desc.images[0].multisampled = false;
|
|
desc.images[0].image_type = ._2D;
|
|
desc.images[0].sample_type = .FLOAT;
|
|
desc.images[1].stage = .FRAGMENT;
|
|
desc.images[1].multisampled = false;
|
|
desc.images[1].image_type = ._2D;
|
|
desc.images[1].sample_type = .FLOAT;
|
|
desc.images[2].stage = .FRAGMENT;
|
|
desc.images[2].multisampled = false;
|
|
desc.images[2].image_type = ._2D;
|
|
desc.images[2].sample_type = .FLOAT;
|
|
desc.samplers[0].stage = .FRAGMENT;
|
|
desc.samplers[0].sampler_type = .FILTERING;
|
|
desc.image_sampler_pairs[0].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[0].image_slot = 0;
|
|
desc.image_sampler_pairs[0].sampler_slot = 0;
|
|
desc.image_sampler_pairs[0].glsl_name = "g_position_ssao_smp";
|
|
desc.image_sampler_pairs[1].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[1].image_slot = 1;
|
|
desc.image_sampler_pairs[1].sampler_slot = 0;
|
|
desc.image_sampler_pairs[1].glsl_name = "g_normal_ssao_smp";
|
|
desc.image_sampler_pairs[2].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[2].image_slot = 2;
|
|
desc.image_sampler_pairs[2].sampler_slot = 0;
|
|
desc.image_sampler_pairs[2].glsl_name = "tex_noise_ssao_smp";
|
|
case .METAL_MACOS;
|
|
desc.vertex_func.source = xx *vs_ssao_source_metal_macos;
|
|
desc.vertex_func.entry = "main0";
|
|
desc.fragment_func.source = xx *fs_ssao_source_metal_macos;
|
|
desc.fragment_func.entry = "main0";
|
|
desc.attrs[0].base_type = .FLOAT;
|
|
desc.attrs[1].base_type = .FLOAT;
|
|
desc.uniform_blocks[1].stage = .FRAGMENT;
|
|
desc.uniform_blocks[1].layout = .STD140;
|
|
desc.uniform_blocks[1].size = 1104;
|
|
desc.uniform_blocks[1].msl_buffer_n = 0;
|
|
desc.images[0].stage = .FRAGMENT;
|
|
desc.images[0].multisampled = false;
|
|
desc.images[0].image_type = ._2D;
|
|
desc.images[0].sample_type = .FLOAT;
|
|
desc.images[0].msl_texture_n = 0;
|
|
desc.images[1].stage = .FRAGMENT;
|
|
desc.images[1].multisampled = false;
|
|
desc.images[1].image_type = ._2D;
|
|
desc.images[1].sample_type = .FLOAT;
|
|
desc.images[1].msl_texture_n = 1;
|
|
desc.images[2].stage = .FRAGMENT;
|
|
desc.images[2].multisampled = false;
|
|
desc.images[2].image_type = ._2D;
|
|
desc.images[2].sample_type = .FLOAT;
|
|
desc.images[2].msl_texture_n = 2;
|
|
desc.samplers[0].stage = .FRAGMENT;
|
|
desc.samplers[0].sampler_type = .FILTERING;
|
|
desc.samplers[0].msl_sampler_n = 0;
|
|
desc.image_sampler_pairs[0].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[0].image_slot = 0;
|
|
desc.image_sampler_pairs[0].sampler_slot = 0;
|
|
desc.image_sampler_pairs[1].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[1].image_slot = 1;
|
|
desc.image_sampler_pairs[1].sampler_slot = 0;
|
|
desc.image_sampler_pairs[2].stage = .FRAGMENT;
|
|
desc.image_sampler_pairs[2].image_slot = 2;
|
|
desc.image_sampler_pairs[2].sampler_slot = 0;
|
|
}
|
|
return desc;
|
|
}
|