Final bgfx fixups for release

This commit is contained in:
therealmogminer@gmail.com 2016-03-28 22:58:16 +02:00
parent 68ebc2b0e5
commit c0b1182712
56 changed files with 446 additions and 101 deletions

View File

@ -7,14 +7,14 @@
} }
], ],
"passes": [ "passes": [
{ "effect": "blit", { "effect": "default\blit",
"name": "Copy To Unstretched Texture", "name": "Copy To Unstretched Texture",
"input": [ "input": [
{ "sampler": "s_tex", "texture": "screen" } { "sampler": "s_tex", "texture": "screen" }
], ],
"output": "temp" "output": "temp"
}, },
{ "effect": "blit", { "effect": "default\blit",
"name": "Final Upscale", "name": "Final Upscale",
"input": [ "input": [
{ "sampler": "s_tex", "target": "temp" } { "sampler": "s_tex", "target": "temp" }

View File

@ -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": "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_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_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_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_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_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_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": "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": "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_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_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_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": "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": "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": "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": 5, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "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": "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": "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": "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": "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": "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": "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. // 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. // 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. // 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. // name (required): A verbal name for the effect. It is only used internally, but is required nonetheless.
// value: Any valid ASCII string. // value: Any valid ASCII string.
@ -254,7 +254,7 @@
// value: Any valid ASCII string that names a target. // value: Any valid ASCII string that names a target.
"output": "guest" "output": "guest"
}, },
{ "effect": "ntsc_decode", { "effect": "hlsl/ntsc_decode",
"name": "NTSC Decode", "name": "NTSC Decode",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -278,7 +278,7 @@
], ],
"output": "guest" "output": "guest"
}, },
{ "effect": "blit", { "effect": "hlsl/blit",
"name": "NTSC Skip", "name": "NTSC Skip",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "notequal", "combine": "and", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "notequal", "combine": "and", "name": "adjustments", "value": 0 },
@ -289,7 +289,7 @@
], ],
"output": "guest" "output": "guest"
}, },
{ "effect": "color", { "effect": "hlsl/color",
"name": "Color Convolution", "name": "Color Convolution",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 } { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 }
@ -307,14 +307,14 @@
], ],
"output": "guest" "output": "guest"
}, },
{ "effect": "prescale", { "effect": "hlsl/prescale",
"name": "Prescale", "name": "Prescale",
"input": [ "input": [
{ "sampler": "s_tex", "target": "guest" } { "sampler": "s_tex", "target": "guest" }
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "deconverge", { "effect": "hlsl/deconverge",
"name": "Deconvergence", "name": "Deconvergence",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -338,7 +338,7 @@
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "defocus", { "effect": "hlsl/defocus",
"name": "Defocus Pass 1", "name": "Defocus Pass 1",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -352,7 +352,7 @@
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "defocus", { "effect": "hlsl/defocus",
"name": "Defocus Pass 2", "name": "Defocus Pass 2",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -366,7 +366,7 @@
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "phosphor", { "effect": "hlsl/phosphor",
"name": "Phosphor Decay", "name": "Phosphor Decay",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -382,7 +382,7 @@
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "phosphor", { "effect": "hlsl/phosphor",
"name": "Phosphor Store", "name": "Phosphor Store",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -398,7 +398,7 @@
], ],
"output": "previous" "output": "previous"
}, },
{ "effect": "post", { "effect": "hlsl/post",
"name": "Non-Bloom Post Pass", "name": "Non-Bloom Post Pass",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -416,9 +416,9 @@
{ "uniform": "u_scanline_height", "slider": "scanline_height" }, { "uniform": "u_scanline_height", "slider": "scanline_height" },
{ "uniform": "u_scanline_variation", "slider": "scanline_variation" }, { "uniform": "u_scanline_variation", "slider": "scanline_variation" },
{ "uniform": "u_shadow_alpha", "slider": "shadow_alpha" }, { "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", "slider": "shadow_uv_size" },
{ "uniform": "u_shadow_uv_offset", "slider": "shadow_uv_offset" }, { "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_alpha", "slider": "humbar_alpha" },
{ "uniform": "u_humbar_hertz_rate", "slider": "humbar_hertz_rate" }, { "uniform": "u_humbar_hertz_rate", "slider": "humbar_hertz_rate" },
{ "uniform": "u_floor", "slider": "floor" }, { "uniform": "u_floor", "slider": "floor" },
@ -433,7 +433,7 @@
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "distortion", { "effect": "hlsl/distortion",
"name": "Distortion Pass", "name": "Distortion Pass",
"disablewhen": [ "disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
@ -455,7 +455,7 @@
], ],
"output": "internal" "output": "internal"
}, },
{ "effect": "blit", { "effect": "hlsl/blit",
"name": "Final Blit", "name": "Final Blit",
"input": [ "input": [
{ "sampler": "s_tex", "target": "internal" } { "sampler": "s_tex", "target": "internal" }

View File

@ -7,14 +7,14 @@
} }
], ],
"passes": [ "passes": [
{ "effect": "blit", { "effect": "unfiltered\blit",
"name": "Copy To Unstretched Texture", "name": "Copy To Unstretched Texture",
"input": [ "input": [
{ "sampler": "s_tex", "texture": "screen" } { "sampler": "s_tex", "texture": "screen" }
], ],
"output": "temp" "output": "temp"
}, },
{ "effect": "blit", { "effect": "unfiltered\blit",
"name": "Final Upscale", "name": "Final Upscale",
"input": [ "input": [
{ "sampler": "s_tex", "target": "temp" } { "sampler": "s_tex", "target": "temp" }

View File

@ -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.

View File

@ -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

27
bgfx/effects/hlsl/LICENSE Normal file
View File

@ -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.

View File

@ -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

121
bgfx/effects/hlsl/blit.json Normal file
View File

@ -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 ]
}
]
}

View File

@ -28,11 +28,8 @@
{ "name": "s_tex", "type": "int", "values": [ 0.0 ] }, { "name": "s_tex", "type": "int", "values": [ 0.0 ] },
{ "name": "s_shadow", "type": "int", "values": [ 1.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_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_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_quad_dims", "type": "vec4", "values": [ 256.0, 256.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_humbar_hertz_rate", "type": "vec4", "values": [ 0.001, 0.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_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 ] }, { "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_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_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_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_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_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 ] } { "name": "u_floor", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
] ]

View File

@ -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.

View File

@ -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

View File

@ -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 ]
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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_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_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_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 // End of list
{ nullptr } { nullptr }

View File

@ -10,14 +10,12 @@ $input v_color0, v_texcoord0, v_texcoord1
// Autos // Autos
uniform vec4 u_swap_xy; 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_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_scale; // TODO: Hook up ScreenScale code-side
uniform vec4 u_screen_offset; // TODO: Hook up ScreenOffset code-side uniform vec4 u_screen_offset; // TODO: Hook up ScreenOffset code-side
// User-supplied // 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_alpha;
uniform vec4 u_scanline_scale; uniform vec4 u_scanline_scale;
uniform vec4 u_scanline_bright_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_jitter;
uniform vec4 u_scanline_height; uniform vec4 u_scanline_height;
uniform vec4 u_scanline_variation; 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_alpha;
uniform vec4 u_shadow_count;
uniform vec4 u_shadow_uv; uniform vec4 u_shadow_uv;
uniform vec4 u_shadow_uv_offset; 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) 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; 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() void main()
{ {
vec2 ScreenCoord = v_texcoord0.xy;
vec2 BaseCoord = GetAdjustedCoords(v_texcoord0, vec2(0.5, 0.5)); vec2 BaseCoord = GetAdjustedCoords(v_texcoord0, vec2(0.5, 0.5));
// Color // Color
@ -78,72 +108,52 @@ void main()
BaseColor.rgb = vec3(0.0, 0.0, 0.0); BaseColor.rgb = vec3(0.0, 0.0, 0.0);
} }
// Mask Simulation (may not affect bloom) // Mask Simulation
if (u_prepare_bloom.x == 0.0 && u_shadow_alpha.x > 0.0) if (u_shadow_alpha.x > 0.0)
{ {
vec2 screenCoord = ScreenCoord; vec2 ShadowCoord = GetShadowCoord(v_texcoord0.xy, v_texcoord0.xy);
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);
vec4 ShadowColor = texture2D(s_shadow, ShadowCoord); vec4 ShadowColor = texture2D(s_shadow, ShadowCoord);
vec3 ShadowMaskColor = mix(vec3(1.0, 1.0, 1.0), ShadowColor.rgb, u_shadow_alpha.xxx); 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 // apply shadow mask color
BaseColor.rgb *= ShadowMaskColor; 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) // Color Compression
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;
// 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.r = pow(BaseColor.r, u_power.r);
BaseColor.g = pow(BaseColor.g, u_power.g); BaseColor.g = pow(BaseColor.g, u_power.g);
BaseColor.b = pow(BaseColor.b, u_power.b); BaseColor.b = pow(BaseColor.b, u_power.b);
// Scanline Simulation (may not affect bloom) // Scanline Simulation
if (u_prepare_bloom.x == 0.0) if (u_scanline_alpha.x > 0.0f)
{ {
// Scanline Simulation (may not affect vector screen) float BrightnessOffset = (u_scanline_bright_offset.x * u_scanline_alpha.x);
if (u_prepare_vector.x == 0.0 && u_scanline_alpha.x > 0.0f) float BrightnessScale = (u_scanline_bright_scale.x * u_scanline_alpha.x) + (1.0 - u_scanline_alpha.x);
{
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 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 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 ScanCoordJitter = u_scanline_jitter.x * u_jitter_amount.x * 1.618034;
float ScanSine = sin(ScanCoord + ScanCoordJitter); 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 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 ScanSineScaled = pow(ScanSine * ScanSine, ScanlineWide);
float ScanBrightness = ScanSineScaled * BrightnessScale + BrightnessOffset * BrightnessScale; float ScanBrightness = ScanSineScaled * BrightnessScale + BrightnessOffset * BrightnessScale;
BaseColor.rgb *= mix(vec3(1.0, 1.0, 1.0), vec3(ScanBrightness, ScanBrightness, ScanBrightness), u_scanline_alpha.xxx); 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;
}
} }
vec4 Output = u_prepare_vector.x > 0.0 ? BaseColor * (v_color0 + vec4(1.0, 1.0, 1.0, 0.0)) : BaseColor * v_color0; // Hum Bar Simulation
Output.a = 1.0; 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);
} }

View File

@ -6,14 +6,14 @@ $output v_texcoord0, v_texcoord1, v_color0
#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" #include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
uniform vec4 u_swap_xy; // Autos
uniform vec4 u_source_dims;
uniform vec4 u_shadow_uv_offset; uniform vec4 u_screen_dims;
void main() void main()
{ {
gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0));
v_texcoord0 = a_texcoord0; 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; v_color0 = a_color0;
} }