[ 0.102295] Config core/settings.cpp:LogSettings:80: Citra Configuration: [ 0.103299] Config core/settings.cpp:operator():77: Core_UseCpuJit: true [ 0.103304] Config core/settings.cpp:operator():77: Core_CPUClockPercentage: 100 [ 0.103305] Config core/settings.cpp:operator():77: Renderer_UseGLES: false [ 0.103306] Config core/settings.cpp:operator():77: Renderer_UseHwRenderer: true [ 0.103306] Config core/settings.cpp:operator():77: Renderer_UseHwShader: true [ 0.103306] Config core/settings.cpp:operator():77: Renderer_SeparableShader: false [ 0.103307] Config core/settings.cpp:operator():77: Renderer_ShadersAccurateMul: true [ 0.103308] Config core/settings.cpp:operator():77: Renderer_UseShaderJit: true [ 0.103308] Config core/settings.cpp:operator():77: Renderer_UseResolutionFactor: 0 [ 0.103309] Config core/settings.cpp:operator():77: Renderer_FrameLimit: 100 [ 0.103310] Config core/settings.cpp:operator():77: Renderer_UseFrameLimitAlternate: false [ 0.103311] Config core/settings.cpp:operator():77: Renderer_FrameLimitAlternate: 200 [ 0.103311] Config core/settings.cpp:operator():77: Renderer_VSyncNew: true [ 0.103311] Config core/settings.cpp:operator():77: Renderer_PostProcessingShader: none (builtin) [ 0.103312] Config core/settings.cpp:operator():77: Renderer_FilterMode: true [ 0.103312] Config core/settings.cpp:operator():77: Renderer_TextureFilterName: none [ 0.103313] Config core/settings.cpp:operator():77: Stereoscopy_Render3d: 0 [ 0.103313] Config core/settings.cpp:operator():77: Stereoscopy_Factor3d: 0 [ 0.103314] Config core/settings.cpp:operator():77: Layout_LayoutOption: 0 [ 0.103314] Config core/settings.cpp:operator():77: Layout_SwapScreen: false [ 0.103314] Config core/settings.cpp:operator():77: Layout_UprightScreen: false [ 0.103315] Config core/settings.cpp:operator():77: Utility_DumpTextures: false [ 0.103315] Config core/settings.cpp:operator():77: Utility_CustomTextures: false [ 0.103315] Config core/settings.cpp:operator():77: Utility_UseDiskShaderCache: true [ 0.103316] Config core/settings.cpp:operator():77: Audio_EnableDspLle: false [ 0.103316] Config core/settings.cpp:operator():77: Audio_EnableDspLleMultithread: false [ 0.103317] Config core/settings.cpp:operator():77: Audio_OutputEngine: auto [ 0.103317] Config core/settings.cpp:operator():77: Audio_EnableAudioStretching: true [ 0.103317] Config core/settings.cpp:operator():77: Audio_OutputDevice: auto [ 0.103318] Config core/settings.cpp:operator():77: Audio_InputDeviceType: 0 [ 0.103318] Config core/settings.cpp:operator():77: Audio_InputDevice: Default [ 0.103318] Config core/settings.cpp:operator():77: Camera_OuterRightName: blank [ 0.103319] Config core/settings.cpp:operator():77: Camera_OuterRightConfig: [ 0.103319] Config core/settings.cpp:operator():77: Camera_OuterRightFlip: 0 [ 0.103320] Config core/settings.cpp:operator():77: Camera_InnerName: blank [ 0.103320] Config core/settings.cpp:operator():77: Camera_InnerConfig: [ 0.103320] Config core/settings.cpp:operator():77: Camera_InnerFlip: 0 [ 0.103321] Config core/settings.cpp:operator():77: Camera_OuterLeftName: blank [ 0.103321] Config core/settings.cpp:operator():77: Camera_OuterLeftConfig: [ 0.103322] Config core/settings.cpp:operator():77: Camera_OuterLeftFlip: 0 [ 0.103322] Config core/settings.cpp:operator():77: DataStorage_UseVirtualSd: true [ 0.103323] Config core/settings.cpp:operator():77: DataStorage_SdmcDir: G:/Emulators/Citra Nightly x64/user/sdmc/ [ 0.103323] Config core/settings.cpp:operator():77: DataStorage_NandDir: G:/Emulators/Citra Nightly x64/user/nand/ [ 0.103324] Config core/settings.cpp:operator():77: System_IsNew3ds: true [ 0.103324] Config core/settings.cpp:operator():77: System_RegionValue: -1 [ 0.103325] Config core/settings.cpp:operator():77: Debugging_UseGdbstub: false [ 0.103325] Config core/settings.cpp:operator():77: Debugging_GdbstubPort: 24689 [ 0.544479] Input input_common/sdl/sdl_impl.cpp:InitGameController:508: opened joystick 0 as controller [ 0.544499] Input input_common/udp/client.cpp:StartCommunication:207: Starting communication with UDP input server on 127.0.0.1:26760 [ 1.021421] Frontend citra_qt/main.cpp:GMainWindow:197: Citra Version: Nightly 1779 | HEAD-58d0705 [ 1.021782] Frontend citra_qt/main.cpp:GMainWindow:213: Host CPU: Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz | AVX2 | FMA [ 1.021803] Frontend citra_qt/main.cpp:GMainWindow:215: Host OS: Windows 10 (10.0) [ 1.053938] Frontend citra_qt/main.cpp:CheckForUpdates:841: Unable to start check for updates [ 1.054228] Frontend citra_qt/main.cpp:BootGame:1031: Citra starting... [ 1.137236] Service.FS core/file_sys/ncch_container.cpp:Load:242: Secure1 KeyX missing [ 1.137250] Service.FS core/file_sys/ncch_container.cpp:Load:342: NCCH is marked as encrypted but with decrypted exheader. Force no crypto scheme. [ 1.268141] Audio.DSP audio_core/hle/wmf_decoder.cpp:Impl:67: Media Foundation activated [ 1.269700] Audio.DSP audio_core/hle/wmf_decoder_utils.cpp:MFDecoderInit:50: Windows(R) Media Foundation found 1 suitable decoder(s) [ 1.651738] Audio.Sink audio_core/cubeb_sink.cpp:StateCallback:137: Cubeb Audio Stream Started [ 1.651751] RPC_Server core/rpc/rpc_server.cpp:RPCServer:12: Starting RPC server ... [ 1.651903] RPC_Server core/rpc/rpc_server.cpp:RPCServer:16: RPC started. [ 1.652467] RPC_Server core/rpc/rpc_server.cpp:HandleRequestsLoop:113: Request handler started. [ 1.710137] Service.HTTP core/hle/service/http_c.cpp:DecryptClCertA:806: ClCertA file missing [ 1.747621] Render.OpenGL video_core/renderer_opengl/renderer_opengl.cpp:Init:1261: GL_VERSION: 4.6.0 Compatibility Profile Context 22.8.1.220810 [ 1.747627] Render.OpenGL video_core/renderer_opengl/renderer_opengl.cpp:Init:1262: GL_VENDOR: ATI Technologies Inc. [ 1.747628] Render.OpenGL video_core/renderer_opengl/renderer_opengl.cpp:Init:1263: GL_RENDERER: AMD Radeon RX 6900 XT [ 1.826561] Render.OpenGL video_core/renderer_opengl/gl_format_reinterpreter.cpp:ShaderD24S8toRGBA8:291: Texture views are unsupported, reinterpretation will do intermediate copy [ 1.826570] Render.OpenGL video_core/renderer_opengl/gl_format_reinterpreter.cpp:FormatReinterpreterOpenGL:378: Using shader for D24S8 to RGBA8 reinterpretation [ 1.853177] Loader core/loader/ncch.cpp:Load:192: Program ID: 0004000000035800 [ 1.853299] Service.FS core/file_sys/ncch_container.cpp:OpenFile:130: Failed to open G:/Emulators/Citra Nightly x64/user/sdmc/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000/title/0004000e/00035800/content/00000000.app [ 1.884664] Service.FS core/file_sys/ncch_container.cpp:LoadSectionExeFS:505: Attempting to load logo from the ExeFS [ 1.884948] Service.CFG core/hle/service/cfg/cfg.cpp:SetPreferredRegionCodes:656: Preferred region code set to 1 [ 2.631109] Render.OpenGL video_core/renderer_opengl/gl_shader_disk_cache.cpp:LoadTransferable:169: Found a transferable disk cache with 230 entries [ 2.631259] Render.OpenGL video_core/renderer_opengl/gl_shader_disk_cache.cpp:LoadPrecompiled:180: No precompiled shader cache found for game with title id=0004000000035800 [ 2.666285] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.666292] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); if (!(gl_FragCoord.x >= float(scissor_x1) && gl_FragCoord.y >= float(scissor_y1) && gl_FragCoord.x < float(scissor_x2) && gl_FragCoord.y < float(scissor_y2))) discard; float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = const_color[0].rgb; vec3 color_results_0_2 = const_color[0].rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](const_color[0].a, const_color[0].a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; vec3 color_results_5_1 = const_color[5].rgb; vec3 color_results_5_2 = const_color[5].rgb; vec3 color_results_5_3 = const_color[5].rgb; vec3 color_results_5[3] = vec3[3](color_results_5_1, color_results_5_2, color_results_5_3); vec3 color_output_5 = byteround(clamp(color_results_5[0], vec3(0.0), vec3(1.0))); float alpha_results_5[3] = float[3](const_color[5].a, const_color[5].a, const_color[5].a); float alpha_output_5 = byteround(clamp(alpha_results_5[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_5 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_5 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.666304] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.666305] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.686188] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.686196] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); if (!(gl_FragCoord.x >= float(scissor_x1) && gl_FragCoord.y >= float(scissor_y1) && gl_FragCoord.x < float(scissor_x2) && gl_FragCoord.y < float(scissor_y2))) discard; float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); clamp_highlights = sign(dot_product); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += ((1.0 * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_2 = const_color[0].rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; vec3 color_results_2_1 = last_tex_env_out.rgb; vec3 color_results_2_2 = primary_fragment_color.rgb; vec3 color_results_2_3 = secondary_fragment_color.rgb; vec3 color_results_2[3] = vec3[3](color_results_2_1, color_results_2_2, color_results_2_3); vec3 color_output_2 = byteround(clamp(color_results_2[0] * color_results_2[1] + color_results_2[2], vec3(0.0), vec3(1.0))); float alpha_results_2[3] = float[3](last_tex_env_out.a, last_tex_env_out.a, last_tex_env_out.a); float alpha_output_2 = byteround(clamp(alpha_results_2[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_2 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_2 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; if (int(last_tex_env_out.a * 255.0) <= alphatest_ref) discard; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.686209] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.686210] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.727953] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.727965] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.5 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[0].specular_0) + ((0.25 * LookupLightingLUTUnsigned(1, max(dot(normal, normalize(half_vector)), 0.0))) * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; specular_sum.a = (1.0 * LookupLightingLUTUnsigned(3, max(dot(normal, normalize(view)), 0.0))); diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.5 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[1].specular_0) + ((0.25 * LookupLightingLUTUnsigned(1, max(dot(normal, normalize(half_vector)), 0.0))) * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = primary_fragment_color.rgb; vec3 color_results_0_2 = textureLod(tex1, texcoord1, getLod(texcoord1 * vec2(textureSize(tex1, 0)))).rgb; vec3 color_results_0_3 = secondary_fragment_color.rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1] + color_results_0[2], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](const_color[0].a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = texture(tex_cube, vec3(texcoord0, texcoord0_w)).rgb; vec3 color_results_1_2 = const_color[1].rgb; vec3 color_results_1_3 = last_tex_env_out.rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1] + color_results_1[2], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_2_1 = last_tex_env_out.rgb; vec3 color_results_2_2 = secondary_fragment_color.aaa; vec3 color_results_2_3 = rounded_primary_color.rgb; vec3 color_results_2[3] = vec3[3](color_results_2_1, color_results_2_2, color_results_2_3); vec3 color_output_2 = byteround(clamp(min(color_results_2[0] + color_results_2[1], vec3(1.0)) * color_results_2[2], vec3(0.0), vec3(1.0))); float alpha_results_2[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[2].a); float alpha_output_2 = byteround(clamp(alpha_results_2[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_2 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_2 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.728214] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.728219] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.730051] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.730057] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_2 = const_color[0].rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.730065] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.730066] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.735827] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.735835] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[1].specular_0) + (1.0 * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = primary_fragment_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = secondary_fragment_color.rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1] + color_results_0[2], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = last_tex_env_out.rgb; vec3 color_results_1_2 = rounded_primary_color.rgb; vec3 color_results_1_3 = const_color[1].rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[1].a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; if (int(last_tex_env_out.a * 255.0) <= alphatest_ref) discard; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.735848] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.735850] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.753844] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.753860] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.5 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[0].specular_0) + ((0.25 * LookupLightingLUTUnsigned(1, max(dot(normal, normalize(half_vector)), 0.0))) * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; specular_sum.a = (1.0 * LookupLightingLUTUnsigned(3, max(dot(normal, normalize(view)), 0.0))); diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.5 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[1].specular_0) + ((0.25 * LookupLightingLUTUnsigned(1, max(dot(normal, normalize(half_vector)), 0.0))) * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = primary_fragment_color.rgb; vec3 color_results_0_2 = textureLod(tex1, texcoord1, getLod(texcoord1 * vec2(textureSize(tex1, 0)))).rgb; vec3 color_results_0_3 = secondary_fragment_color.rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1] + color_results_0[2], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](const_color[0].a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = texture(tex_cube, vec3(texcoord0, texcoord0_w)).rgb; vec3 color_results_1_2 = const_color[1].rgb; vec3 color_results_1_3 = last_tex_env_out.rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1] + color_results_1[2], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_2_1 = last_tex_env_out.rgb; vec3 color_results_2_2 = secondary_fragment_color.aaa; vec3 color_results_2_3 = rounded_primary_color.rgb; vec3 color_results_2[3] = vec3[3](color_results_2_1, color_results_2_2, color_results_2_3); vec3 color_output_2 = byteround(clamp(min(color_results_2[0] + color_results_2[1], vec3(1.0)) * color_results_2[2], vec3(0.0), vec3(1.0))); float alpha_results_2[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[2].a); float alpha_output_2 = byteround(clamp(alpha_results_2[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_2 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_2 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.753881] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.753883] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.822840] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.822883] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[1].specular_0) + (1.0 * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = primary_fragment_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = secondary_fragment_color.rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1] + color_results_0[2], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = last_tex_env_out.rgb; vec3 color_results_1_2 = rounded_primary_color.rgb; vec3 color_results_1_3 = const_color[1].rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[1].a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; if (int(last_tex_env_out.a * 255.0) <= alphatest_ref) discard; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.822903] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.822904] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.841734] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.841743] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((1.0 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((1.0 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[1].specular_0) + (1.0 * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = texture(tex_cube, vec3(texcoord0, texcoord0_w)).rgb; vec3 color_results_0_2 = const_color[0].rgb; vec3 color_results_0_3 = textureLod(tex1, texcoord1, getLod(texcoord1 * vec2(textureSize(tex1, 0)))).rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1] + color_results_0[2], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = last_tex_env_out.rgb; vec3 color_results_1_2 = primary_fragment_color.rgb; vec3 color_results_1_3 = secondary_fragment_color.rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1] + color_results_1[2], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_2_1 = last_tex_env_out.rgb; vec3 color_results_2_2 = rounded_primary_color.rgb; vec3 color_results_2_3 = const_color[2].rgb; vec3 color_results_2[3] = vec3[3](color_results_2_1, color_results_2_2, color_results_2_3); vec3 color_output_2 = byteround(clamp(color_results_2[0] * color_results_2[1], vec3(0.0), vec3(1.0))); float alpha_results_2[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[2].a); float alpha_output_2 = byteround(clamp(alpha_results_2[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_2 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_2 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.841762] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.841763] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.853292] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.853301] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(view)), 0.0))) * light_src[0].specular_0) + ((0.25 * LookupLightingLUTUnsigned(1, max(dot(normal, normalize(half_vector)), 0.0))) * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(view)), 0.0))) * light_src[1].specular_0) + ((0.25 * LookupLightingLUTUnsigned(1, max(dot(normal, normalize(half_vector)), 0.0))) * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = textureLod(tex1, texcoord1, getLod(texcoord1 * vec2(textureSize(tex1, 0)))).rgb; vec3 color_results_0_2 = textureLod(tex2, texcoord2, getLod(texcoord2 * vec2(textureSize(tex2, 0)))).rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[2] + color_results_0[1] * (vec3(1.0) - color_results_0[2]), vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](const_color[0].a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = textureLod(tex2, texcoord2, getLod(texcoord2 * vec2(textureSize(tex2, 0)))).aaa; vec3 color_results_1_2 = secondary_fragment_color.ggg; vec3 color_results_1_3 = last_tex_env_out.rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1] + color_results_1[2], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; next_combiner_buffer.rgb = last_tex_env_out.rgb; vec3 color_results_2_1 = texture(tex_cube, vec3(texcoord0, texcoord0_w)).rgb; vec3 color_results_2_2 = textureLod(tex2, texcoord2, getLod(texcoord2 * vec2(textureSize(tex2, 0)))).aaa; vec3 color_results_2_3 = last_tex_env_out.aaa; vec3 color_results_2[3] = vec3[3](color_results_2_1, color_results_2_2, color_results_2_3); vec3 color_output_2 = byteround(clamp(color_results_2[0] * color_results_2[1], vec3(0.0), vec3(1.0))); float alpha_results_2[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_2 = byteround(clamp(alpha_results_2[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_2 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_2 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_3_1 = last_tex_env_out.rgb; vec3 color_results_3_2 = const_color[3].rgb; vec3 color_results_3_3 = texture(tex_cube, vec3(texcoord0, texcoord0_w)).rgb; vec3 color_results_3[3] = vec3[3](color_results_3_1, color_results_3_2, color_results_3_3); vec3 color_output_3 = byteround(clamp(color_results_3[0] * color_results_3[1], vec3(0.0), vec3(1.0))); float alpha_results_3[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_3 = byteround(clamp(alpha_results_3[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_3 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_3 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_4_1 = last_tex_env_out.rgb; vec3 color_results_4_2 = combiner_buffer.rgb; vec3 color_results_4_3 = primary_fragment_color.rgb; vec3 color_results_4[3] = vec3[3](color_results_4_1, color_results_4_2, color_results_4_3); vec3 color_output_4 = byteround(clamp(min(color_results_4[0] + color_results_4[1], vec3(1.0)) * color_results_4[2], vec3(0.0), vec3(1.0))); float alpha_results_4[3] = float[3](last_tex_env_out.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a); float alpha_output_4 = byteround(clamp(alpha_results_4[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_4 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_4 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_5_1 = last_tex_env_out.rgb; vec3 color_results_5_2 = rounded_primary_color.rgb; vec3 color_results_5_3 = const_color[5].rgb; vec3 color_results_5[3] = vec3[3](color_results_5_1, color_results_5_2, color_results_5_3); vec3 color_output_5 = byteround(clamp(color_results_5[0] * color_results_5[1], vec3(0.0), vec3(1.0))); float alpha_results_5[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[5].a); float alpha_output_5 = byteround(clamp(alpha_results_5[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_5 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_5 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.853315] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.853316] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.880600] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.880608] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += ((1.0 * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += ((1.0 * light_src[1].specular_0) + (1.0 * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = primary_fragment_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = last_tex_env_out.rgb; vec3 color_results_1_2 = rounded_primary_color.rgb; vec3 color_results_1_3 = const_color[1].rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[1].a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; if (int(last_tex_env_out.a * 255.0) <= alphatest_ref) discard; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.880619] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.880620] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.899603] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.899610] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; light_vector = normalize(light_src[1].position); spot_dir = light_src[1].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[1].diffuse * dot_product) + light_src[1].ambient) * 1.0 * 1.0; specular_sum.rgb += (((0.25 * LookupLightingLUTUnsigned(0, max(dot(normal, normalize(half_vector)), 0.0))) * light_src[1].specular_0) + (1.0 * refl_value * light_src[1].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = primary_fragment_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = secondary_fragment_color.rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1] + color_results_0[2], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = last_tex_env_out.rgb; vec3 color_results_1_2 = rounded_primary_color.rgb; vec3 color_results_1_3 = const_color[1].rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[1], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[1].a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; if (int(last_tex_env_out.a * 255.0) <= alphatest_ref) discard; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.899630] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.899632] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.917724] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.917732] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 diffuse_sum = vec4(0.0, 0.0, 0.0, 1.0); vec4 specular_sum = vec4(0.0, 0.0, 0.0, 1.0); vec3 light_vector = vec3(0.0); vec3 refl_value = vec3(0.0); vec3 spot_dir = vec3(0.0); vec3 half_vector = vec3(0.0); float dot_product = 0.0; float clamp_highlights = 1.0; float geo_factor = 1.0; vec3 surface_normal = vec3(0.0, 0.0, 1.0); vec3 surface_tangent = vec3(1.0, 0.0, 0.0); vec4 normalized_normquat = normalize(normquat); vec3 normal = quaternion_rotate(normalized_normquat, surface_normal); vec3 tangent = quaternion_rotate(normalized_normquat, surface_tangent); vec4 shadow = vec4(1.0); light_vector = normalize(light_src[0].position); spot_dir = light_src[0].spot_direction; half_vector = normalize(view) + light_vector; dot_product = max(dot(light_vector, normal), 0.0); refl_value.r = 1.0; refl_value.g = refl_value.r; refl_value.b = refl_value.r; diffuse_sum.rgb += ((light_src[0].diffuse * dot_product) + light_src[0].ambient) * 1.0 * 1.0; specular_sum.rgb += ((1.0 * light_src[0].specular_0) + (1.0 * refl_value * light_src[0].specular_1)) * clamp_highlights * 1.0 * 1.0; diffuse_sum.rgb += lighting_global_ambient; primary_fragment_color = clamp(diffuse_sum, vec4(0.0), vec4(1.0)); secondary_fragment_color = clamp(specular_sum, vec4(0.0), vec4(1.0)); vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = rounded_primary_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; float fog_index = depth * 128.0; float fog_i = clamp(floor(fog_index), 0.0, 127.0); float fog_f = fog_index - fog_i; vec2 fog_lut_entry = texelFetch(texture_buffer_lut_lf, int(fog_i) + fog_lut_offset).rg; float fog_factor = fog_lut_entry.r + fog_lut_entry.g * fog_f; fog_factor = clamp(fog_factor, 0.0, 1.0); last_tex_env_out.rgb = mix(fog_color.rgb, last_tex_env_out.rgb, fog_factor); gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.917747] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.917748] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 2.929419] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 2.929429] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = rounded_primary_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = secondary_fragment_color.rgb; vec3 color_results_1_2 = last_tex_env_out.rgb; vec3 color_results_1_3 = last_tex_env_out.rgb; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] + color_results_1[1], vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, last_tex_env_out.a, last_tex_env_out.a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; if (int(last_tex_env_out.a * 255.0) <= alphatest_ref) discard; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 2.929447] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 2.929448] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 5.884085] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 5.884114] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = rounded_primary_color.rgb; vec3 color_results_0_2 = textureLod(tex1, texcoord1, getLod(texcoord1 * vec2(textureSize(tex1, 0)))).rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, texture(tex_cube, vec3(texcoord0, texcoord0_w)).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; vec3 color_results_1_1 = last_tex_env_out.rgb; vec3 color_results_1_2 = texture(tex_cube, vec3(texcoord0, texcoord0_w)).rgb; vec3 color_results_1_3 = textureLod(tex1, texcoord1, getLod(texcoord1 * vec2(textureSize(tex1, 0)))).aaa; vec3 color_results_1[3] = vec3[3](color_results_1_1, color_results_1_2, color_results_1_3); vec3 color_output_1 = byteround(clamp(color_results_1[0] * color_results_1[2] + color_results_1[1] * (vec3(1.0) - color_results_1[2]), vec3(0.0), vec3(1.0))); float alpha_results_1[3] = float[3](last_tex_env_out.a, primary_fragment_color.a, const_color[1].a); float alpha_output_1 = byteround(clamp(alpha_results_1[0], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_1 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_1 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; float fog_index = depth * 128.0; float fog_i = clamp(floor(fog_index), 0.0, 127.0); float fog_f = fog_index - fog_i; vec2 fog_lut_entry = texelFetch(texture_buffer_lut_lf, int(fog_i) + fog_lut_offset).rg; float fog_factor = fog_lut_entry.r + fog_lut_entry.g * fog_f; fog_factor = clamp(fog_factor, 0.0, 1.0); last_tex_env_out.rgb = mix(fog_color.rgb, last_tex_env_out.rgb, fog_factor); gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 5.884129] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 5.884130] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked [ 5.896535] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:63: Error compiling fragment shader: WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:29: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression WARNING: 0:133: 'defined' : nonportable when expanded from macros for preprocessor expression ERROR: 0:149: 'imageSize' : no matching overloaded function found ERROR: 0:149: '' : missing #endif ERROR: 0:149: '' : compilation terminated ERROR: 3 compilation errors. No code generated. [ 5.896544] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadShader:65: Shader source code: #version 330 #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #extension GL_ARB_separate_shader_objects : enable layout (location=1) in vec4 primary_color; layout (location=2) in vec2 texcoord0; layout (location=3) in vec2 texcoord1; layout (location=4) in vec2 texcoord2; layout (location=5) in float texcoord0_w; layout (location=6) in vec4 normquat; layout (location=7) in vec3 view; #ifndef CITRA_GLES in vec4 gl_FragCoord; #endif // CITRA_GLES out vec4 color; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform samplerCube tex_cube; uniform samplerBuffer texture_buffer_lut_lf; uniform samplerBuffer texture_buffer_lut_rg; uniform samplerBuffer texture_buffer_lut_rgba; #if ALLOW_SHADOW layout(r32ui) uniform readonly uimage2D shadow_texture_px; layout(r32ui) uniform readonly uimage2D shadow_texture_nx; layout(r32ui) uniform readonly uimage2D shadow_texture_py; layout(r32ui) uniform readonly uimage2D shadow_texture_ny; layout(r32ui) uniform readonly uimage2D shadow_texture_pz; layout(r32ui) uniform readonly uimage2D shadow_texture_nz; layout(r32ui) uniform uimage2D shadow_buffer; #endif #define NUM_TEV_STAGES 6 #define NUM_LIGHTS 8 #define NUM_LIGHTING_SAMPLERS 24 struct LightSrc { vec3 specular_0; vec3 specular_1; vec3 diffuse; vec3 ambient; vec3 position; vec3 spot_direction; float dist_atten_bias; float dist_atten_scale; }; layout (std140) uniform shader_data { int framebuffer_scale; int alphatest_ref; float depth_scale; float depth_offset; float shadow_bias_constant; float shadow_bias_linear; int scissor_x1; int scissor_y1; int scissor_x2; int scissor_y2; int fog_lut_offset; int proctex_noise_lut_offset; int proctex_color_map_offset; int proctex_alpha_map_offset; int proctex_lut_offset; int proctex_diff_lut_offset; float proctex_bias; int shadow_texture_bias; ivec4 lighting_lut_offset[NUM_LIGHTING_SAMPLERS / 4]; vec3 fog_color; vec2 proctex_noise_f; vec2 proctex_noise_a; vec2 proctex_noise_p; vec3 lighting_global_ambient; LightSrc light_src[NUM_LIGHTS]; vec4 const_color[NUM_TEV_STAGES]; vec4 tev_combiner_buffer_color; vec4 clip_coef; }; // Rotate the vector v by the quaternion q vec3 quaternion_rotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } float LookupLightingLUT(int lut_index, int index, float delta) { vec2 entry = texelFetch(texture_buffer_lut_lf, lighting_lut_offset[lut_index >> 2][lut_index & 3] + index).rg; return entry.r + entry.g * delta; } float LookupLightingLUTUnsigned(int lut_index, float pos) { int index = clamp(int(pos * 256.0), 0, 255); float delta = pos * 256.0 - float(index); return LookupLightingLUT(lut_index, index, delta); } float LookupLightingLUTSigned(int lut_index, float pos) { int index = clamp(int(pos * 128.0), -128, 127); float delta = pos * 128.0 - float(index); if (index < 0) index += 256; return LookupLightingLUT(lut_index, index, delta); } float byteround(float x) { return round(x * 255.0) * (1.0 / 255.0); } vec2 byteround(vec2 x) { return round(x * 255.0) * (1.0 / 255.0); } vec3 byteround(vec3 x) { return round(x * 255.0) * (1.0 / 255.0); } vec4 byteround(vec4 x) { return round(x * 255.0) * (1.0 / 255.0); } // PICA's LOD formula for 2D textures. // This LOD formula is the same as the LOD lower limit defined in OpenGL. // f(x, y) >= max{m_u, m_v, m_w} // (See OpenGL 4.6 spec, 8.14.1 - Scale Factor and Level-of-Detail) float getLod(vec2 coord) { vec2 d = max(abs(dFdx(coord)), abs(dFdy(coord))); return log2(max(d.x, d.y)); } #if ALLOW_SHADOW uvec2 DecodeShadow(uint pixel) { return uvec2(pixel >> 8, pixel & 0xFFu); } uint EncodeShadow(uvec2 pixel) { return (pixel.x << 8) | pixel.y; } float CompareShadow(uint pixel, uint z) { uvec2 p = DecodeShadow(pixel); return mix(float(p.y) * (1.0 / 255.0), 0.0, p.x <= z); } float SampleShadow2D(ivec2 uv, uint z) { if (any(bvec4( lessThan(uv, ivec2(0)), greaterThanEqual(uv, imageSize(shadow_texture_px)) ))) return 1.0; return CompareShadow(imageLoad(shadow_texture_px, uv).x, z); } float mix2(vec4 s, vec2 a) { vec2 t = mix(s.xy, s.zw, a.yy); return mix(t.x, t.y, a.x); } vec4 shadowTexture(vec2 uv, float w) { uv /= w;uint z = uint(max(0, int(min(abs(w), 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(imageSize(shadow_texture_px)) * uv - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i = ivec2(coord_floor); vec4 s = vec4( SampleShadow2D(i , z), SampleShadow2D(i + ivec2(1, 0), z), SampleShadow2D(i + ivec2(0, 1), z), SampleShadow2D(i + ivec2(1, 1), z)); return vec4(mix2(s, f)); } vec4 shadowTextureCube(vec2 uv, float w) { ivec2 size = imageSize(shadow_texture_px); vec3 c = vec3(uv, w); vec3 a = abs(c); if (a.x > a.y && a.x > a.z) { w = a.x; uv = -c.zy; if (c.x < 0.0) uv.x = -uv.x; } else if (a.y > a.z) { w = a.y; uv = c.xz; if (c.y < 0.0) uv.y = -uv.y; } else { w = a.z; uv = -c.xy; if (c.z > 0.0) uv.x = -uv.x; } uint z = uint(max(0, int(min(w, 1.0) * float(0xFFFFFF)) - shadow_texture_bias)); vec2 coord = vec2(size) * (uv / w * vec2(0.5) + vec2(0.5)) - vec2(0.5); vec2 coord_floor = floor(coord); vec2 f = coord - coord_floor; ivec2 i00 = ivec2(coord_floor); ivec2 i10 = i00 + ivec2(1, 0); ivec2 i01 = i00 + ivec2(0, 1); ivec2 i11 = i00 + ivec2(1, 1); ivec2 cmin = ivec2(0), cmax = size - ivec2(1, 1); i00 = clamp(i00, cmin, cmax); i10 = clamp(i10, cmin, cmax); i01 = clamp(i01, cmin, cmax); i11 = clamp(i11, cmin, cmax); uvec4 pixels; // This part should have been refactored into functions, // but many drivers don't like passing uimage2D as parameters if (a.x > a.y && a.x > a.z) { if (c.x > 0.0) pixels = uvec4( imageLoad(shadow_texture_px, i00).r, imageLoad(shadow_texture_px, i10).r, imageLoad(shadow_texture_px, i01).r, imageLoad(shadow_texture_px, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nx, i00).r, imageLoad(shadow_texture_nx, i10).r, imageLoad(shadow_texture_nx, i01).r, imageLoad(shadow_texture_nx, i11).r); } else if (a.y > a.z) { if (c.y > 0.0) pixels = uvec4( imageLoad(shadow_texture_py, i00).r, imageLoad(shadow_texture_py, i10).r, imageLoad(shadow_texture_py, i01).r, imageLoad(shadow_texture_py, i11).r); else pixels = uvec4( imageLoad(shadow_texture_ny, i00).r, imageLoad(shadow_texture_ny, i10).r, imageLoad(shadow_texture_ny, i01).r, imageLoad(shadow_texture_ny, i11).r); } else { if (c.z > 0.0) pixels = uvec4( imageLoad(shadow_texture_pz, i00).r, imageLoad(shadow_texture_pz, i10).r, imageLoad(shadow_texture_pz, i01).r, imageLoad(shadow_texture_pz, i11).r); else pixels = uvec4( imageLoad(shadow_texture_nz, i00).r, imageLoad(shadow_texture_nz, i10).r, imageLoad(shadow_texture_nz, i01).r, imageLoad(shadow_texture_nz, i11).r); } vec4 s = vec4( CompareShadow(pixels.x, z), CompareShadow(pixels.y, z), CompareShadow(pixels.z, z), CompareShadow(pixels.w, z)); return vec4(mix2(s, f)); } #else vec4 shadowTexture(vec2 uv, float w) { return vec4(1.0); } vec4 shadowTextureCube(vec2 uv, float w) { return vec4(1.0); } #endif void main() { vec4 rounded_primary_color = byteround(primary_color); vec4 primary_fragment_color = vec4(0.0); vec4 secondary_fragment_color = vec4(0.0); float z_over_w = 2.0 * gl_FragCoord.z - 1.0; float depth = z_over_w * depth_scale + depth_offset; vec4 combiner_buffer = vec4(0.0); vec4 next_combiner_buffer = tev_combiner_buffer_color; vec4 last_tex_env_out = vec4(0.0); vec3 color_results_0_1 = rounded_primary_color.rgb; vec3 color_results_0_2 = textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).rgb; vec3 color_results_0_3 = const_color[0].rgb; vec3 color_results_0[3] = vec3[3](color_results_0_1, color_results_0_2, color_results_0_3); vec3 color_output_0 = byteround(clamp(color_results_0[0] * color_results_0[1], vec3(0.0), vec3(1.0))); float alpha_results_0[3] = float[3](rounded_primary_color.a, textureLod(tex0, texcoord0, getLod(texcoord0 * vec2(textureSize(tex0, 0)))).a, const_color[0].a); float alpha_output_0 = byteround(clamp(alpha_results_0[0] * alpha_results_0[1], 0.0, 1.0)); last_tex_env_out = vec4(clamp(color_output_0 * 1.0, vec3(0.0), vec3(1.0)), clamp(alpha_output_0 * 1.0, 0.0, 1.0)); combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; combiner_buffer = next_combiner_buffer; gl_FragDepth = depth; color = byteround(last_tex_env_out); } [ 5.896576] Render.OpenGL video_core/renderer_opengl/gl_shader_util.cpp:LoadProgram:102: Error linking shader: Program Link Failed for unknown reason. [ 5.896578] Debug video_core/renderer_opengl/gl_shader_util.cpp:operator():106: Assertion Failed! Shader not linked