1093 lines
68 KiB
C++
1093 lines
68 KiB
C++
#pragma once
|
|
/*
|
|
#version:1# (machine generated, don't edit!)
|
|
|
|
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
|
|
|
Cmdline:
|
|
sokol-shdc --input E:/box/box3d/samples/shaders/ibl/brdf_lut.glsl --output E:/box/box3d/samples/shaders/generated/brdf_lut.glsl.h --slang hlsl5:metal_macos:glsl430
|
|
|
|
Overview:
|
|
=========
|
|
Shader program: 'build':
|
|
Get shader desc: brdf_lut_build_shader_desc(sg_query_backend());
|
|
Vertex Shader: vs
|
|
Fragment Shader: fs
|
|
Attributes:
|
|
Bindings:
|
|
Uniform block 'ub_brdf':
|
|
C struct: brdf_lut_ub_brdf_t
|
|
Bind slot: UB_brdf_lut_ub_brdf => 0
|
|
*/
|
|
#if !defined(SOKOL_GFX_INCLUDED)
|
|
#error "Please include sokol_gfx.h before brdf_lut.glsl.h"
|
|
#endif
|
|
#if !defined(SOKOL_SHDC_ALIGN)
|
|
#if defined(_MSC_VER)
|
|
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
|
|
#else
|
|
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
|
|
#endif
|
|
#endif
|
|
#define UB_brdf_lut_ub_brdf (0)
|
|
#pragma pack(push,1)
|
|
SOKOL_SHDC_ALIGN(16) typedef struct brdf_lut_ub_brdf_t {
|
|
Vec4 params;
|
|
} brdf_lut_ub_brdf_t;
|
|
#pragma pack(pop)
|
|
/*
|
|
#version 430
|
|
|
|
uniform vec4 ub_brdf[1];
|
|
layout(location = 0) out vec2 v_uv;
|
|
|
|
void main()
|
|
{
|
|
vec2 _27 = (vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2)) * 2.0) - vec2(1.0);
|
|
float _34 = _27.x;
|
|
v_uv = vec2((_34 * 0.5) + 0.5, 0.5 + ((_27.y * 0.5) * ub_brdf[0].x));
|
|
gl_Position = vec4(_34, _27.y, 0.0, 1.0);
|
|
}
|
|
|
|
*/
|
|
static const uint8_t brdf_lut_vs_source_glsl430[333] = {
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
|
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x62,0x5f,0x62,0x72,
|
|
0x64,0x66,0x5b,0x31,0x5d,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,0x76,0x5f,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,
|
|
0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,
|
|
0x63,0x32,0x20,0x5f,0x32,0x37,0x20,0x3d,0x20,0x28,0x76,0x65,0x63,0x32,0x28,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,
|
|
0x44,0x20,0x3c,0x3c,0x20,0x31,0x29,0x20,0x26,0x20,0x32,0x29,0x2c,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x20,
|
|
0x26,0x20,0x32,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,
|
|
0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x5f,0x33,0x34,0x20,0x3d,0x20,0x5f,0x32,0x37,0x2e,0x78,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,
|
|
0x28,0x28,0x5f,0x33,0x34,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x30,
|
|
0x2e,0x35,0x2c,0x20,0x30,0x2e,0x35,0x20,0x2b,0x20,0x28,0x28,0x5f,0x32,0x37,0x2e,
|
|
0x79,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x75,0x62,0x5f,0x62,0x72,
|
|
0x64,0x66,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,
|
|
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,
|
|
0x34,0x28,0x5f,0x33,0x34,0x2c,0x20,0x5f,0x32,0x37,0x2e,0x79,0x2c,0x20,0x30,0x2e,
|
|
0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
};
|
|
/*
|
|
#version 430
|
|
|
|
layout(location = 0) in vec2 v_uv;
|
|
layout(location = 0) out vec2 out_color;
|
|
|
|
float radicalInverseVdC(inout uint bits)
|
|
{
|
|
bits = (bits << 16u) | (bits >> 16u);
|
|
bits = ((bits & 1431655765u) << 1u) | ((bits & 2863311530u) >> 1u);
|
|
bits = ((bits & 858993459u) << 2u) | ((bits & 3435973836u) >> 2u);
|
|
bits = ((bits & 252645135u) << 4u) | ((bits & 4042322160u) >> 4u);
|
|
bits = ((bits & 16711935u) << 8u) | ((bits & 4278255360u) >> 8u);
|
|
return float(bits) * 2.3283064365386962890625e-10;
|
|
}
|
|
|
|
vec2 hammersley(uint i, uint n)
|
|
{
|
|
uint param = i;
|
|
float _97 = radicalInverseVdC(param);
|
|
return vec2(float(i) / float(n), _97);
|
|
}
|
|
|
|
vec3 importanceSampleGGX(vec2 Xi, float alpha)
|
|
{
|
|
float _110 = 6.283185482025146484375 * Xi.x;
|
|
float _123 = sqrt((1.0 - Xi.y) / (1.0 + (((alpha * alpha) - 1.0) * Xi.y)));
|
|
float _131 = sqrt(max(1.0 - (_123 * _123), 0.0));
|
|
return vec3(_131 * cos(_110), _131 * sin(_110), _123);
|
|
}
|
|
|
|
float smithGggxIbl(float n_dot_v, float n_dot_l, float alpha)
|
|
{
|
|
float _149 = (alpha * alpha) * 0.5;
|
|
float _154 = 1.0 - _149;
|
|
return (n_dot_v / ((n_dot_v * _154) + _149)) * (n_dot_l / ((n_dot_l * _154) + _149));
|
|
}
|
|
|
|
vec2 integrateBRDF(float n_dot_v, float roughness)
|
|
{
|
|
vec3 _182 = vec3(sqrt(max(1.0 - (n_dot_v * n_dot_v), 0.0)), 0.0, n_dot_v);
|
|
float A = 0.0;
|
|
float B = 0.0;
|
|
float _188 = roughness * roughness;
|
|
for (uint i = 0u; i < 1024u; i++)
|
|
{
|
|
uint param = i;
|
|
uint param_1 = 1024u;
|
|
vec2 param_2 = hammersley(param, param_1);
|
|
float param_3 = _188;
|
|
vec3 _209 = importanceSampleGGX(param_2, param_3);
|
|
float _214 = dot(_182, _209);
|
|
float _223 = max(((_209 * (2.0 * _214)) - _182).z, 0.0);
|
|
float _232 = max(_214, 0.0);
|
|
if (_223 > 0.0)
|
|
{
|
|
float param_4 = n_dot_v;
|
|
float param_5 = _223;
|
|
float param_6 = _188;
|
|
float _254 = (smithGggxIbl(param_4, param_5, param_6) * _232) / max(max(_209.z, 0.0) * n_dot_v, 9.9999997473787516355514526367188e-06);
|
|
float _260 = pow(max(0.0, 1.0 - _232), 5.0);
|
|
A += ((1.0 - _260) * _254);
|
|
B += (_260 * _254);
|
|
}
|
|
}
|
|
return vec2(A, B) * vec2(0.0009765625);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
float param = max(v_uv.x, 0.001000000047497451305389404296875);
|
|
float param_1 = max(v_uv.y, 0.001000000047497451305389404296875);
|
|
out_color = integrateBRDF(param, param_1);
|
|
}
|
|
|
|
*/
|
|
static const uint8_t brdf_lut_fs_source_glsl430[2450] = {
|
|
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,0x76,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,0x32,0x20,0x6f,
|
|
0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x49,0x6e,0x76,0x65,0x72,0x73,0x65,0x56,
|
|
0x64,0x43,0x28,0x69,0x6e,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x62,0x69,
|
|
0x74,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,
|
|
0x20,0x28,0x62,0x69,0x74,0x73,0x20,0x3c,0x3c,0x20,0x31,0x36,0x75,0x29,0x20,0x7c,
|
|
0x20,0x28,0x62,0x69,0x74,0x73,0x20,0x3e,0x3e,0x20,0x31,0x36,0x75,0x29,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,
|
|
0x73,0x20,0x26,0x20,0x31,0x34,0x33,0x31,0x36,0x35,0x35,0x37,0x36,0x35,0x75,0x29,
|
|
0x20,0x3c,0x3c,0x20,0x31,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,0x62,0x69,0x74,0x73,
|
|
0x20,0x26,0x20,0x32,0x38,0x36,0x33,0x33,0x31,0x31,0x35,0x33,0x30,0x75,0x29,0x20,
|
|
0x3e,0x3e,0x20,0x31,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,
|
|
0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x38,0x35,0x38,0x39,
|
|
0x39,0x33,0x34,0x35,0x39,0x75,0x29,0x20,0x3c,0x3c,0x20,0x32,0x75,0x29,0x20,0x7c,
|
|
0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x33,0x34,0x33,0x35,0x39,0x37,
|
|
0x33,0x38,0x33,0x36,0x75,0x29,0x20,0x3e,0x3e,0x20,0x32,0x75,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,0x73,
|
|
0x20,0x26,0x20,0x32,0x35,0x32,0x36,0x34,0x35,0x31,0x33,0x35,0x75,0x29,0x20,0x3c,
|
|
0x3c,0x20,0x34,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,
|
|
0x20,0x34,0x30,0x34,0x32,0x33,0x32,0x32,0x31,0x36,0x30,0x75,0x29,0x20,0x3e,0x3e,
|
|
0x20,0x34,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,
|
|
0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x31,0x36,0x37,0x31,0x31,0x39,
|
|
0x33,0x35,0x75,0x29,0x20,0x3c,0x3c,0x20,0x38,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,
|
|
0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x34,0x32,0x37,0x38,0x32,0x35,0x35,0x33,0x36,
|
|
0x30,0x75,0x29,0x20,0x3e,0x3e,0x20,0x38,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x62,0x69,0x74,
|
|
0x73,0x29,0x20,0x2a,0x20,0x32,0x2e,0x33,0x32,0x38,0x33,0x30,0x36,0x34,0x33,0x36,
|
|
0x35,0x33,0x38,0x36,0x39,0x36,0x32,0x38,0x39,0x30,0x36,0x32,0x35,0x65,0x2d,0x31,
|
|
0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x32,0x20,0x68,0x61,0x6d,0x6d,0x65,
|
|
0x72,0x73,0x6c,0x65,0x79,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x2c,0x20,0x75,0x69,
|
|
0x6e,0x74,0x20,0x6e,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,
|
|
0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x39,0x37,0x20,0x3d,0x20,0x72,0x61,0x64,0x69,
|
|
0x63,0x61,0x6c,0x49,0x6e,0x76,0x65,0x72,0x73,0x65,0x56,0x64,0x43,0x28,0x70,0x61,
|
|
0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
|
|
0x20,0x76,0x65,0x63,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x69,0x29,0x20,0x2f,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6e,0x29,0x2c,0x20,0x5f,0x39,0x37,0x29,0x3b,
|
|
0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x33,0x20,0x69,0x6d,0x70,0x6f,0x72,0x74,0x61,
|
|
0x6e,0x63,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x47,0x47,0x58,0x28,0x76,0x65,0x63,
|
|
0x32,0x20,0x58,0x69,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,
|
|
0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
|
|
0x31,0x31,0x30,0x20,0x3d,0x20,0x36,0x2e,0x32,0x38,0x33,0x31,0x38,0x35,0x34,0x38,
|
|
0x32,0x30,0x32,0x35,0x31,0x34,0x36,0x34,0x38,0x34,0x33,0x37,0x35,0x20,0x2a,0x20,
|
|
0x58,0x69,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x32,0x33,0x20,0x3d,0x20,0x73,0x71,0x72,0x74,0x28,0x28,0x31,0x2e,0x30,
|
|
0x20,0x2d,0x20,0x58,0x69,0x2e,0x79,0x29,0x20,0x2f,0x20,0x28,0x31,0x2e,0x30,0x20,
|
|
0x2b,0x20,0x28,0x28,0x28,0x61,0x6c,0x70,0x68,0x61,0x20,0x2a,0x20,0x61,0x6c,0x70,
|
|
0x68,0x61,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x29,0x20,0x2a,0x20,0x58,0x69,0x2e,
|
|
0x79,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x33,0x31,0x20,0x3d,0x20,0x73,0x71,0x72,0x74,0x28,0x6d,0x61,0x78,0x28,
|
|
0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x32,0x33,0x20,0x2a,0x20,0x5f,0x31,
|
|
0x32,0x33,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x31,0x33,0x31,
|
|
0x20,0x2a,0x20,0x63,0x6f,0x73,0x28,0x5f,0x31,0x31,0x30,0x29,0x2c,0x20,0x5f,0x31,
|
|
0x33,0x31,0x20,0x2a,0x20,0x73,0x69,0x6e,0x28,0x5f,0x31,0x31,0x30,0x29,0x2c,0x20,
|
|
0x5f,0x31,0x32,0x33,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x73,0x6d,0x69,0x74,0x68,0x47,0x67,0x67,0x78,0x49,0x62,0x6c,0x28,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x5f,0x31,0x34,0x39,0x20,0x3d,0x20,0x28,0x61,0x6c,0x70,0x68,
|
|
0x61,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x35,0x34,
|
|
0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x5f,0x31,0x34,0x39,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,
|
|
0x5f,0x76,0x20,0x2f,0x20,0x28,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x20,0x2a,
|
|
0x20,0x5f,0x31,0x35,0x34,0x29,0x20,0x2b,0x20,0x5f,0x31,0x34,0x39,0x29,0x29,0x20,
|
|
0x2a,0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x20,0x2f,0x20,0x28,0x28,0x6e,
|
|
0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x20,0x2a,0x20,0x5f,0x31,0x35,0x34,0x29,0x20,0x2b,
|
|
0x20,0x5f,0x31,0x34,0x39,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x32,
|
|
0x20,0x69,0x6e,0x74,0x65,0x67,0x72,0x61,0x74,0x65,0x42,0x52,0x44,0x46,0x28,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x72,0x6f,0x75,0x67,0x68,0x6e,0x65,0x73,0x73,0x29,0x0a,0x7b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x38,0x32,0x20,0x3d,
|
|
0x20,0x76,0x65,0x63,0x33,0x28,0x73,0x71,0x72,0x74,0x28,0x6d,0x61,0x78,0x28,0x31,
|
|
0x2e,0x30,0x20,0x2d,0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x20,0x2a,0x20,
|
|
0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2c,
|
|
0x20,0x30,0x2e,0x30,0x2c,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x29,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x41,0x20,0x3d,0x20,0x30,0x2e,
|
|
0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x42,0x20,0x3d,
|
|
0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x38,0x38,0x20,0x3d,0x20,0x72,0x6f,0x75,0x67,0x68,0x6e,0x65,0x73,0x73,
|
|
0x20,0x2a,0x20,0x72,0x6f,0x75,0x67,0x68,0x6e,0x65,0x73,0x73,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,
|
|
0x30,0x75,0x3b,0x20,0x69,0x20,0x3c,0x20,0x31,0x30,0x32,0x34,0x75,0x3b,0x20,0x69,
|
|
0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,
|
|
0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x30,0x32,0x34,0x75,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,
|
|
0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x68,0x61,0x6d,0x6d,0x65,0x72,0x73,0x6c,0x65,
|
|
0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,
|
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x5f,0x31,0x38,0x38,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,
|
|
0x30,0x39,0x20,0x3d,0x20,0x69,0x6d,0x70,0x6f,0x72,0x74,0x61,0x6e,0x63,0x65,0x53,
|
|
0x61,0x6d,0x70,0x6c,0x65,0x47,0x47,0x58,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,
|
|
0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x31,0x34,0x20,0x3d,
|
|
0x20,0x64,0x6f,0x74,0x28,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,0x32,0x30,0x39,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x32,0x32,0x33,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x28,0x28,0x5f,0x32,0x30,
|
|
0x39,0x20,0x2a,0x20,0x28,0x32,0x2e,0x30,0x20,0x2a,0x20,0x5f,0x32,0x31,0x34,0x29,
|
|
0x29,0x20,0x2d,0x20,0x5f,0x31,0x38,0x32,0x29,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,
|
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x5f,0x32,0x33,0x32,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x5f,0x32,0x31,0x34,
|
|
0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x69,0x66,0x20,0x28,0x5f,0x32,0x32,0x33,0x20,0x3e,0x20,0x30,0x2e,0x30,0x29,0x0a,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,
|
|
0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x5f,0x32,0x32,0x33,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20,0x5f,0x31,0x38,
|
|
0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x35,0x34,0x20,0x3d,0x20,0x28,0x73,0x6d,0x69,
|
|
0x74,0x68,0x47,0x67,0x67,0x78,0x49,0x62,0x6c,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,
|
|
0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20,0x70,0x61,0x72,0x61,
|
|
0x6d,0x5f,0x36,0x29,0x20,0x2a,0x20,0x5f,0x32,0x33,0x32,0x29,0x20,0x2f,0x20,0x6d,
|
|
0x61,0x78,0x28,0x6d,0x61,0x78,0x28,0x5f,0x32,0x30,0x39,0x2e,0x7a,0x2c,0x20,0x30,
|
|
0x2e,0x30,0x29,0x20,0x2a,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x39,
|
|
0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,
|
|
0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,
|
|
0x65,0x2d,0x30,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x36,0x30,0x20,0x3d,0x20,
|
|
0x70,0x6f,0x77,0x28,0x6d,0x61,0x78,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,
|
|
0x20,0x2d,0x20,0x5f,0x32,0x33,0x32,0x29,0x2c,0x20,0x35,0x2e,0x30,0x29,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x41,0x20,0x2b,0x3d,
|
|
0x20,0x28,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x5f,0x32,0x36,0x30,0x29,0x20,0x2a,
|
|
0x20,0x5f,0x32,0x35,0x34,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x42,0x20,0x2b,0x3d,0x20,0x28,0x5f,0x32,0x36,0x30,0x20,0x2a,
|
|
0x20,0x5f,0x32,0x35,0x34,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,
|
|
0x72,0x6e,0x20,0x76,0x65,0x63,0x32,0x28,0x41,0x2c,0x20,0x42,0x29,0x20,0x2a,0x20,
|
|
0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,
|
|
0x35,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,
|
|
0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,
|
|
0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x76,0x5f,0x75,0x76,0x2e,
|
|
0x78,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x34,
|
|
0x37,0x34,0x39,0x37,0x34,0x35,0x31,0x33,0x30,0x35,0x33,0x38,0x39,0x34,0x30,0x34,
|
|
0x32,0x39,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x6d,0x61,0x78,
|
|
0x28,0x76,0x5f,0x75,0x76,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x30,0x30,
|
|
0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x34,0x39,0x37,0x34,0x35,0x31,0x33,0x30,0x35,
|
|
0x33,0x38,0x39,0x34,0x30,0x34,0x32,0x39,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,
|
|
0x6e,0x74,0x65,0x67,0x72,0x61,0x74,0x65,0x42,0x52,0x44,0x46,0x28,0x70,0x61,0x72,
|
|
0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x7d,0x0a,
|
|
0x0a,0x00,
|
|
};
|
|
/*
|
|
cbuffer ub_brdf : register(b0)
|
|
{
|
|
float4 _45_params : packoffset(c0);
|
|
};
|
|
|
|
|
|
static float4 gl_Position;
|
|
static int gl_VertexIndex;
|
|
static float2 v_uv;
|
|
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
uint gl_VertexIndex : SV_VertexID;
|
|
};
|
|
|
|
struct SPIRV_Cross_Output
|
|
{
|
|
float2 v_uv : TEXCOORD0;
|
|
float4 gl_Position : SV_Position;
|
|
};
|
|
|
|
void vert_main()
|
|
{
|
|
float2 _27 = (float2(float((gl_VertexIndex << 1) & 2), float(gl_VertexIndex & 2)) * 2.0f) - 1.0f.xx;
|
|
float _34 = _27.x;
|
|
v_uv = float2((_34 * 0.5f) + 0.5f, 0.5f + ((_27.y * 0.5f) * _45_params.x));
|
|
gl_Position = float4(_34, _27.y, 0.0f, 1.0f);
|
|
}
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
gl_VertexIndex = int(stage_input.gl_VertexIndex);
|
|
vert_main();
|
|
SPIRV_Cross_Output stage_output;
|
|
stage_output.gl_Position = gl_Position;
|
|
stage_output.v_uv = v_uv;
|
|
return stage_output;
|
|
}
|
|
*/
|
|
static const uint8_t brdf_lut_vs_source_hlsl5[869] = {
|
|
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x75,0x62,0x5f,0x62,0x72,0x64,0x66,0x20,
|
|
0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x34,0x35,0x5f,
|
|
0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,
|
|
0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,
|
|
0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,
|
|
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
|
|
0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,
|
|
0x65,0x78,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x32,0x20,0x76,0x5f,0x75,0x76,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
|
|
0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,
|
|
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,
|
|
0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,0x53,0x56,
|
|
0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,
|
|
0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
|
|
0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,
|
|
0x43,0x4f,0x4f,0x52,0x44,0x30,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,0x3a,
|
|
0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,
|
|
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,
|
|
0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
|
0x5f,0x32,0x37,0x20,0x3d,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,
|
|
0x64,0x65,0x78,0x20,0x3c,0x3c,0x20,0x31,0x29,0x20,0x26,0x20,0x32,0x29,0x2c,0x20,
|
|
0x66,0x6c,0x6f,0x61,0x74,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,
|
|
0x6e,0x64,0x65,0x78,0x20,0x26,0x20,0x32,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,
|
|
0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78,0x78,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x34,0x20,0x3d,0x20,0x5f,0x32,
|
|
0x37,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x75,0x76,0x20,0x3d,0x20,
|
|
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x28,0x5f,0x33,0x34,0x20,0x2a,0x20,0x30,0x2e,
|
|
0x35,0x66,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x30,0x2e,0x35,0x66,
|
|
0x20,0x2b,0x20,0x28,0x28,0x5f,0x32,0x37,0x2e,0x79,0x20,0x2a,0x20,0x30,0x2e,0x35,
|
|
0x66,0x29,0x20,0x2a,0x20,0x5f,0x34,0x35,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x2e,
|
|
0x78,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,
|
|
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x33,
|
|
0x34,0x2c,0x20,0x5f,0x32,0x37,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,
|
|
0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,
|
|
0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,
|
|
0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,
|
|
0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,
|
|
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,
|
|
0x49,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,
|
|
0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,
|
|
0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,
|
|
0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,
|
|
0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,
|
|
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,
|
|
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,
|
|
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,
|
|
0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x76,0x5f,0x75,0x76,
|
|
0x20,0x3d,0x20,0x76,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,
|
|
0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,
|
|
0x3b,0x0a,0x7d,0x0a,0x00,
|
|
};
|
|
/*
|
|
static float2 v_uv;
|
|
static float2 out_color;
|
|
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
float2 v_uv : TEXCOORD0;
|
|
};
|
|
|
|
struct SPIRV_Cross_Output
|
|
{
|
|
float2 out_color : SV_Target0;
|
|
};
|
|
|
|
float radicalInverseVdC(inout uint bits)
|
|
{
|
|
bits = (bits << 16u) | (bits >> 16u);
|
|
bits = ((bits & 1431655765u) << 1u) | ((bits & 2863311530u) >> 1u);
|
|
bits = ((bits & 858993459u) << 2u) | ((bits & 3435973836u) >> 2u);
|
|
bits = ((bits & 252645135u) << 4u) | ((bits & 4042322160u) >> 4u);
|
|
bits = ((bits & 16711935u) << 8u) | ((bits & 4278255360u) >> 8u);
|
|
return float(bits) * 2.3283064365386962890625e-10f;
|
|
}
|
|
|
|
float2 hammersley(uint i, uint n)
|
|
{
|
|
uint param = i;
|
|
float _97 = radicalInverseVdC(param);
|
|
return float2(float(i) / float(n), _97);
|
|
}
|
|
|
|
float3 importanceSampleGGX(float2 Xi, float alpha)
|
|
{
|
|
float _110 = 6.283185482025146484375f * Xi.x;
|
|
float _123 = sqrt((1.0f - Xi.y) / (1.0f + (((alpha * alpha) - 1.0f) * Xi.y)));
|
|
float _131 = sqrt(max(1.0f - (_123 * _123), 0.0f));
|
|
return float3(_131 * cos(_110), _131 * sin(_110), _123);
|
|
}
|
|
|
|
float smithGggxIbl(float n_dot_v, float n_dot_l, float alpha)
|
|
{
|
|
float _149 = (alpha * alpha) * 0.5f;
|
|
float _154 = 1.0f - _149;
|
|
return (n_dot_v / ((n_dot_v * _154) + _149)) * (n_dot_l / ((n_dot_l * _154) + _149));
|
|
}
|
|
|
|
float2 integrateBRDF(float n_dot_v, float roughness)
|
|
{
|
|
float3 _182 = float3(sqrt(max(1.0f - (n_dot_v * n_dot_v), 0.0f)), 0.0f, n_dot_v);
|
|
float A = 0.0f;
|
|
float B = 0.0f;
|
|
float _188 = roughness * roughness;
|
|
for (uint i = 0u; i < 1024u; i++)
|
|
{
|
|
uint param = i;
|
|
uint param_1 = 1024u;
|
|
float2 param_2 = hammersley(param, param_1);
|
|
float param_3 = _188;
|
|
float3 _209 = importanceSampleGGX(param_2, param_3);
|
|
float _214 = dot(_182, _209);
|
|
float _223 = max(((_209 * (2.0f * _214)) - _182).z, 0.0f);
|
|
float _232 = max(_214, 0.0f);
|
|
if (_223 > 0.0f)
|
|
{
|
|
float param_4 = n_dot_v;
|
|
float param_5 = _223;
|
|
float param_6 = _188;
|
|
float _254 = (smithGggxIbl(param_4, param_5, param_6) * _232) / max(max(_209.z, 0.0f) * n_dot_v, 9.9999997473787516355514526367188e-06f);
|
|
float _260 = pow(max(0.0f, 1.0f - _232), 5.0f);
|
|
A += ((1.0f - _260) * _254);
|
|
B += (_260 * _254);
|
|
}
|
|
}
|
|
return float2(A, B) * 0.0009765625f.xx;
|
|
}
|
|
|
|
void frag_main()
|
|
{
|
|
float param = max(v_uv.x, 0.001000000047497451305389404296875f);
|
|
float param_1 = max(v_uv.y, 0.001000000047497451305389404296875f);
|
|
out_color = integrateBRDF(param, param_1);
|
|
}
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
v_uv = stage_input.v_uv;
|
|
frag_main();
|
|
SPIRV_Cross_Output stage_output;
|
|
stage_output.out_color = out_color;
|
|
return stage_output;
|
|
}
|
|
*/
|
|
static const uint8_t brdf_lut_fs_source_hlsl5[2790] = {
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,
|
|
0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x32,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x73,0x74,
|
|
0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,
|
|
0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x32,0x20,0x76,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,
|
|
0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,
|
|
0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,
|
|
0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
|
|
0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x53,0x56,0x5f,
|
|
0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x49,0x6e,0x76,0x65,0x72,0x73,
|
|
0x65,0x56,0x64,0x43,0x28,0x69,0x6e,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,
|
|
0x62,0x69,0x74,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,
|
|
0x20,0x3d,0x20,0x28,0x62,0x69,0x74,0x73,0x20,0x3c,0x3c,0x20,0x31,0x36,0x75,0x29,
|
|
0x20,0x7c,0x20,0x28,0x62,0x69,0x74,0x73,0x20,0x3e,0x3e,0x20,0x31,0x36,0x75,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,
|
|
0x69,0x74,0x73,0x20,0x26,0x20,0x31,0x34,0x33,0x31,0x36,0x35,0x35,0x37,0x36,0x35,
|
|
0x75,0x29,0x20,0x3c,0x3c,0x20,0x31,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,0x62,0x69,
|
|
0x74,0x73,0x20,0x26,0x20,0x32,0x38,0x36,0x33,0x33,0x31,0x31,0x35,0x33,0x30,0x75,
|
|
0x29,0x20,0x3e,0x3e,0x20,0x31,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,
|
|
0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x38,0x35,
|
|
0x38,0x39,0x39,0x33,0x34,0x35,0x39,0x75,0x29,0x20,0x3c,0x3c,0x20,0x32,0x75,0x29,
|
|
0x20,0x7c,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x33,0x34,0x33,0x35,
|
|
0x39,0x37,0x33,0x38,0x33,0x36,0x75,0x29,0x20,0x3e,0x3e,0x20,0x32,0x75,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,0x69,
|
|
0x74,0x73,0x20,0x26,0x20,0x32,0x35,0x32,0x36,0x34,0x35,0x31,0x33,0x35,0x75,0x29,
|
|
0x20,0x3c,0x3c,0x20,0x34,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,0x62,0x69,0x74,0x73,
|
|
0x20,0x26,0x20,0x34,0x30,0x34,0x32,0x33,0x32,0x32,0x31,0x36,0x30,0x75,0x29,0x20,
|
|
0x3e,0x3e,0x20,0x34,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,
|
|
0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x31,0x36,0x37,0x31,
|
|
0x31,0x39,0x33,0x35,0x75,0x29,0x20,0x3c,0x3c,0x20,0x38,0x75,0x29,0x20,0x7c,0x20,
|
|
0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x34,0x32,0x37,0x38,0x32,0x35,0x35,
|
|
0x33,0x36,0x30,0x75,0x29,0x20,0x3e,0x3e,0x20,0x38,0x75,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x62,
|
|
0x69,0x74,0x73,0x29,0x20,0x2a,0x20,0x32,0x2e,0x33,0x32,0x38,0x33,0x30,0x36,0x34,
|
|
0x33,0x36,0x35,0x33,0x38,0x36,0x39,0x36,0x32,0x38,0x39,0x30,0x36,0x32,0x35,0x65,
|
|
0x2d,0x31,0x30,0x66,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
|
0x68,0x61,0x6d,0x6d,0x65,0x72,0x73,0x6c,0x65,0x79,0x28,0x75,0x69,0x6e,0x74,0x20,
|
|
0x69,0x2c,0x20,0x75,0x69,0x6e,0x74,0x20,0x6e,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x39,0x37,0x20,0x3d,
|
|
0x20,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x49,0x6e,0x76,0x65,0x72,0x73,0x65,0x56,
|
|
0x64,0x43,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,
|
|
0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x28,0x69,0x29,0x20,0x2f,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6e,0x29,
|
|
0x2c,0x20,0x5f,0x39,0x37,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x33,0x20,0x69,0x6d,0x70,0x6f,0x72,0x74,0x61,0x6e,0x63,0x65,0x53,0x61,0x6d,0x70,
|
|
0x6c,0x65,0x47,0x47,0x58,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x58,0x69,0x2c,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x31,0x30,0x20,0x3d,
|
|
0x20,0x36,0x2e,0x32,0x38,0x33,0x31,0x38,0x35,0x34,0x38,0x32,0x30,0x32,0x35,0x31,
|
|
0x34,0x36,0x34,0x38,0x34,0x33,0x37,0x35,0x66,0x20,0x2a,0x20,0x58,0x69,0x2e,0x78,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x32,0x33,
|
|
0x20,0x3d,0x20,0x73,0x71,0x72,0x74,0x28,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,
|
|
0x58,0x69,0x2e,0x79,0x29,0x20,0x2f,0x20,0x28,0x31,0x2e,0x30,0x66,0x20,0x2b,0x20,
|
|
0x28,0x28,0x28,0x61,0x6c,0x70,0x68,0x61,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,
|
|
0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,0x29,0x20,0x2a,0x20,0x58,0x69,0x2e,0x79,
|
|
0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
|
|
0x31,0x33,0x31,0x20,0x3d,0x20,0x73,0x71,0x72,0x74,0x28,0x6d,0x61,0x78,0x28,0x31,
|
|
0x2e,0x30,0x66,0x20,0x2d,0x20,0x28,0x5f,0x31,0x32,0x33,0x20,0x2a,0x20,0x5f,0x31,
|
|
0x32,0x33,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,
|
|
0x31,0x33,0x31,0x20,0x2a,0x20,0x63,0x6f,0x73,0x28,0x5f,0x31,0x31,0x30,0x29,0x2c,
|
|
0x20,0x5f,0x31,0x33,0x31,0x20,0x2a,0x20,0x73,0x69,0x6e,0x28,0x5f,0x31,0x31,0x30,
|
|
0x29,0x2c,0x20,0x5f,0x31,0x32,0x33,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x73,0x6d,0x69,0x74,0x68,0x47,0x67,0x67,0x78,0x49,0x62,0x6c,0x28,
|
|
0x66,0x6c,0x6f,0x61,0x74,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x2c,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x34,0x39,0x20,0x3d,0x20,0x28,0x61,
|
|
0x6c,0x70,0x68,0x61,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x20,0x2a,0x20,
|
|
0x30,0x2e,0x35,0x66,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x35,0x34,0x20,0x3d,0x20,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x5f,0x31,
|
|
0x34,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,
|
|
0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x20,0x2f,0x20,0x28,0x28,0x6e,0x5f,0x64,0x6f,
|
|
0x74,0x5f,0x76,0x20,0x2a,0x20,0x5f,0x31,0x35,0x34,0x29,0x20,0x2b,0x20,0x5f,0x31,
|
|
0x34,0x39,0x29,0x29,0x20,0x2a,0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x20,
|
|
0x2f,0x20,0x28,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x20,0x2a,0x20,0x5f,0x31,
|
|
0x35,0x34,0x29,0x20,0x2b,0x20,0x5f,0x31,0x34,0x39,0x29,0x29,0x3b,0x0a,0x7d,0x0a,
|
|
0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x69,0x6e,0x74,0x65,0x67,0x72,0x61,0x74,
|
|
0x65,0x42,0x52,0x44,0x46,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6e,0x5f,0x64,0x6f,
|
|
0x74,0x5f,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x72,0x6f,0x75,0x67,0x68,
|
|
0x6e,0x65,0x73,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x33,0x20,0x5f,0x31,0x38,0x32,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,
|
|
0x28,0x73,0x71,0x72,0x74,0x28,0x6d,0x61,0x78,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,
|
|
0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x20,0x2a,0x20,0x6e,0x5f,0x64,0x6f,
|
|
0x74,0x5f,0x76,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x29,0x2c,0x20,0x30,0x2e,
|
|
0x30,0x66,0x2c,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x41,0x20,0x3d,0x20,0x30,0x2e,0x30,0x66,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x42,0x20,0x3d,0x20,
|
|
0x30,0x2e,0x30,0x66,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x38,0x38,0x20,0x3d,0x20,0x72,0x6f,0x75,0x67,0x68,0x6e,0x65,0x73,0x73,
|
|
0x20,0x2a,0x20,0x72,0x6f,0x75,0x67,0x68,0x6e,0x65,0x73,0x73,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,
|
|
0x30,0x75,0x3b,0x20,0x69,0x20,0x3c,0x20,0x31,0x30,0x32,0x34,0x75,0x3b,0x20,0x69,
|
|
0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,
|
|
0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x30,0x32,0x34,0x75,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,
|
|
0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x68,0x61,0x6d,0x6d,0x65,0x72,0x73,
|
|
0x6c,0x65,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,
|
|
0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x5f,0x31,0x38,
|
|
0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x33,0x20,0x5f,0x32,0x30,0x39,0x20,0x3d,0x20,0x69,0x6d,0x70,0x6f,0x72,0x74,0x61,
|
|
0x6e,0x63,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x47,0x47,0x58,0x28,0x70,0x61,0x72,
|
|
0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,
|
|
0x31,0x34,0x20,0x3d,0x20,0x64,0x6f,0x74,0x28,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,
|
|
0x32,0x30,0x39,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x5f,0x32,0x32,0x33,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x28,
|
|
0x28,0x5f,0x32,0x30,0x39,0x20,0x2a,0x20,0x28,0x32,0x2e,0x30,0x66,0x20,0x2a,0x20,
|
|
0x5f,0x32,0x31,0x34,0x29,0x29,0x20,0x2d,0x20,0x5f,0x31,0x38,0x32,0x29,0x2e,0x7a,
|
|
0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x33,0x32,0x20,0x3d,0x20,0x6d,0x61,
|
|
0x78,0x28,0x5f,0x32,0x31,0x34,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32,0x32,0x33,0x20,
|
|
0x3e,0x20,0x30,0x2e,0x30,0x66,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6e,0x5f,
|
|
0x64,0x6f,0x74,0x5f,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,
|
|
0x20,0x3d,0x20,0x5f,0x32,0x32,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,
|
|
0x5f,0x36,0x20,0x3d,0x20,0x5f,0x31,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x35,
|
|
0x34,0x20,0x3d,0x20,0x28,0x73,0x6d,0x69,0x74,0x68,0x47,0x67,0x67,0x78,0x49,0x62,
|
|
0x6c,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,
|
|
0x5f,0x35,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x29,0x20,0x2a,0x20,0x5f,
|
|
0x32,0x33,0x32,0x29,0x20,0x2f,0x20,0x6d,0x61,0x78,0x28,0x6d,0x61,0x78,0x28,0x5f,
|
|
0x32,0x30,0x39,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x20,0x2a,0x20,0x6e,
|
|
0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,
|
|
0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,
|
|
0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x36,0x66,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x5f,0x32,0x36,0x30,0x20,0x3d,0x20,0x70,0x6f,0x77,0x28,0x6d,0x61,
|
|
0x78,0x28,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x5f,
|
|
0x32,0x33,0x32,0x29,0x2c,0x20,0x35,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x41,0x20,0x2b,0x3d,0x20,0x28,0x28,
|
|
0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x5f,0x32,0x36,0x30,0x29,0x20,0x2a,0x20,0x5f,
|
|
0x32,0x35,0x34,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x42,0x20,0x2b,0x3d,0x20,0x28,0x5f,0x32,0x36,0x30,0x20,0x2a,0x20,0x5f,
|
|
0x32,0x35,0x34,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,
|
|
0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x41,0x2c,0x20,0x42,0x29,0x20,0x2a,0x20,
|
|
0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x2e,0x78,0x78,
|
|
0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,
|
|
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x76,0x5f,
|
|
0x75,0x76,0x2e,0x78,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
|
|
0x30,0x30,0x34,0x37,0x34,0x39,0x37,0x34,0x35,0x31,0x33,0x30,0x35,0x33,0x38,0x39,
|
|
0x34,0x30,0x34,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,
|
|
0x20,0x6d,0x61,0x78,0x28,0x76,0x5f,0x75,0x76,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,
|
|
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x34,0x39,0x37,0x34,0x35,
|
|
0x31,0x33,0x30,0x35,0x33,0x38,0x39,0x34,0x30,0x34,0x32,0x39,0x36,0x38,0x37,0x35,
|
|
0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,
|
|
0x72,0x20,0x3d,0x20,0x69,0x6e,0x74,0x65,0x67,0x72,0x61,0x74,0x65,0x42,0x52,0x44,
|
|
0x46,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,
|
|
0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
|
|
0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,
|
|
0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,
|
|
0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x76,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
|
|
0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,
|
|
0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,
|
|
0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6f,
|
|
0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
|
|
0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,
|
|
0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
|
};
|
|
/*
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct ub_brdf
|
|
{
|
|
float4 params;
|
|
};
|
|
|
|
struct main0_out
|
|
{
|
|
float2 v_uv [[user(locn0)]];
|
|
float4 gl_Position [[position]];
|
|
};
|
|
|
|
vertex main0_out main0(constant ub_brdf& _45 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]])
|
|
{
|
|
main0_out out = {};
|
|
float2 _27 = (float2(float((int(gl_VertexIndex) << 1) & 2), float(int(gl_VertexIndex) & 2)) * 2.0) - float2(1.0);
|
|
float _34 = _27.x;
|
|
out.v_uv = float2((_34 * 0.5) + 0.5, 0.5 + ((_27.y * 0.5) * _45.params.x));
|
|
out.gl_Position = float4(_34, _27.y, 0.0, 1.0);
|
|
return out;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t brdf_lut_vs_source_metal_macos[619] = {
|
|
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,0x75,
|
|
0x62,0x5f,0x62,0x72,0x64,0x66,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,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,0x32,0x20,0x76,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,0x76,0x65,0x72,
|
|
0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
|
|
0x69,0x6e,0x30,0x28,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x62,0x5f,
|
|
0x62,0x72,0x64,0x66,0x26,0x20,0x5f,0x34,0x35,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,
|
|
0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,
|
|
0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x5b,0x5b,0x76,
|
|
0x65,0x72,0x74,0x65,0x78,0x5f,0x69,0x64,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,0x32,
|
|
0x20,0x5f,0x32,0x37,0x20,0x3d,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x28,0x28,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,
|
|
0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x3c,0x3c,0x20,0x31,0x29,0x20,
|
|
0x26,0x20,0x32,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x69,0x6e,0x74,0x28,
|
|
0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,
|
|
0x26,0x20,0x32,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2d,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x32,0x28,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x34,0x20,0x3d,0x20,0x5f,0x32,0x37,0x2e,
|
|
0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x76,0x5f,0x75,0x76,0x20,
|
|
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x28,0x5f,0x33,0x34,0x20,0x2a,0x20,
|
|
0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35,0x2c,0x20,0x30,0x2e,0x35,0x20,
|
|
0x2b,0x20,0x28,0x28,0x5f,0x32,0x37,0x2e,0x79,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,
|
|
0x20,0x2a,0x20,0x5f,0x34,0x35,0x2e,0x70,0x61,0x72,0x61,0x6d,0x73,0x2e,0x78,0x29,
|
|
0x29,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,
|
|
0x5f,0x33,0x34,0x2c,0x20,0x5f,0x32,0x37,0x2e,0x79,0x2c,0x20,0x30,0x2e,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,
|
|
};
|
|
/*
|
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
|
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct main0_out
|
|
{
|
|
float2 out_color [[color(0)]];
|
|
};
|
|
|
|
struct main0_in
|
|
{
|
|
float2 v_uv [[user(locn0)]];
|
|
};
|
|
|
|
static inline __attribute__((always_inline))
|
|
float radicalInverseVdC(thread uint& bits)
|
|
{
|
|
bits = (bits << 16u) | (bits >> 16u);
|
|
bits = ((bits & 1431655765u) << 1u) | ((bits & 2863311530u) >> 1u);
|
|
bits = ((bits & 858993459u) << 2u) | ((bits & 3435973836u) >> 2u);
|
|
bits = ((bits & 252645135u) << 4u) | ((bits & 4042322160u) >> 4u);
|
|
bits = ((bits & 16711935u) << 8u) | ((bits & 4278255360u) >> 8u);
|
|
return float(bits) * 2.3283064365386962890625e-10;
|
|
}
|
|
|
|
static inline __attribute__((always_inline))
|
|
float2 hammersley(thread const uint& i, thread const uint& n)
|
|
{
|
|
uint param = i;
|
|
float _97 = radicalInverseVdC(param);
|
|
return float2(float(i) / float(n), _97);
|
|
}
|
|
|
|
static inline __attribute__((always_inline))
|
|
float3 importanceSampleGGX(thread const float2& Xi, thread const float& alpha)
|
|
{
|
|
float _110 = 6.283185482025146484375 * Xi.x;
|
|
float _123 = sqrt((1.0 - Xi.y) / (1.0 + (((alpha * alpha) - 1.0) * Xi.y)));
|
|
float _131 = sqrt(fast::max(1.0 - (_123 * _123), 0.0));
|
|
return float3(_131 * cos(_110), _131 * sin(_110), _123);
|
|
}
|
|
|
|
static inline __attribute__((always_inline))
|
|
float smithGggxIbl(thread const float& n_dot_v, thread const float& n_dot_l, thread const float& alpha)
|
|
{
|
|
float _149 = (alpha * alpha) * 0.5;
|
|
float _154 = 1.0 - _149;
|
|
return (n_dot_v / ((n_dot_v * _154) + _149)) * (n_dot_l / ((n_dot_l * _154) + _149));
|
|
}
|
|
|
|
static inline __attribute__((always_inline))
|
|
float2 integrateBRDF(thread const float& n_dot_v, thread const float& roughness)
|
|
{
|
|
float3 _182 = float3(sqrt(fast::max(1.0 - (n_dot_v * n_dot_v), 0.0)), 0.0, n_dot_v);
|
|
float A = 0.0;
|
|
float B = 0.0;
|
|
float _188 = roughness * roughness;
|
|
for (uint i = 0u; i < 1024u; i++)
|
|
{
|
|
uint param = i;
|
|
uint param_1 = 1024u;
|
|
float2 param_2 = hammersley(param, param_1);
|
|
float param_3 = _188;
|
|
float3 _209 = importanceSampleGGX(param_2, param_3);
|
|
float _214 = dot(_182, _209);
|
|
float _223 = fast::max(((_209 * (2.0 * _214)) - _182).z, 0.0);
|
|
float _232 = fast::max(_214, 0.0);
|
|
if (_223 > 0.0)
|
|
{
|
|
float param_4 = n_dot_v;
|
|
float param_5 = _223;
|
|
float param_6 = _188;
|
|
float _254 = (smithGggxIbl(param_4, param_5, param_6) * _232) / fast::max(fast::max(_209.z, 0.0) * n_dot_v, 9.9999997473787516355514526367188e-06);
|
|
float _260 = powr(fast::max(0.0, 1.0 - _232), 5.0);
|
|
A += ((1.0 - _260) * _254);
|
|
B += (_260 * _254);
|
|
}
|
|
}
|
|
return float2(A, B) * float2(0.0009765625);
|
|
}
|
|
|
|
fragment main0_out main0(main0_in in [[stage_in]])
|
|
{
|
|
main0_out out = {};
|
|
float param = fast::max(in.v_uv.x, 0.001000000047497451305389404296875);
|
|
float param_1 = fast::max(in.v_uv.y, 0.001000000047497451305389404296875);
|
|
out.out_color = integrateBRDF(param, param_1);
|
|
return out;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t brdf_lut_fs_source_metal_macos[3122] = {
|
|
0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69,
|
|
0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64,
|
|
0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74,
|
|
0x6f,0x74,0x79,0x70,0x65,0x73,0x22,0x0a,0x0a,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,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,0x76,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,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,
|
|
0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,
|
|
0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x49,0x6e,0x76,0x65,
|
|
0x72,0x73,0x65,0x56,0x64,0x43,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x75,0x69,
|
|
0x6e,0x74,0x26,0x20,0x62,0x69,0x74,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x62,0x69,0x74,0x73,0x20,0x3c,0x3c,0x20,
|
|
0x31,0x36,0x75,0x29,0x20,0x7c,0x20,0x28,0x62,0x69,0x74,0x73,0x20,0x3e,0x3e,0x20,
|
|
0x31,0x36,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,
|
|
0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x31,0x34,0x33,0x31,0x36,0x35,
|
|
0x35,0x37,0x36,0x35,0x75,0x29,0x20,0x3c,0x3c,0x20,0x31,0x75,0x29,0x20,0x7c,0x20,
|
|
0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x32,0x38,0x36,0x33,0x33,0x31,0x31,
|
|
0x35,0x33,0x30,0x75,0x29,0x20,0x3e,0x3e,0x20,0x31,0x75,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,
|
|
0x26,0x20,0x38,0x35,0x38,0x39,0x39,0x33,0x34,0x35,0x39,0x75,0x29,0x20,0x3c,0x3c,
|
|
0x20,0x32,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,
|
|
0x33,0x34,0x33,0x35,0x39,0x37,0x33,0x38,0x33,0x36,0x75,0x29,0x20,0x3e,0x3e,0x20,
|
|
0x32,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x69,0x74,0x73,0x20,0x3d,0x20,
|
|
0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x32,0x35,0x32,0x36,0x34,0x35,0x31,
|
|
0x33,0x35,0x75,0x29,0x20,0x3c,0x3c,0x20,0x34,0x75,0x29,0x20,0x7c,0x20,0x28,0x28,
|
|
0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x34,0x30,0x34,0x32,0x33,0x32,0x32,0x31,0x36,
|
|
0x30,0x75,0x29,0x20,0x3e,0x3e,0x20,0x34,0x75,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x62,0x69,0x74,0x73,0x20,0x3d,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,
|
|
0x31,0x36,0x37,0x31,0x31,0x39,0x33,0x35,0x75,0x29,0x20,0x3c,0x3c,0x20,0x38,0x75,
|
|
0x29,0x20,0x7c,0x20,0x28,0x28,0x62,0x69,0x74,0x73,0x20,0x26,0x20,0x34,0x32,0x37,
|
|
0x38,0x32,0x35,0x35,0x33,0x36,0x30,0x75,0x29,0x20,0x3e,0x3e,0x20,0x38,0x75,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x28,0x62,0x69,0x74,0x73,0x29,0x20,0x2a,0x20,0x32,0x2e,0x33,0x32,0x38,
|
|
0x33,0x30,0x36,0x34,0x33,0x36,0x35,0x33,0x38,0x36,0x39,0x36,0x32,0x38,0x39,0x30,
|
|
0x36,0x32,0x35,0x65,0x2d,0x31,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x61,0x74,
|
|
0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,
|
|
0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,
|
|
0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
|
0x68,0x61,0x6d,0x6d,0x65,0x72,0x73,0x6c,0x65,0x79,0x28,0x74,0x68,0x72,0x65,0x61,
|
|
0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x26,0x20,0x69,0x2c,
|
|
0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x75,0x69,
|
|
0x6e,0x74,0x26,0x20,0x6e,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,
|
|
0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x39,0x37,0x20,0x3d,0x20,0x72,0x61,0x64,
|
|
0x69,0x63,0x61,0x6c,0x49,0x6e,0x76,0x65,0x72,0x73,0x65,0x56,0x64,0x43,0x28,0x70,
|
|
0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
|
0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x69,
|
|
0x29,0x20,0x2f,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6e,0x29,0x2c,0x20,0x5f,0x39,
|
|
0x37,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,
|
|
0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,
|
|
0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,
|
|
0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x69,0x6d,0x70,0x6f,0x72,
|
|
0x74,0x61,0x6e,0x63,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x47,0x47,0x58,0x28,0x74,
|
|
0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x32,0x26,0x20,0x58,0x69,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,
|
|
0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x61,0x6c,0x70,0x68,
|
|
0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
|
|
0x31,0x31,0x30,0x20,0x3d,0x20,0x36,0x2e,0x32,0x38,0x33,0x31,0x38,0x35,0x34,0x38,
|
|
0x32,0x30,0x32,0x35,0x31,0x34,0x36,0x34,0x38,0x34,0x33,0x37,0x35,0x20,0x2a,0x20,
|
|
0x58,0x69,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x32,0x33,0x20,0x3d,0x20,0x73,0x71,0x72,0x74,0x28,0x28,0x31,0x2e,0x30,
|
|
0x20,0x2d,0x20,0x58,0x69,0x2e,0x79,0x29,0x20,0x2f,0x20,0x28,0x31,0x2e,0x30,0x20,
|
|
0x2b,0x20,0x28,0x28,0x28,0x61,0x6c,0x70,0x68,0x61,0x20,0x2a,0x20,0x61,0x6c,0x70,
|
|
0x68,0x61,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x29,0x20,0x2a,0x20,0x58,0x69,0x2e,
|
|
0x79,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x5f,0x31,0x33,0x31,0x20,0x3d,0x20,0x73,0x71,0x72,0x74,0x28,0x66,0x61,0x73,0x74,
|
|
0x3a,0x3a,0x6d,0x61,0x78,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x32,
|
|
0x33,0x20,0x2a,0x20,0x5f,0x31,0x32,0x33,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x33,0x28,0x5f,0x31,0x33,0x31,0x20,0x2a,0x20,0x63,0x6f,0x73,0x28,0x5f,
|
|
0x31,0x31,0x30,0x29,0x2c,0x20,0x5f,0x31,0x33,0x31,0x20,0x2a,0x20,0x73,0x69,0x6e,
|
|
0x28,0x5f,0x31,0x31,0x30,0x29,0x2c,0x20,0x5f,0x31,0x32,0x33,0x29,0x3b,0x0a,0x7d,
|
|
0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,
|
|
0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,
|
|
0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x73,0x6d,0x69,0x74,0x68,0x47,0x67,0x67,0x78,0x49,0x62,
|
|
0x6c,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x26,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x74,
|
|
0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x26,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x2c,0x20,0x74,0x68,0x72,0x65,
|
|
0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,
|
|
0x61,0x6c,0x70,0x68,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x20,0x5f,0x31,0x34,0x39,0x20,0x3d,0x20,0x28,0x61,0x6c,0x70,0x68,0x61,
|
|
0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x35,0x34,0x20,
|
|
0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x5f,0x31,0x34,0x39,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,
|
|
0x76,0x20,0x2f,0x20,0x28,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x20,0x2a,0x20,
|
|
0x5f,0x31,0x35,0x34,0x29,0x20,0x2b,0x20,0x5f,0x31,0x34,0x39,0x29,0x29,0x20,0x2a,
|
|
0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x20,0x2f,0x20,0x28,0x28,0x6e,0x5f,
|
|
0x64,0x6f,0x74,0x5f,0x6c,0x20,0x2a,0x20,0x5f,0x31,0x35,0x34,0x29,0x20,0x2b,0x20,
|
|
0x5f,0x31,0x34,0x39,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,
|
|
0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,
|
|
0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x69,
|
|
0x6e,0x74,0x65,0x67,0x72,0x61,0x74,0x65,0x42,0x52,0x44,0x46,0x28,0x74,0x68,0x72,
|
|
0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,
|
|
0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,
|
|
0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x72,0x6f,
|
|
0x75,0x67,0x68,0x6e,0x65,0x73,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x38,0x32,0x20,0x3d,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x33,0x28,0x73,0x71,0x72,0x74,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,
|
|
0x61,0x78,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x6e,0x5f,0x64,0x6f,0x74,0x5f,
|
|
0x76,0x20,0x2a,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x29,0x2c,0x20,0x30,0x2e,
|
|
0x30,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,
|
|
0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x41,0x20,
|
|
0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x20,0x42,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x38,0x20,0x3d,0x20,0x72,0x6f,0x75,0x67,0x68,
|
|
0x6e,0x65,0x73,0x73,0x20,0x2a,0x20,0x72,0x6f,0x75,0x67,0x68,0x6e,0x65,0x73,0x73,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x75,0x69,0x6e,0x74,0x20,
|
|
0x69,0x20,0x3d,0x20,0x30,0x75,0x3b,0x20,0x69,0x20,0x3c,0x20,0x31,0x30,0x32,0x34,
|
|
0x75,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,
|
|
0x20,0x3d,0x20,0x69,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x75,0x69,
|
|
0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x30,0x32,
|
|
0x34,0x75,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x68,0x61,0x6d,
|
|
0x6d,0x65,0x72,0x73,0x6c,0x65,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,
|
|
0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,
|
|
0x20,0x5f,0x31,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x30,0x39,0x20,0x3d,0x20,0x69,0x6d,0x70,
|
|
0x6f,0x72,0x74,0x61,0x6e,0x63,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x47,0x47,0x58,
|
|
0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
|
|
0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x20,0x5f,0x32,0x31,0x34,0x20,0x3d,0x20,0x64,0x6f,0x74,0x28,0x5f,0x31,0x38,
|
|
0x32,0x2c,0x20,0x5f,0x32,0x30,0x39,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x32,0x33,0x20,0x3d,0x20,0x66,
|
|
0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x28,0x28,0x5f,0x32,0x30,0x39,0x20,
|
|
0x2a,0x20,0x28,0x32,0x2e,0x30,0x20,0x2a,0x20,0x5f,0x32,0x31,0x34,0x29,0x29,0x20,
|
|
0x2d,0x20,0x5f,0x31,0x38,0x32,0x29,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
|
|
0x32,0x33,0x32,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,
|
|
0x5f,0x32,0x31,0x34,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32,0x32,0x33,0x20,0x3e,0x20,0x30,
|
|
0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
|
0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,
|
|
0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x5f,
|
|
0x32,0x32,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,
|
|
0x20,0x5f,0x31,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x35,0x34,0x20,0x3d,0x20,
|
|
0x28,0x73,0x6d,0x69,0x74,0x68,0x47,0x67,0x67,0x78,0x49,0x62,0x6c,0x28,0x70,0x61,
|
|
0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x2c,0x20,
|
|
0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x29,0x20,0x2a,0x20,0x5f,0x32,0x33,0x32,0x29,
|
|
0x20,0x2f,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x66,0x61,0x73,
|
|
0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x5f,0x32,0x30,0x39,0x2e,0x7a,0x2c,0x20,0x30,
|
|
0x2e,0x30,0x29,0x20,0x2a,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x2c,0x20,0x39,
|
|
0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,
|
|
0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,
|
|
0x65,0x2d,0x30,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x36,0x30,0x20,0x3d,0x20,
|
|
0x70,0x6f,0x77,0x72,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x30,
|
|
0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x5f,0x32,0x33,0x32,0x29,0x2c,
|
|
0x20,0x35,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
|
0x20,0x20,0x20,0x41,0x20,0x2b,0x3d,0x20,0x28,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,
|
|
0x5f,0x32,0x36,0x30,0x29,0x20,0x2a,0x20,0x5f,0x32,0x35,0x34,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x42,0x20,0x2b,0x3d,0x20,
|
|
0x28,0x5f,0x32,0x36,0x30,0x20,0x2a,0x20,0x5f,0x32,0x35,0x34,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,
|
|
0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
|
|
0x28,0x41,0x2c,0x20,0x42,0x29,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,
|
|
0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x7d,
|
|
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,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,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,
|
|
0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x69,0x6e,0x2e,0x76,0x5f,
|
|
0x75,0x76,0x2e,0x78,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
|
|
0x30,0x30,0x34,0x37,0x34,0x39,0x37,0x34,0x35,0x31,0x33,0x30,0x35,0x33,0x38,0x39,
|
|
0x34,0x30,0x34,0x32,0x39,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,
|
|
0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x69,0x6e,0x2e,0x76,0x5f,0x75,
|
|
0x76,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,
|
|
0x30,0x34,0x37,0x34,0x39,0x37,0x34,0x35,0x31,0x33,0x30,0x35,0x33,0x38,0x39,0x34,
|
|
0x30,0x34,0x32,0x39,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,
|
|
0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,
|
|
0x6e,0x74,0x65,0x67,0x72,0x61,0x74,0x65,0x42,0x52,0x44,0x46,0x28,0x70,0x61,0x72,
|
|
0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
|
|
0x0a,0x00,
|
|
};
|
|
static inline const sg_shader_desc* brdf_lut_build_shader_desc(sg_backend backend) {
|
|
if (backend == SG_BACKEND_GLCORE) {
|
|
static sg_shader_desc desc;
|
|
static bool valid;
|
|
if (!valid) {
|
|
valid = true;
|
|
desc.vertex_func.source = (const char*)brdf_lut_vs_source_glsl430;
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = (const char*)brdf_lut_fs_source_glsl430;
|
|
desc.fragment_func.entry = "main";
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 16;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 1;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "ub_brdf";
|
|
desc.label = "brdf_lut_build_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
if (backend == SG_BACKEND_D3D11) {
|
|
static sg_shader_desc desc;
|
|
static bool valid;
|
|
if (!valid) {
|
|
valid = true;
|
|
desc.vertex_func.source = (const char*)brdf_lut_vs_source_hlsl5;
|
|
desc.vertex_func.d3d11_target = "vs_5_0";
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = (const char*)brdf_lut_fs_source_hlsl5;
|
|
desc.fragment_func.d3d11_target = "ps_5_0";
|
|
desc.fragment_func.entry = "main";
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 16;
|
|
desc.uniform_blocks[0].hlsl_register_b_n = 0;
|
|
desc.label = "brdf_lut_build_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
if (backend == SG_BACKEND_METAL_MACOS) {
|
|
static sg_shader_desc desc;
|
|
static bool valid;
|
|
if (!valid) {
|
|
valid = true;
|
|
desc.vertex_func.source = (const char*)brdf_lut_vs_source_metal_macos;
|
|
desc.vertex_func.entry = "main0";
|
|
desc.fragment_func.source = (const char*)brdf_lut_fs_source_metal_macos;
|
|
desc.fragment_func.entry = "main0";
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 16;
|
|
desc.uniform_blocks[0].msl_buffer_n = 0;
|
|
desc.label = "brdf_lut_build_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
return 0;
|
|
}
|