diff options
| author | 2016-03-28 22:58:16 +0200 | |
|---|---|---|
| committer | 2016-03-28 22:58:32 +0200 | |
| commit | c0b118271258cae30a9eaff517e91c1d8c96231e (patch) | |
| tree | a8fd89ccf05a0733f542289464e906ea0b8fcf64 | |
| parent | 68ebc2b0e5b454c848f5343f16afacca8135674b (diff) | |
Final bgfx fixups for release
56 files changed, 449 insertions, 104 deletions
diff --git a/bgfx/chains/default.json b/bgfx/chains/default.json index 9888b590727..1142275e528 100644 --- a/bgfx/chains/default.json +++ b/bgfx/chains/default.json @@ -7,14 +7,14 @@ } ], "passes": [ - { "effect": "blit", + { "effect": "default\blit", "name": "Copy To Unstretched Texture", "input": [ { "sampler": "s_tex", "texture": "screen" } ], "output": "temp" }, - { "effect": "blit", + { "effect": "default\blit", "name": "Final Upscale", "input": [ { "sampler": "s_tex", "target": "temp" } diff --git a/bgfx/chains/hlsl.json b/bgfx/chains/hlsl.json index 17757bb8c38..3353f92018a 100644 --- a/bgfx/chains/hlsl.json +++ b/bgfx/chains/hlsl.json @@ -88,27 +88,27 @@ { "type": "color", "name": "phosphor", "text": "Phosphor Persistence, ", "default": [ 55, 55, 55 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_alpha", "text": "Scanline Amount", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_scale", "text": "Overall Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_bright_scale", "text": "Scanline Brightness Scale", "default": 200, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_bright_offset", "text": "Scanline Brightness Offset", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_jitter_amount", "text": "Scanline Jitter Amount", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_height", "text": "Individual Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "shadow_alpha", "text": "Shadow Mask Amount", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "vec2", "name": "shadow_uv_size", "text": "Shadow Mask UV Size ", "default": [ 250, 333 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" }, - { "type": "vec2", "name": "shadow_uv_offset", "text": "Shadow Mask UV Offset ", "default": [ 0, 0 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" }, - { "type": "intenum", "name": "shadow_tile_mode", "text": "Shadow Mask Tile Mode", "default": 0, "max": 1, "min": 0, "step": 1, "scale": 1.0, "format": "%s", "screen": "crt", "strings": [ "Screen", "Source" ] }, - { "type": "float", "name": "humbar_alpha", "text": "Hum Bar Amount", "default": 5, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 100, "max": 10000, "min": 0, "step": 1, "scale": 0.00001, "format": "%1.7f", "screen": "crt" }, - { "type": "color", "name": "floor", "text": "Signal Floor, ", "default": [ 5, 5, 5 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "color", "name": "power", "text": "Signal Exponent, ", "default": [ 100, 100, 100 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_alpha", "text": "Scanline Amount", "default": 40, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_scale", "text": "Overall Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_bright_scale", "text": "Scanline Brightness Scale", "default": 200, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_bright_offset", "text": "Scanline Brightness Offset", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_jitter_amount", "text": "Scanline Jitter Amount", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_height", "text": "Individual Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "shadow_alpha", "text": "Shadow Mask Amount", "default": 20, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "vec2", "name": "shadow_uv_count", "text": "Shadow Mask Pixel Count ", "default": [ 12, 12 ], "max": [ 128, 128 ], "min": [ 1, 1 ], "step": 1, "scale": 1.0, "format": "%3f", "screen": "crt" }, + { "type": "vec2", "name": "shadow_uv_size", "text": "Shadow Mask UV Size ", "default": [ 500, 500 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" }, + { "type": "vec2", "name": "shadow_uv_offset", "text": "Shadow Mask UV Offset ", "default": [ 0, 0 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" }, + { "type": "float", "name": "humbar_alpha", "text": "Hum Bar Amount", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 100, "max": 10000, "min": 0, "step": 1, "scale": 0.00001, "format": "%1.7f", "screen": "crt" }, + { "type": "color", "name": "floor", "text": "Signal Floor, ", "default": [ 5, 5, 5 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "color", "name": "power", "text": "Signal Exponent, ", "default": [ 80, 80, 80 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "curvature", "text": "Screen Curvature Amount", "default": 25, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "curvature", "text": "Screen Curvature Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "float", "name": "round_corner", "text": "Rounded Corner Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "float", "name": "smooth_border", "text": "Smooth Border Amount", "default": 5, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "float", "name": "vignetting", "text": "Vignetting Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 25, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" } + { "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" } ], // parameters (optional): A list of procedurally-generated parameters that can be bound to entry uniforms. @@ -172,7 +172,7 @@ { // effect (required): The name of the effect JSON file to load for this pass. // value: Any valid JSON filename included in your shader chain, without the extension. - "effect": "ntsc_encode", + "effect": "hlsl/ntsc_encode", // name (required): A verbal name for the effect. It is only used internally, but is required nonetheless. // value: Any valid ASCII string. @@ -254,7 +254,7 @@ // value: Any valid ASCII string that names a target. "output": "guest" }, - { "effect": "ntsc_decode", + { "effect": "hlsl/ntsc_decode", "name": "NTSC Decode", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -278,7 +278,7 @@ ], "output": "guest" }, - { "effect": "blit", + { "effect": "hlsl/blit", "name": "NTSC Skip", "disablewhen": [ { "type": "slider", "condition": "notequal", "combine": "and", "name": "adjustments", "value": 0 }, @@ -289,7 +289,7 @@ ], "output": "guest" }, - { "effect": "color", + { "effect": "hlsl/color", "name": "Color Convolution", "disablewhen": [ { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 } @@ -307,14 +307,14 @@ ], "output": "guest" }, - { "effect": "prescale", + { "effect": "hlsl/prescale", "name": "Prescale", "input": [ { "sampler": "s_tex", "target": "guest" } ], "output": "internal" }, - { "effect": "deconverge", + { "effect": "hlsl/deconverge", "name": "Deconvergence", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -338,7 +338,7 @@ ], "output": "internal" }, - { "effect": "defocus", + { "effect": "hlsl/defocus", "name": "Defocus Pass 1", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -352,7 +352,7 @@ ], "output": "internal" }, - { "effect": "defocus", + { "effect": "hlsl/defocus", "name": "Defocus Pass 2", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -366,7 +366,7 @@ ], "output": "internal" }, - { "effect": "phosphor", + { "effect": "hlsl/phosphor", "name": "Phosphor Decay", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -382,7 +382,7 @@ ], "output": "internal" }, - { "effect": "phosphor", + { "effect": "hlsl/phosphor", "name": "Phosphor Store", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -398,7 +398,7 @@ ], "output": "previous" }, - { "effect": "post", + { "effect": "hlsl/post", "name": "Non-Bloom Post Pass", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -416,9 +416,9 @@ { "uniform": "u_scanline_height", "slider": "scanline_height" }, { "uniform": "u_scanline_variation", "slider": "scanline_variation" }, { "uniform": "u_shadow_alpha", "slider": "shadow_alpha" }, + { "uniform": "u_shadow_count", "slider": "shadow_uv_count" }, { "uniform": "u_shadow_uv", "slider": "shadow_uv_size" }, { "uniform": "u_shadow_uv_offset", "slider": "shadow_uv_offset" }, - { "uniform": "u_shadow_tile_mode", "slider": "shadow_tile_mode" }, { "uniform": "u_humbar_alpha", "slider": "humbar_alpha" }, { "uniform": "u_humbar_hertz_rate", "slider": "humbar_hertz_rate" }, { "uniform": "u_floor", "slider": "floor" }, @@ -433,7 +433,7 @@ ], "output": "internal" }, - { "effect": "distortion", + { "effect": "hlsl/distortion", "name": "Distortion Pass", "disablewhen": [ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, @@ -455,7 +455,7 @@ ], "output": "internal" }, - { "effect": "blit", + { "effect": "hlsl/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/chains/unfiltered.json b/bgfx/chains/unfiltered.json index ac9556a1a41..19d74cd5eec 100644 --- a/bgfx/chains/unfiltered.json +++ b/bgfx/chains/unfiltered.json @@ -7,14 +7,14 @@ } ], "passes": [ - { "effect": "blit", + { "effect": "unfiltered\blit", "name": "Copy To Unstretched Texture", "input": [ { "sampler": "s_tex", "texture": "screen" } ], "output": "temp" }, - { "effect": "blit", + { "effect": "unfiltered\blit", "name": "Final Upscale", "input": [ { "sampler": "s_tex", "target": "temp" } diff --git a/bgfx/effects/default/LICENSE b/bgfx/effects/default/LICENSE new file mode 100644 index 00000000000..e1a4f1f53d6 --- /dev/null +++ b/bgfx/effects/default/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016, Ryan Holtz and MAME Development Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of bsd3 nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bgfx/effects/default/README.md b/bgfx/effects/default/README.md new file mode 100644 index 00000000000..72aad88f861 --- /dev/null +++ b/bgfx/effects/default/README.md @@ -0,0 +1,5 @@ +# **BGFX shader effects** # + +Cointains definitions for BGFX shader effects + +Licensed under [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause) by Ryan Holtz and MAME Development Team diff --git a/bgfx/effects/blit.json b/bgfx/effects/default/blit.json index bbc9fd295d4..bbc9fd295d4 100644 --- a/bgfx/effects/blit.json +++ b/bgfx/effects/default/blit.json diff --git a/bgfx/effects/hlsl/LICENSE b/bgfx/effects/hlsl/LICENSE new file mode 100644 index 00000000000..e1a4f1f53d6 --- /dev/null +++ b/bgfx/effects/hlsl/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016, Ryan Holtz and MAME Development Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of bsd3 nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bgfx/effects/hlsl/README.md b/bgfx/effects/hlsl/README.md new file mode 100644 index 00000000000..72aad88f861 --- /dev/null +++ b/bgfx/effects/hlsl/README.md @@ -0,0 +1,5 @@ +# **BGFX shader effects** # + +Cointains definitions for BGFX shader effects + +Licensed under [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause) by Ryan Holtz and MAME Development Team diff --git a/bgfx/effects/hlsl/blit.json b/bgfx/effects/hlsl/blit.json new file mode 100644 index 00000000000..bbc9fd295d4 --- /dev/null +++ b/bgfx/effects/hlsl/blit.json @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// blit.json: A simple texture-to-target copy. +// +//============================================================ +{ + // blend (required): The blend state for this effect. + "blend": { + // equation (optional): What equation to perform on the source and destination blend values. + // values: "add", "sub", "revSub", "min", "max" + // default: "add" + // + // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" + "equation": "add", + + // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. + // values: "0", "1", "srcColor", "1-srcColor", "dstColor", "1-dstColor", "srcAlpha", "1-srcAlpha", "dstAlpha", "1-dstAlpha" + // defaults (srcColor, srcAlpha): "1" + // defaults (dstColor, dstAlpha): "0" + // + // "zero", "one", "invSrcColor", "invDstColor", "invSrcAlpha", and "invDstAlpha" are provided as aliases for "0", "1", "1-srcColor", "1-dstColor", "1-srcAlpha", and "1-dstAlpha" + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + + // depth (required): The depth state for this effect. + "depth": { + // function (optional): The depth function to use when drawing. + // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" + // default: "always" + "function": "always", + + // writeenable (optional): Whether to store Z-buffer data. + // values: true, false + // default: false + "writeenable": false + }, + + // cull (required): The cull mode for this effect. + "cull": { + // mode (optional): What winding, if any, to cull. + // values: "none", "cw", "ccw" + // default: "ccw" + // + // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" + "mode": "none" + }, + + // write (required): Write enable for color and alpha channels. + "write": { + // rgb (optional): Whether to store color data when drawing. + // values: true, false + // default: false + "rgb": true, + + // alpha (optional): Whether to store alpha data when drawing. + // values: true, false + // default: false + "alpha": true + }, + + // vertex (required): The vertex shader to use when drawing. + // value: A string containing the name of a shader file to use, minus the extension. + "vertex": "vs_blit", + + // pixel/fragment (required): The pixel or fragment shader to use when drawing. + // value: A string containing the name of a shader file to use, minus the extension. + "fragment": "fs_blit", + + // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. + "uniforms": [ + { + // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. + // value: A string containing the name of the uniform as described above. + // + // NOTE: Some names correspond to special values that will be automatically filled by the BGFX + // code if they are used by the shader. These names are: + // "u_screen_dims" + // The dimensions of the first texture input if present, otherwise the dimensions of the output window. + // Valid values: xy + // "u_inv_screen_dims" + // The reciprocal of u_screen_dims. + // Valid values: xy + // "u_source_dims" + // The size, in pixels, of the screen texture incoming to the chain. + // Valid values: xy + // "u_rotation_type" + // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. + // Valid values: x + // "u_swap_xy" + // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. + // Valid values: x + // "u_quad_dims" + // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. + // Valid values: xy + // "u_tex_sizeN" + // The dimensions, in pixels, of the texture in input pair N. Starts at 0. + // valid values: xy + "name": "s_tex", + + // type (required): The type of the uniform. + // values: "int", "vec4", "mat3", "mat4" + // + // Note: "int" should only be used for samplers. + "type": "int", + + // values (required): The array of numbers with which to initialize the uniform. + // value: A JSON array containin the correct amount of numbers to initialize a uniform of the + // above-specified type. The following size rules should be followed: + // "int": 1 float + // "vec4": 4 floats + // "mat3": 9 floats + // "mat4": 16 floats + "values": [ 1.0 ] + } + ] +}
\ No newline at end of file diff --git a/bgfx/effects/color.json b/bgfx/effects/hlsl/color.json index 5a033140233..5a033140233 100644 --- a/bgfx/effects/color.json +++ b/bgfx/effects/hlsl/color.json diff --git a/bgfx/effects/deconverge.json b/bgfx/effects/hlsl/deconverge.json index dafd2fb630e..dafd2fb630e 100644 --- a/bgfx/effects/deconverge.json +++ b/bgfx/effects/hlsl/deconverge.json diff --git a/bgfx/effects/defocus.json b/bgfx/effects/hlsl/defocus.json index 7ba4b2cec49..7ba4b2cec49 100644 --- a/bgfx/effects/defocus.json +++ b/bgfx/effects/hlsl/defocus.json diff --git a/bgfx/effects/distortion.json b/bgfx/effects/hlsl/distortion.json index e8bbac16095..e8bbac16095 100644 --- a/bgfx/effects/distortion.json +++ b/bgfx/effects/hlsl/distortion.json diff --git a/bgfx/effects/ntsc_decode.json b/bgfx/effects/hlsl/ntsc_decode.json index 208f35b0ff3..208f35b0ff3 100644 --- a/bgfx/effects/ntsc_decode.json +++ b/bgfx/effects/hlsl/ntsc_decode.json diff --git a/bgfx/effects/ntsc_encode.json b/bgfx/effects/hlsl/ntsc_encode.json index 8ff193398b2..8ff193398b2 100644 --- a/bgfx/effects/ntsc_encode.json +++ b/bgfx/effects/hlsl/ntsc_encode.json diff --git a/bgfx/effects/phosphor.json b/bgfx/effects/hlsl/phosphor.json index aaa3c12f727..aaa3c12f727 100644 --- a/bgfx/effects/phosphor.json +++ b/bgfx/effects/hlsl/phosphor.json diff --git a/bgfx/effects/post.json b/bgfx/effects/hlsl/post.json index 525bbfc39b8..c4a86da84e5 100644 --- a/bgfx/effects/post.json +++ b/bgfx/effects/hlsl/post.json @@ -28,11 +28,8 @@ { "name": "s_tex", "type": "int", "values": [ 0.0 ] }, { "name": "s_shadow", "type": "int", "values": [ 1.0 ] }, { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_screen_dims", "type": "vec4", "values": [ 1336.0, 1002.0, 0.0, 0.0 ] }, { "name": "u_source_dims", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }, - { "name": "u_shadow_uv_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_prepare_bloom", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_prepare_vector", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_quad_dims", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }, { "name": "u_humbar_hertz_rate", "type": "vec4", "values": [ 0.001, 0.0, 0.0, 0.0 ] }, { "name": "u_humbar_alpha", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "u_time", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, @@ -46,10 +43,10 @@ { "name": "u_scanline_height", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, { "name": "u_scanline_variation", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, { "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_back_color", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_shadow_tile_mode", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "u_shadow_alpha", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_shadow_uv", "type": "vec4", "values": [ 0.25, 0.333, 0.0, 0.0 ] }, + { "name": "u_shadow_count", "type": "vec4", "values": [ 12.0, 12.0, 0.0, 0.0 ] }, + { "name": "u_shadow_uv", "type": "vec4", "values": [ 0.25, 0.25, 0.0, 0.0 ] }, + { "name": "u_shadow_uv_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, { "name": "u_power", "type": "vec4", "values": [ 1.0, 1.0, 1.0, 0.0 ] }, { "name": "u_floor", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] } ] diff --git a/bgfx/effects/prescale.json b/bgfx/effects/hlsl/prescale.json index a636c4316e0..a636c4316e0 100644 --- a/bgfx/effects/prescale.json +++ b/bgfx/effects/hlsl/prescale.json diff --git a/bgfx/effects/unfiltered/LICENSE b/bgfx/effects/unfiltered/LICENSE new file mode 100644 index 00000000000..e1a4f1f53d6 --- /dev/null +++ b/bgfx/effects/unfiltered/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016, Ryan Holtz and MAME Development Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of bsd3 nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bgfx/effects/unfiltered/README.md b/bgfx/effects/unfiltered/README.md new file mode 100644 index 00000000000..72aad88f861 --- /dev/null +++ b/bgfx/effects/unfiltered/README.md @@ -0,0 +1,5 @@ +# **BGFX shader effects** # + +Cointains definitions for BGFX shader effects + +Licensed under [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause) by Ryan Holtz and MAME Development Team diff --git a/bgfx/effects/unfiltered/blit.json b/bgfx/effects/unfiltered/blit.json new file mode 100644 index 00000000000..bbc9fd295d4 --- /dev/null +++ b/bgfx/effects/unfiltered/blit.json @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// blit.json: A simple texture-to-target copy. +// +//============================================================ +{ + // blend (required): The blend state for this effect. + "blend": { + // equation (optional): What equation to perform on the source and destination blend values. + // values: "add", "sub", "revSub", "min", "max" + // default: "add" + // + // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" + "equation": "add", + + // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. + // values: "0", "1", "srcColor", "1-srcColor", "dstColor", "1-dstColor", "srcAlpha", "1-srcAlpha", "dstAlpha", "1-dstAlpha" + // defaults (srcColor, srcAlpha): "1" + // defaults (dstColor, dstAlpha): "0" + // + // "zero", "one", "invSrcColor", "invDstColor", "invSrcAlpha", and "invDstAlpha" are provided as aliases for "0", "1", "1-srcColor", "1-dstColor", "1-srcAlpha", and "1-dstAlpha" + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + + // depth (required): The depth state for this effect. + "depth": { + // function (optional): The depth function to use when drawing. + // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" + // default: "always" + "function": "always", + + // writeenable (optional): Whether to store Z-buffer data. + // values: true, false + // default: false + "writeenable": false + }, + + // cull (required): The cull mode for this effect. + "cull": { + // mode (optional): What winding, if any, to cull. + // values: "none", "cw", "ccw" + // default: "ccw" + // + // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" + "mode": "none" + }, + + // write (required): Write enable for color and alpha channels. + "write": { + // rgb (optional): Whether to store color data when drawing. + // values: true, false + // default: false + "rgb": true, + + // alpha (optional): Whether to store alpha data when drawing. + // values: true, false + // default: false + "alpha": true + }, + + // vertex (required): The vertex shader to use when drawing. + // value: A string containing the name of a shader file to use, minus the extension. + "vertex": "vs_blit", + + // pixel/fragment (required): The pixel or fragment shader to use when drawing. + // value: A string containing the name of a shader file to use, minus the extension. + "fragment": "fs_blit", + + // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. + "uniforms": [ + { + // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. + // value: A string containing the name of the uniform as described above. + // + // NOTE: Some names correspond to special values that will be automatically filled by the BGFX + // code if they are used by the shader. These names are: + // "u_screen_dims" + // The dimensions of the first texture input if present, otherwise the dimensions of the output window. + // Valid values: xy + // "u_inv_screen_dims" + // The reciprocal of u_screen_dims. + // Valid values: xy + // "u_source_dims" + // The size, in pixels, of the screen texture incoming to the chain. + // Valid values: xy + // "u_rotation_type" + // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. + // Valid values: x + // "u_swap_xy" + // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. + // Valid values: x + // "u_quad_dims" + // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. + // Valid values: xy + // "u_tex_sizeN" + // The dimensions, in pixels, of the texture in input pair N. Starts at 0. + // valid values: xy + "name": "s_tex", + + // type (required): The type of the uniform. + // values: "int", "vec4", "mat3", "mat4" + // + // Note: "int" should only be used for samplers. + "type": "int", + + // values (required): The array of numbers with which to initialize the uniform. + // value: A JSON array containin the correct amount of numbers to initialize a uniform of the + // above-specified type. The following size rules should be followed: + // "int": 1 float + // "vec4": 4 floats + // "mat3": 9 floats + // "mat4": 16 floats + "values": [ 1.0 ] + } + ] +}
\ No newline at end of file diff --git a/bgfx/shaders/dx11/fs_blit.bin b/bgfx/shaders/dx11/fs_blit.bin Binary files differindex 97c305a440d..98e6afc9871 100644 --- a/bgfx/shaders/dx11/fs_blit.bin +++ b/bgfx/shaders/dx11/fs_blit.bin diff --git a/bgfx/shaders/dx11/fs_color.bin b/bgfx/shaders/dx11/fs_color.bin Binary files differindex 145c0e72c3b..d5e420b8c0a 100644 --- a/bgfx/shaders/dx11/fs_color.bin +++ b/bgfx/shaders/dx11/fs_color.bin diff --git a/bgfx/shaders/dx11/fs_deconverge.bin b/bgfx/shaders/dx11/fs_deconverge.bin Binary files differindex 34032932b6b..2c3047ecc38 100644 --- a/bgfx/shaders/dx11/fs_deconverge.bin +++ b/bgfx/shaders/dx11/fs_deconverge.bin diff --git a/bgfx/shaders/dx11/fs_defocus.bin b/bgfx/shaders/dx11/fs_defocus.bin Binary files differindex 2b1552c0cf6..0453ced9245 100644 --- a/bgfx/shaders/dx11/fs_defocus.bin +++ b/bgfx/shaders/dx11/fs_defocus.bin diff --git a/bgfx/shaders/dx11/fs_distortion.bin b/bgfx/shaders/dx11/fs_distortion.bin Binary files differindex 19a7124084e..4399b58c49c 100644 --- a/bgfx/shaders/dx11/fs_distortion.bin +++ b/bgfx/shaders/dx11/fs_distortion.bin diff --git a/bgfx/shaders/dx11/fs_gui.bin b/bgfx/shaders/dx11/fs_gui.bin Binary files differindex de921a8ac60..1ef0ea19827 100644 --- a/bgfx/shaders/dx11/fs_gui.bin +++ b/bgfx/shaders/dx11/fs_gui.bin diff --git a/bgfx/shaders/dx11/fs_ntsc_decode.bin b/bgfx/shaders/dx11/fs_ntsc_decode.bin Binary files differindex e42dfd9ab0b..bbefb77f9d5 100644 --- a/bgfx/shaders/dx11/fs_ntsc_decode.bin +++ b/bgfx/shaders/dx11/fs_ntsc_decode.bin diff --git a/bgfx/shaders/dx11/fs_ntsc_encode.bin b/bgfx/shaders/dx11/fs_ntsc_encode.bin Binary files differindex 76ed9fc6b9d..329250b61a4 100644 --- a/bgfx/shaders/dx11/fs_ntsc_encode.bin +++ b/bgfx/shaders/dx11/fs_ntsc_encode.bin diff --git a/bgfx/shaders/dx11/fs_phosphor.bin b/bgfx/shaders/dx11/fs_phosphor.bin Binary files differindex cb4067339e1..b4279fc2c3c 100644 --- a/bgfx/shaders/dx11/fs_phosphor.bin +++ b/bgfx/shaders/dx11/fs_phosphor.bin diff --git a/bgfx/shaders/dx11/fs_post.bin b/bgfx/shaders/dx11/fs_post.bin Binary files differindex 142a5ce6296..f7de4f9d3d6 100644 --- a/bgfx/shaders/dx11/fs_post.bin +++ b/bgfx/shaders/dx11/fs_post.bin diff --git a/bgfx/shaders/dx11/fs_prescale.bin b/bgfx/shaders/dx11/fs_prescale.bin Binary files differindex 48b30509c0b..a179c13e6ec 100644 --- a/bgfx/shaders/dx11/fs_prescale.bin +++ b/bgfx/shaders/dx11/fs_prescale.bin diff --git a/bgfx/shaders/dx11/fs_screen.bin b/bgfx/shaders/dx11/fs_screen.bin Binary files differindex da6666a4c60..0e31de163b1 100644 --- a/bgfx/shaders/dx11/fs_screen.bin +++ b/bgfx/shaders/dx11/fs_screen.bin diff --git a/bgfx/shaders/dx11/vs_blit.bin b/bgfx/shaders/dx11/vs_blit.bin Binary files differindex 296cdf52be7..fc0022997bb 100644 --- a/bgfx/shaders/dx11/vs_blit.bin +++ b/bgfx/shaders/dx11/vs_blit.bin diff --git a/bgfx/shaders/dx11/vs_color.bin b/bgfx/shaders/dx11/vs_color.bin Binary files differindex a0673685469..69d40d0c3b4 100644 --- a/bgfx/shaders/dx11/vs_color.bin +++ b/bgfx/shaders/dx11/vs_color.bin diff --git a/bgfx/shaders/dx11/vs_deconverge.bin b/bgfx/shaders/dx11/vs_deconverge.bin Binary files differindex 43c6c33410e..62440de3aa7 100644 --- a/bgfx/shaders/dx11/vs_deconverge.bin +++ b/bgfx/shaders/dx11/vs_deconverge.bin diff --git a/bgfx/shaders/dx11/vs_defocus.bin b/bgfx/shaders/dx11/vs_defocus.bin Binary files differindex eb5d2fc8e4a..df493402ed8 100644 --- a/bgfx/shaders/dx11/vs_defocus.bin +++ b/bgfx/shaders/dx11/vs_defocus.bin diff --git a/bgfx/shaders/dx11/vs_distortion.bin b/bgfx/shaders/dx11/vs_distortion.bin Binary files differindex 2d5d08866b9..152756344fb 100644 --- a/bgfx/shaders/dx11/vs_distortion.bin +++ b/bgfx/shaders/dx11/vs_distortion.bin diff --git a/bgfx/shaders/dx11/vs_gui.bin b/bgfx/shaders/dx11/vs_gui.bin Binary files differindex b1640861f2b..683365b786a 100644 --- a/bgfx/shaders/dx11/vs_gui.bin +++ b/bgfx/shaders/dx11/vs_gui.bin diff --git a/bgfx/shaders/dx11/vs_ntsc_decode.bin b/bgfx/shaders/dx11/vs_ntsc_decode.bin Binary files differindex 29e62929df3..b1b720b8c48 100644 --- a/bgfx/shaders/dx11/vs_ntsc_decode.bin +++ b/bgfx/shaders/dx11/vs_ntsc_decode.bin diff --git a/bgfx/shaders/dx11/vs_ntsc_encode.bin b/bgfx/shaders/dx11/vs_ntsc_encode.bin Binary files differindex 87c60815602..2626aceeb7a 100644 --- a/bgfx/shaders/dx11/vs_ntsc_encode.bin +++ b/bgfx/shaders/dx11/vs_ntsc_encode.bin diff --git a/bgfx/shaders/dx11/vs_phosphor.bin b/bgfx/shaders/dx11/vs_phosphor.bin Binary files differindex 29f497b4a65..8cd89f18b99 100644 --- a/bgfx/shaders/dx11/vs_phosphor.bin +++ b/bgfx/shaders/dx11/vs_phosphor.bin diff --git a/bgfx/shaders/dx11/vs_post.bin b/bgfx/shaders/dx11/vs_post.bin Binary files differindex 70639fc75f7..a8827bacda2 100644 --- a/bgfx/shaders/dx11/vs_post.bin +++ b/bgfx/shaders/dx11/vs_post.bin diff --git a/bgfx/shaders/dx11/vs_prescale.bin b/bgfx/shaders/dx11/vs_prescale.bin Binary files differindex c173aff6efd..4daaf3d7532 100644 --- a/bgfx/shaders/dx11/vs_prescale.bin +++ b/bgfx/shaders/dx11/vs_prescale.bin diff --git a/bgfx/shaders/dx11/vs_screen.bin b/bgfx/shaders/dx11/vs_screen.bin Binary files differindex 766a9c4e93b..c3c17a3621c 100644 --- a/bgfx/shaders/dx11/vs_screen.bin +++ b/bgfx/shaders/dx11/vs_screen.bin diff --git a/bgfx/shaders/dx9/fs_post.bin b/bgfx/shaders/dx9/fs_post.bin Binary files differindex aad4df72ddd..b0e0edd02ac 100644 --- a/bgfx/shaders/dx9/fs_post.bin +++ b/bgfx/shaders/dx9/fs_post.bin diff --git a/bgfx/shaders/dx9/vs_post.bin b/bgfx/shaders/dx9/vs_post.bin Binary files differindex 43eec77a6f4..c006fe0c6ac 100644 --- a/bgfx/shaders/dx9/vs_post.bin +++ b/bgfx/shaders/dx9/vs_post.bin diff --git a/bgfx/shaders/gles/fs_post.bin b/bgfx/shaders/gles/fs_post.bin Binary files differindex 72279deee43..e9896427988 100644 --- a/bgfx/shaders/gles/fs_post.bin +++ b/bgfx/shaders/gles/fs_post.bin diff --git a/bgfx/shaders/gles/vs_post.bin b/bgfx/shaders/gles/vs_post.bin Binary files differindex cb059e570a4..e9803083792 100644 --- a/bgfx/shaders/gles/vs_post.bin +++ b/bgfx/shaders/gles/vs_post.bin diff --git a/bgfx/shaders/glsl/fs_post.bin b/bgfx/shaders/glsl/fs_post.bin Binary files differindex 23e7d687606..056f8728347 100644 --- a/bgfx/shaders/glsl/fs_post.bin +++ b/bgfx/shaders/glsl/fs_post.bin diff --git a/bgfx/shaders/glsl/vs_post.bin b/bgfx/shaders/glsl/vs_post.bin Binary files differindex 624be0f29f0..510526ec588 100644 --- a/bgfx/shaders/glsl/vs_post.bin +++ b/bgfx/shaders/glsl/vs_post.bin diff --git a/bgfx/shaders/metal/fs_post.bin b/bgfx/shaders/metal/fs_post.bin Binary files differindex 4da4ca2e2c1..133e08292a4 100644 --- a/bgfx/shaders/metal/fs_post.bin +++ b/bgfx/shaders/metal/fs_post.bin diff --git a/bgfx/shaders/metal/vs_post.bin b/bgfx/shaders/metal/vs_post.bin Binary files differindex 70298ecb2f8..7d355aa1df1 100644 --- a/bgfx/shaders/metal/vs_post.bin +++ b/bgfx/shaders/metal/vs_post.bin diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 7f2d17e251a..f22af0adb99 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -143,7 +143,7 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_BGFX_BACKEND, "auto", OPTION_STRING, "BGFX backend to use (d3d9, d3d11, metal, opengl, gles)" }, { OSDOPTION_BGFX_DEBUG, "0", OPTION_BOOLEAN, "enable BGFX debugging statistics" }, { OSDOPTION_BGFX_SCREEN_CHAINS, "default", OPTION_STRING, "comma-delimited list of screen chain JSON names, colon-delimited per-window" }, - { OSDOPTION_BGFX_SHADOW_MASK, "shadow-mask.png", OPTION_STRING, "shadow mask texture name" }, + { OSDOPTION_BGFX_SHADOW_MASK, "slot-mask.png", OPTION_STRING, "shadow mask texture name" }, // End of list { nullptr } diff --git a/src/osd/modules/render/bgfx/shaders/fs_post.sc b/src/osd/modules/render/bgfx/shaders/fs_post.sc index 4a77dc88cbb..eab3b909909 100644 --- a/src/osd/modules/render/bgfx/shaders/fs_post.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_post.sc @@ -10,14 +10,12 @@ $input v_color0, v_texcoord0, v_texcoord1 // Autos uniform vec4 u_swap_xy; -uniform vec4 u_screen_dims; // size of the output window uniform vec4 u_source_dims; // size of the guest machine +uniform vec4 u_quad_dims; uniform vec4 u_screen_scale; // TODO: Hook up ScreenScale code-side uniform vec4 u_screen_offset; // TODO: Hook up ScreenOffset code-side // User-supplied -uniform vec4 u_prepare_bloom; // disables some effects for rendering bloom textures -uniform vec4 u_prepare_vector; uniform vec4 u_scanline_alpha; uniform vec4 u_scanline_scale; uniform vec4 u_scanline_bright_scale; @@ -25,9 +23,8 @@ uniform vec4 u_scanline_bright_offset; uniform vec4 u_scanline_jitter; uniform vec4 u_scanline_height; uniform vec4 u_scanline_variation; -uniform vec4 u_back_color; // TODO: Unused in current implementation, mostly -uniform vec4 u_shadow_tile_mode; // 0 based on screen dimension, 1 based on source dimension uniform vec4 u_shadow_alpha; +uniform vec4 u_shadow_count; uniform vec4 u_shadow_uv; uniform vec4 u_shadow_uv_offset; uniform vec4 u_humbar_hertz_rate; // difference between the 59.94 Hz field rate and 60 Hz line frequency (NTSC) @@ -64,9 +61,42 @@ vec2 GetAdjustedCoords(vec2 coord, vec2 center_offset) return coord; } +// vector screen has the same quad texture coordinates for every screen orientation, raster screen differs +vec2 GetShadowCoord(vec2 QuadCoord, vec2 SourceCoord) +{ + vec2 QuadTexel = vec2(1.0, 1.0) / u_quad_dims.xy; + + vec2 canvasCoord = QuadCoord + u_shadow_uv_offset.xy / u_quad_dims.xy; + + vec2 shadowUV = u_shadow_uv.xy; + vec2 shadowCount = u_shadow_count.xy; + + // swap x/y vector and raster in screen mode (not source mode) + canvasCoord = u_swap_xy.x > 0.0 + ? canvasCoord.yx + : canvasCoord.xy; + + // swap x/y vector and raster in screen mode (not source mode) + shadowCount = u_swap_xy.x > 0.0 + ? shadowCount.yx + : shadowCount.xy; + + vec2 shadowTile = QuadTexel * shadowCount; + + vec2 shadowFrac = fract(canvasCoord / shadowTile); + + // swap x/y raster in screen mode (not vector and not source mode) + shadowFrac = u_swap_xy.x > 0.0 + ? shadowFrac.yx + : shadowFrac.xy; + + vec2 shadowCoord = (shadowFrac * shadowUV); + + return shadowCoord; +} + void main() { - vec2 ScreenCoord = v_texcoord0.xy; vec2 BaseCoord = GetAdjustedCoords(v_texcoord0, vec2(0.5, 0.5)); // Color @@ -78,72 +108,52 @@ void main() BaseColor.rgb = vec3(0.0, 0.0, 0.0); } - // Mask Simulation (may not affect bloom) - if (u_prepare_bloom.x == 0.0 && u_shadow_alpha.x > 0.0) + // Mask Simulation + if (u_shadow_alpha.x > 0.0) { - vec2 screenCoord = ScreenCoord; - screenCoord = u_swap_xy.x > 0.0 ? screenCoord.yx : screenCoord.xy; - - vec2 shadowTile = (u_shadow_tile_mode.x == 0.0 ? u_screen_dims.xy : u_source_dims.xy); - shadowTile = u_swap_xy.x > 0.0 ? shadowTile.yx : shadowTile.xy; - - vec2 ShadowFrac = fract(screenCoord * shadowTile); - vec2 ShadowCoord = (ShadowFrac * u_shadow_uv.xy); - + vec2 ShadowCoord = GetShadowCoord(v_texcoord0.xy, v_texcoord0.xy); + vec4 ShadowColor = texture2D(s_shadow, ShadowCoord); vec3 ShadowMaskColor = mix(vec3(1.0, 1.0, 1.0), ShadowColor.rgb, u_shadow_alpha.xxx); - float ShadowMaskClear = (1.0 - ShadowColor.a) * u_shadow_alpha.x; // apply shadow mask color BaseColor.rgb *= ShadowMaskColor; - // clear shadow mask by background color - BaseColor.rgb = mix(BaseColor.rgb, u_back_color.rgb, ShadowMaskClear); } - // Color Compression (may not affect bloom) - if (u_prepare_bloom.x == 0.0) - { - // increasing the floor of the signal without affecting the ceiling - BaseColor.rgb = u_floor.rgb + (vec3(1.0, 1.0, 1.0) - u_floor.rgb) * BaseColor.rgb; - } + // Color Compression + // increasing the floor of the signal without affecting the ceiling + BaseColor.rgb = u_floor.rgb + (vec3(1.0, 1.0, 1.0) - u_floor.rgb) * BaseColor.rgb; - // Color Power (may affect bloom) + // Color Power BaseColor.r = pow(BaseColor.r, u_power.r); BaseColor.g = pow(BaseColor.g, u_power.g); BaseColor.b = pow(BaseColor.b, u_power.b); - // Scanline Simulation (may not affect bloom) - if (u_prepare_bloom.x == 0.0) + // Scanline Simulation + if (u_scanline_alpha.x > 0.0f) { - // Scanline Simulation (may not affect vector screen) - if (u_prepare_vector.x == 0.0 && u_scanline_alpha.x > 0.0f) - { - float BrightnessOffset = (u_scanline_bright_offset.x * u_scanline_alpha.x); - float BrightnessScale = (u_scanline_bright_scale.x * u_scanline_alpha.x) + (1.0 - u_scanline_alpha.x); - - float ColorBrightness = 0.299 * BaseColor.r + 0.587 * BaseColor.g + 0.114 * BaseColor.b; - - float ScanCoord = v_texcoord0.y * u_source_dims.y * u_scanline_scale.x * 3.1415927; - float ScanCoordJitter = u_scanline_jitter.x * u_jitter_amount.x * 1.618034; - float ScanSine = sin(ScanCoord + ScanCoordJitter); - float ScanlineWide = u_scanline_height.x + u_scanline_variation.x * max(1.0, u_scanline_height.x) * (1.0 - ColorBrightness); - float ScanSineScaled = pow(ScanSine * ScanSine, ScanlineWide); - float ScanBrightness = ScanSineScaled * BrightnessScale + BrightnessOffset * BrightnessScale; - - BaseColor.rgb *= mix(vec3(1.0, 1.0, 1.0), vec3(ScanBrightness, ScanBrightness, ScanBrightness), u_scanline_alpha.xxx); - } - - // Hum Bar Simulation (may not affect vector screen) - if (u_prepare_vector.x == 0.0 && u_humbar_alpha.x > 0.0f) - { - float HumTimeStep = fract(u_time.x * 0.001); - float HumBrightness = 1.0 - fract(BaseCoord.y + HumTimeStep) * u_humbar_alpha.x; - BaseColor.rgb *= HumBrightness; - } + float BrightnessOffset = (u_scanline_bright_offset.x * u_scanline_alpha.x); + float BrightnessScale = (u_scanline_bright_scale.x * u_scanline_alpha.x) + (1.0 - u_scanline_alpha.x); + + float ColorBrightness = 0.299 * BaseColor.r + 0.587 * BaseColor.g + 0.114 * BaseColor.b; + + float ScanCoord = v_texcoord0.y * u_source_dims.y * u_scanline_scale.x * 3.1415927; + float ScanCoordJitter = u_scanline_jitter.x * u_jitter_amount.x * 1.618034; + float ScanSine = sin(ScanCoord + ScanCoordJitter); + float ScanlineWide = u_scanline_height.x + u_scanline_variation.x * max(1.0, u_scanline_height.x) * (1.0 - ColorBrightness); + float ScanSineScaled = pow(ScanSine * ScanSine, ScanlineWide); + float ScanBrightness = ScanSineScaled * BrightnessScale + BrightnessOffset * BrightnessScale; + + BaseColor.rgb *= mix(vec3(1.0, 1.0, 1.0), vec3(ScanBrightness, ScanBrightness, ScanBrightness), u_scanline_alpha.xxx); } - vec4 Output = u_prepare_vector.x > 0.0 ? BaseColor * (v_color0 + vec4(1.0, 1.0, 1.0, 0.0)) : BaseColor * v_color0; - Output.a = 1.0; + // Hum Bar Simulation + if (u_humbar_alpha.x > 0.0f) + { + float HumTimeStep = fract(u_time.x * 0.001); + float HumBrightness = 1.0 - fract(BaseCoord.y + HumTimeStep) * u_humbar_alpha.x; + BaseColor.rgb *= HumBrightness; + } - gl_FragColor = Output; + gl_FragColor = vec4(BaseColor.rgb * v_color0.rgb, 1.0); } diff --git a/src/osd/modules/render/bgfx/shaders/vs_post.sc b/src/osd/modules/render/bgfx/shaders/vs_post.sc index 89923cc9338..fcc643b4c8f 100644 --- a/src/osd/modules/render/bgfx/shaders/vs_post.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_post.sc @@ -6,14 +6,14 @@ $output v_texcoord0, v_texcoord1, v_color0 #include "../../../../../../3rdparty/bgfx/examples/common/common.sh" -uniform vec4 u_swap_xy; - -uniform vec4 u_shadow_uv_offset; +// Autos +uniform vec4 u_source_dims; +uniform vec4 u_screen_dims; void main() { gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); v_texcoord0 = a_texcoord0; - v_texcoord1 = a_position.xy + ((u_swap_xy.x != 0.0) ? u_shadow_uv_offset.yx : u_shadow_uv_offset.xy); + v_texcoord1 = a_texcoord0.xy * u_source_dims.xy / u_screen_dims.x; v_color0 = a_color0; } |
