mirror of
https://github.com/holub/mame
synced 2025-06-02 19:06:43 +03:00

* Sync with bgfx upstream revision b91d0b6 * Sync with bx upstream revision d60912b * Sync with bimg upstream revision bd81f60 * Add astc-codec decoder * Rename VertexDecl to VertexLayout * Rename UniformType enum Int1 to Sampler. * Add NVN stub * Fix unused-const-variable error on macOS * Drop redundant explicit language parameters buildoptions_cpp are only applied to c++ files and buildoptions_objcpp are only applied to objective c++ files. As such, hardcoding -x offers no benefit while preventing overrides (such as one needed by 3rdparty/bgfx/src/renderer_vk.cpp on macOS) from working. * Re-introduce -x c++ in places where C code is compiled as C++ to prevent clang from throwing a warning * Build bgfx as Objective-C++ on macOS It is needed due to included headers * Enable Direct3D12 and Vulkan bgfx rendering backends * Enable building of spirv shaders * Properly escape /c in cmd call * Comment out dx12 bgfx renderer * Honor VERBOSE setting during shaders build * Only invert hlsl shader XYZ_TO_sRGB matrix for opengl * Add spirv shaders * OpenGL ES needs transposed matrix too * Metal needs transposed matrix as well
36 lines
1009 B
Python
36 lines
1009 B
Python
$input v_texcoord0
|
|
|
|
/*
|
|
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
|
|
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
*/
|
|
|
|
#include "common.sh"
|
|
|
|
SAMPLER2DARRAY(s_normal, 0);
|
|
SAMPLER2D(s_depth, 1);
|
|
|
|
uniform vec4 u_lightPosRadius[1];
|
|
uniform vec4 u_lightRgbInnerR[1];
|
|
uniform mat4 u_mtx;
|
|
|
|
void main()
|
|
{
|
|
vec3 normal = decodeNormalUint(texture2DArray(s_normal, vec3(v_texcoord0, 1.0) ).xyz);
|
|
float deviceDepth = texture2D(s_depth, v_texcoord0).x;
|
|
float depth = toClipSpaceDepth(deviceDepth);
|
|
|
|
vec3 clip = vec3(v_texcoord0 * 2.0 - 1.0, depth);
|
|
#if !BGFX_SHADER_LANGUAGE_GLSL
|
|
clip.y = -clip.y;
|
|
#endif // !BGFX_SHADER_LANGUAGE_GLSL
|
|
vec3 wpos = clipToWorld(u_mtx, clip);
|
|
|
|
vec3 view = mul(u_view, vec4(wpos, 0.0) ).xyz;
|
|
view = -normalize(view);
|
|
|
|
vec3 lightColor = calcLight(wpos, normal, view, u_lightPosRadius[0].xyz, u_lightPosRadius[0].w, u_lightRgbInnerR[0].xyz, u_lightRgbInnerR[0].w);
|
|
gl_FragColor.xyz = toGamma(lightColor.xyz);
|
|
gl_FragColor.w = 1.0;
|
|
}
|