summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--bgfx/chains/LICENSE27
-rw-r--r--bgfx/chains/README.md5
-rw-r--r--bgfx/chains/hlsl.json105
-rw-r--r--bgfx/chains/test.json115
-rw-r--r--bgfx/effects/LICENSE27
-rw-r--r--bgfx/effects/README.md5
-rw-r--r--bgfx/effects/bloom_scale.json23
-rw-r--r--bgfx/effects/color.json6
-rw-r--r--bgfx/effects/deconverge.json12
-rw-r--r--bgfx/effects/defocus.json8
-rw-r--r--bgfx/effects/distortion.json14
-rw-r--r--bgfx/effects/ntsc_decode.json26
-rw-r--r--bgfx/effects/ntsc_encode.json18
-rw-r--r--bgfx/effects/post.json12
-rw-r--r--bgfx/effects/ratios.json26
-rw-r--r--bgfx/effects/tint.json25
-rw-r--r--bgfx/shaders/dx11/fs_blit.binbin40856 -> 40856 bytes
-rw-r--r--bgfx/shaders/dx11/fs_color.binbin43259 -> 43257 bytes
-rw-r--r--bgfx/shaders/dx11/fs_deconverge.binbin41062 -> 41060 bytes
-rw-r--r--bgfx/shaders/dx11/fs_defocus.binbin47854 -> 45804 bytes
-rw-r--r--bgfx/shaders/dx11/fs_distortion.binbin56047 -> 56045 bytes
-rw-r--r--bgfx/shaders/dx11/fs_gui.binbin40856 -> 40856 bytes
-rw-r--r--bgfx/shaders/dx11/fs_ntsc_decode.binbin58921 -> 58919 bytes
-rw-r--r--bgfx/shaders/dx11/fs_ntsc_encode.binbin48333 -> 48331 bytes
-rw-r--r--bgfx/shaders/dx11/fs_phosphor.binbin41094 -> 41094 bytes
-rw-r--r--bgfx/shaders/dx11/fs_post.binbin57905 -> 55640 bytes
-rw-r--r--bgfx/shaders/dx11/fs_ratios.binbin41118 -> 41118 bytes
-rw-r--r--bgfx/shaders/dx11/fs_screen.binbin40856 -> 40856 bytes
-rw-r--r--bgfx/shaders/dx11/fs_tint.binbin41011 -> 41011 bytes
-rw-r--r--bgfx/shaders/dx11/vs_blit.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_color.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_deconverge.binbin43891 -> 43788 bytes
-rw-r--r--bgfx/shaders/dx11/vs_defocus.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_distortion.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_gui.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_ntsc_decode.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_ntsc_encode.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_phosphor.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_post.binbin41216 -> 41216 bytes
-rw-r--r--bgfx/shaders/dx11/vs_ratios.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_screen.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx11/vs_tint.binbin38987 -> 38987 bytes
-rw-r--r--bgfx/shaders/dx9/fs_color.binbin1483 -> 1466 bytes
-rw-r--r--bgfx/shaders/dx9/fs_deconverge.binbin1026 -> 1009 bytes
-rw-r--r--bgfx/shaders/dx9/fs_defocus.binbin1822 -> 1805 bytes
-rw-r--r--bgfx/shaders/dx9/fs_distortion.binbin4891 -> 4874 bytes
-rw-r--r--bgfx/shaders/dx9/fs_gui.binbin645 -> 605 bytes
-rw-r--r--bgfx/shaders/dx9/fs_ntsc_decode.binbin7473 -> 7456 bytes
-rw-r--r--bgfx/shaders/dx9/fs_ntsc_encode.binbin3537 -> 3520 bytes
-rw-r--r--bgfx/shaders/dx9/fs_post.binbin5172 -> 4637 bytes
-rw-r--r--bgfx/shaders/dx9/vs_deconverge.binbin2010 -> 1791 bytes
-rw-r--r--bgfx/shaders/gles/fs_color.binbin976 -> 949 bytes
-rw-r--r--bgfx/shaders/gles/fs_deconverge.binbin469 -> 424 bytes
-rw-r--r--bgfx/shaders/gles/fs_defocus.binbin1156 -> 1057 bytes
-rw-r--r--bgfx/shaders/gles/fs_distortion.binbin3931 -> 3904 bytes
-rw-r--r--bgfx/shaders/gles/fs_ntsc_decode.binbin6676 -> 6640 bytes
-rw-r--r--bgfx/shaders/gles/fs_ntsc_encode.binbin2879 -> 2825 bytes
-rw-r--r--bgfx/shaders/gles/fs_post.binbin4396 -> 3712 bytes
-rw-r--r--bgfx/shaders/gles/vs_deconverge.binbin1608 -> 1409 bytes
-rw-r--r--bgfx/shaders/glsl/fs_color.binbin909 -> 882 bytes
-rw-r--r--bgfx/shaders/glsl/fs_deconverge.binbin440 -> 395 bytes
-rw-r--r--bgfx/shaders/glsl/fs_defocus.binbin1121 -> 1022 bytes
-rw-r--r--bgfx/shaders/glsl/fs_distortion.binbin3752 -> 3725 bytes
-rw-r--r--bgfx/shaders/glsl/fs_ntsc_decode.binbin6318 -> 6282 bytes
-rw-r--r--bgfx/shaders/glsl/fs_ntsc_encode.binbin2730 -> 2676 bytes
-rw-r--r--bgfx/shaders/glsl/fs_post.binbin4166 -> 3530 bytes
-rw-r--r--bgfx/shaders/glsl/vs_deconverge.binbin1488 -> 1301 bytes
-rw-r--r--bgfx/shaders/metal/fs_color.binbin1334 -> 1298 bytes
-rw-r--r--bgfx/shaders/metal/fs_deconverge.binbin1069 -> 997 bytes
-rw-r--r--bgfx/shaders/metal/fs_defocus.binbin2475 -> 2295 bytes
-rw-r--r--bgfx/shaders/metal/fs_distortion.binbin4349 -> 4313 bytes
-rw-r--r--bgfx/shaders/metal/fs_ntsc_decode.binbin7152 -> 7098 bytes
-rw-r--r--bgfx/shaders/metal/fs_ntsc_encode.binbin3415 -> 3325 bytes
-rw-r--r--bgfx/shaders/metal/fs_post.binbin4828 -> 4172 bytes
-rw-r--r--bgfx/shaders/metal/vs_deconverge.binbin1733 -> 1547 bytes
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp4
-rw-r--r--src/osd/modules/lib/osdobj_common.h6
-rw-r--r--src/osd/modules/render/bgfx/chain.cpp15
-rw-r--r--src/osd/modules/render/bgfx/chain.h3
-rw-r--r--src/osd/modules/render/bgfx/chainentry.cpp116
-rw-r--r--src/osd/modules/render/bgfx/chainentry.h8
-rw-r--r--src/osd/modules/render/bgfx/chainentryreader.cpp10
-rw-r--r--src/osd/modules/render/bgfx/chainreader.cpp21
-rw-r--r--src/osd/modules/render/bgfx/fs_blit.sc1
-rw-r--r--src/osd/modules/render/bgfx/fs_color.sc25
-rw-r--r--src/osd/modules/render/bgfx/fs_deconverge.sc11
-rw-r--r--src/osd/modules/render/bgfx/fs_defocus.sc30
-rw-r--r--src/osd/modules/render/bgfx/fs_distortion.sc50
-rw-r--r--src/osd/modules/render/bgfx/fs_gui.sc4
-rw-r--r--src/osd/modules/render/bgfx/fs_ntsc_decode.sc17
-rw-r--r--src/osd/modules/render/bgfx/fs_ntsc_encode.sc19
-rw-r--r--src/osd/modules/render/bgfx/fs_phosphor.sc2
-rw-r--r--src/osd/modules/render/bgfx/fs_post.sc62
-rw-r--r--src/osd/modules/render/bgfx/fs_ratios.sc23
-rw-r--r--src/osd/modules/render/bgfx/fs_screen.sc1
-rw-r--r--src/osd/modules/render/bgfx/fs_tint.sc17
-rw-r--r--src/osd/modules/render/bgfx/inputpair.cpp3
-rw-r--r--src/osd/modules/render/bgfx/slider.cpp17
-rw-r--r--src/osd/modules/render/bgfx/slider.h7
-rw-r--r--src/osd/modules/render/bgfx/suppressor.cpp2
-rw-r--r--src/osd/modules/render/bgfx/target.cpp12
-rw-r--r--src/osd/modules/render/bgfx/target.h9
-rw-r--r--src/osd/modules/render/bgfx/targetmanager.cpp8
-rw-r--r--src/osd/modules/render/bgfx/targetmanager.h2
-rw-r--r--src/osd/modules/render/bgfx/texturemanager.cpp33
-rw-r--r--src/osd/modules/render/bgfx/texturemanager.h1
-rw-r--r--src/osd/modules/render/bgfx/vs_deconverge.sc23
-rw-r--r--src/osd/modules/render/bgfx/vs_ratios.sc14
-rw-r--r--src/osd/modules/render/bgfx/vs_tint.sc14
-rw-r--r--src/osd/modules/render/copyutil.h167
-rw-r--r--src/osd/modules/render/drawbgfx.cpp253
-rw-r--r--src/osd/modules/render/drawbgfx.h2
112 files changed, 668 insertions, 798 deletions
diff --git a/bgfx/chains/LICENSE b/bgfx/chains/LICENSE
new file mode 100644
index 00000000000..e1a4f1f53d6
--- /dev/null
+++ b/bgfx/chains/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/chains/README.md b/bgfx/chains/README.md
new file mode 100644
index 00000000000..2b165723286
--- /dev/null
+++ b/bgfx/chains/README.md
@@ -0,0 +1,5 @@
+# **Tests** #
+
+Cointains definitions for BGFX shader chains
+
+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/chains/hlsl.json b/bgfx/chains/hlsl.json
index 935833750de..3672cbd9b4a 100644
--- a/bgfx/chains/hlsl.json
+++ b/bgfx/chains/hlsl.json
@@ -19,42 +19,41 @@
{ "type": "color", "name": "grn_ratios", "text": "Green Output from ", "default": [ 0, 100, 0 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
{ "type": "color", "name": "blu_ratios", "text": "Blue Output from ", "default": [ 0, 0, 100 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
{ "type": "color", "name": "offset", "text": "Signal Offset, ", "default": [ 0, 0, 0 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
- { "type": "color", "name": "scale", "text": "Signal Scale, ", "default": [ 100, 100, 100 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
- { "type": "float", "name": "saturation", "text": "Color Saturation", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
+ { "type": "color", "name": "scale", "text": "Signal Scale, ", "default": [ 95, 95, 95 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
+ { "type": "float", "name": "saturation", "text": "Color Saturation", "default": 150, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
- { "type": "vec2", "name": "converge_red", "text": "Red Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
- { "type": "vec2", "name": "converge_green", "text": "Green Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
+ { "type": "vec2", "name": "converge_red", "text": "Red Convergence, ", "default": [ 5, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
+ { "type": "vec2", "name": "converge_green", "text": "Green Convergence, ", "default": [ 0, 5 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
{ "type": "vec2", "name": "converge_blue", "text": "Blue Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
{ "type": "vec2", "name": "radial_converge_red", "text": "Red Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
{ "type": "vec2", "name": "radial_converge_green", "text": "Green Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
{ "type": "vec2", "name": "radial_converge_blue", "text": "Blue Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
- { "type": "vec2", "name": "defocus", "text": "Defocus, ", "default": [ 0, 0 ], "max": [ 500, 500 ], "min": [ 0, 0 ], "step": 1, "scale": 0.1, "format": "%2.1f", "screen": "crt" },
+ { "type": "vec2", "name": "defocus", "text": "Defocus, ", "default": [ 5, 5 ], "max": [ 500, 500 ], "min": [ 0, 0 ], "step": 1, "scale": 0.1, "format": "%2.1f", "screen": "crt" },
- { "type": "color", "name": "phosphor", "text": "Phosphor Persistence, ", "default": [ 0, 0, 0 ], "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": [ 45, 45, 45 ], "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": 100, "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": 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": "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_count", "text": "Shadow Mask Pixel Count ", "default": [ 60, 40 ], "max": [ 400, 400 ], "min": [ 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
- { "type": "vec2", "name": "shadow_uv_size", "text": "Shadow Mask UV Size ", "default": [ 48, 64 ], "max": [ 256, 256 ], "min": [ 0, 0 ], "step": 1, "scale": 0.00390625, "format": "%1.7f", "screen": "crt" },
- { "type": "vec2", "name": "shadow_uv_offset", "text": "Shadow Mask UV Offset ", "default": [ 0, 0 ], "max": [ 256, 256 ], "min": [ 0, 0 ], "step": 1, "scale": 0.00390625, "format": "%1.7f", "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": "int_enum", "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": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "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_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": [ 0, 0, 0 ], "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": "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": 0, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
- { "type": "float", "name": "round_corner", "text": "Rounded Corner Amount", "default": 0, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
- { "type": "float", "name": "smooth_border", "text": "Smooth Border Amount", "default": 0, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
- { "type": "float", "name": "vignetting", "text": "Vignetting Amount", "default": 0, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
- { "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 0, "max": 200, "min": 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": "round_corner", "text": "Rounded Corner Amount", "default": 20, "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": 30, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }
],
"parameters": [
{ "name": "jitter", "type": "frame", "period": 2 },
@@ -64,22 +63,27 @@
{
"name": "guest",
"mode": "guest",
- "prescale": 1,
+ "bilinear": false,
+ "prescale": false,
"doublebuffer": true
},
- { "name": "native",
- "mode": "native",
- "prescale": 1,
+ { "name": "internal",
+ "mode": "guest",
+ "prescale": true,
"doublebuffer": true
},
{ "name": "previous",
+ "mode": "guest",
+ "prescale": true,
+ "doublebuffer": true
+ },
+ { "name": "screen",
"mode": "native",
- "prescale": 1,
"doublebuffer": true
},
{ "name": "bloom",
- "mode": "native",
- "prescale": 1,
+ "mode": "guest",
+ "prescale": true,
"doublebuffer": true,
"pyramid": true
}
@@ -101,7 +105,7 @@
{ "uniform": "u_jitter_amount", "parameter": "jitter" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "screen" }
+ { "sampler": "s_tex", "texture": "screen" }
],
"output": "guest"
},
@@ -125,7 +129,7 @@
{ "uniform": "u_jitter_amount", "parameter": "jitter" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "guest" }
+ { "sampler": "s_tex", "texture": "guest" }
],
"output": "guest"
},
@@ -154,7 +158,7 @@
{ "uniform": "u_saturation", "slider": "saturation" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "guest" }
+ { "sampler": "s_tex", "texture": "guest" }
],
"output": "guest"
},
@@ -163,7 +167,7 @@
"input": [
{ "sampler": "s_tex", "texture": "guest" }
],
- "output": "native"
+ "output": "internal"
},
{ "effect": "deconverge",
"name": "Deconvergence",
@@ -185,9 +189,9 @@
{ "uniform": "u_radial_converge_blue", "slider": "radial_converge_blue" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "native" }
+ { "sampler": "s_tex", "texture": "internal" }
],
- "output": "native"
+ "output": "internal"
},
{ "effect": "defocus",
"name": "Defocus Pass 1",
@@ -199,9 +203,9 @@
{ "uniform": "u_defocus", "slider": "defocus" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "native" }
+ { "sampler": "s_tex", "texture": "internal" }
],
- "output": "native"
+ "output": "internal"
},
{ "effect": "defocus",
"name": "Defocus Pass 2",
@@ -213,9 +217,9 @@
{ "uniform": "u_defocus", "slider": "defocus" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "native" }
+ { "sampler": "s_tex", "texture": "internal" }
],
- "output": "native"
+ "output": "internal"
},
{ "effect": "phosphor",
"name": "Phosphor Decay",
@@ -228,10 +232,10 @@
{ "uniform": "u_phosphor", "slider": "phosphor" }
],
"input": [
- { "sampler": "s_tex", "texture": "native" },
+ { "sampler": "s_tex", "texture": "internal" },
{ "sampler": "s_prev", "texture": "previous" }
],
- "output": "native"
+ "output": "internal"
},
{ "effect": "phosphor",
"name": "Phosphor Store",
@@ -244,8 +248,8 @@
{ "uniform": "u_phosphor", "slider": "phosphor" }
],
"input": [
- { "sampler": "s_tex", "texture": "native" },
- { "sampler": "s_prev", "texture": "native" }
+ { "sampler": "s_tex", "texture": "internal" },
+ { "sampler": "s_prev", "texture": "internal" }
],
"output": "previous"
},
@@ -259,14 +263,12 @@
{ "type": "slider", "condition": "equal", "combine": "and", "name": "floor", "value": [ 0, 0, 0 ] },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "power", "value": [ 0, 0, 0 ] }
],
- "textures": [ { "name": "shadow" } ],
"uniforms": [
{ "uniform": "u_scanline_alpha", "slider": "scanline_alpha" },
{ "uniform": "u_scanline_scale", "slider": "scanline_scale" },
{ "uniform": "u_scanline_bright_scale", "slider": "scanline_bright_scale" },
{ "uniform": "u_scanline_bright_offset", "slider": "scanline_bright_offset" },
{ "uniform": "u_shadow_alpha", "slider": "shadow_alpha" },
- { "uniform": "u_shadow_count", "slider": "shadow_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" },
@@ -279,10 +281,10 @@
{ "uniform": "u_time", "parameter": "time" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "native" },
- { "sampler": "ShadowSampler", "texture": "shadow" }
+ { "sampler": "s_tex", "texture": "internal" },
+ { "sampler": "s_shadow", "texture": "shadow" }
],
- "output": "native"
+ "output": "internal"
},
{ "effect": "distortion",
"name": "Distortion Pass",
@@ -302,10 +304,17 @@
{ "uniform": "u_reflection", "slider": "reflection" }
],
"input": [
- { "sampler": "DiffuseSampler", "texture": "native" }
+ { "sampler": "s_tex", "texture": "internal" }
+ ],
+ "output": "internal"
+ },
+ { "effect": "blit",
+ "name": "Final Downscale",
+ "input": [
+ { "sampler": "s_tex", "texture": "internal" }
],
- "output": "native"
+ "output": "screen"
}
],
- "output": "native"
+ "output": "screen"
} \ No newline at end of file
diff --git a/bgfx/chains/test.json b/bgfx/chains/test.json
deleted file mode 100644
index f698ff6cf54..00000000000
--- a/bgfx/chains/test.json
+++ /dev/null
@@ -1,115 +0,0 @@
-{ "name": "Test Shader Chain",
- "author": "Ryan Holtz",
- "sliders": [
- { "type": "int_enum", "name": "adjustments", "text": "Enable Adjustments", "default": 0, "max": 1, "min": 0, "step": 1, "scale": 1.0, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] },
- { "type": "float", "name": "ratio_amount", "text": "Ratio Amount", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "any" },
- { "type": "color", "name": "red_ratios", "text": "Color Matrix, Red from ", "default": [ 200, 0, 0 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.005, "format": "%2.3f", "screen": "any" },
- { "type": "color", "name": "grn_ratios", "text": "Color Matrix, Green from ", "default": [ 0, 200, 0 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.005, "format": "%2.3f", "screen": "any" },
- { "type": "color", "name": "blu_ratios", "text": "Color Matrix, Blue from ", "default": [ 0, 0, 200 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.005, "format": "%2.3f", "screen": "any" },
- { "type": "color", "name": "tint", "text": "Tint ", "default": [ 100, 100, 100 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "any" },
- { "type": "color", "name": "phosphor", "text": "Phosphor Life, ", "default": [ 0, 0, 0 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "any" },
- { "type": "vec2", "name": "shift", "text": "Frame Shift ", "default": [ 0, 0 ], "max": [ 25, 25 ], "min": [ -25, -25 ], "step": 1, "scale": 1.0, "format": "%2.f", "screen": "raster" }
- ],
- "parameters": [
- { "name": "alternating", "type": "frame", "period": 2 }
- ],
- "targets": [
- { "name": "native",
- "mode": "native",
- "prescale": 1,
- "doublebuffer": true
- },
- { "name": "previous",
- "mode": "native",
- "prescale": 1,
- "doublebuffer": true
- }
- ],
- "passes": [
- { "effect": "ratios",
- "name": "Matrix Pass",
- "disablewhen": [
- { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 },
- { "type": "slider", "condition": "equal", "name": "ratio_amount", "value": 0 }
- ],
- "uniforms": [
- { "uniform": "u_ratio_amount", "slider": "ratio_amount" },
- { "uniform": "u_red_ratios", "slider": "red_ratios" },
- { "uniform": "u_grn_ratios", "slider": "grn_ratios" },
- { "uniform": "u_blu_ratios", "slider": "blu_ratios" }
- ],
- "input": [
- { "sampler": "s_tex", "texture": "screen" }
- ],
- "output": "native"
- },
- { "effect": "blit",
- "name": "Matrix Skip",
- "disablewhen": [
- { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 },
- { "type": "slider", "condition": "notequal", "name": "ratio_amount", "value": 0 }
- ],
- "input": [
- { "sampler": "s_tex", "texture": "screen" }
- ],
- "output": "native"
- },
- { "effect": "tint",
- "name": "Tint Pass",
- "disablewhen": [
- { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 }
- ],
- "uniforms": [
- { "uniform": "u_tint", "slider": "tint" },
- { "uniform": "u_shift", "slider": "shift" }
- ],
- "input": [
- { "sampler": "s_tex", "texture": "native" }
- ],
- "output": "native"
- },
- { "effect": "phosphor",
- "name": "Phosphor Decay",
- "disablewhen": [
- { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 },
- { "type": "slider", "condition": "equal", "name": "phosphor", "value": [ 0, 0, 0 ] }
- ],
- "uniforms": [
- { "uniform": "u_passthrough", "value": [ 0 ] },
- { "uniform": "u_phosphor", "slider": "phosphor" }
- ],
- "input": [
- { "sampler": "s_tex", "texture": "native" },
- { "sampler": "s_prev", "texture": "previous" }
- ],
- "output": "native"
- },
- { "effect": "phosphor",
- "name": "Phosphor Store",
- "disablewhen": [
- { "type": "slider", "condition": "equal", "name": "adjustments", "value": 0 },
- { "type": "slider", "condition": "equal", "name": "phosphor", "value": [ 0, 0, 0 ] }
- ],
- "uniforms": [
- { "uniform": "u_passthrough", "value": [ 1 ] },
- { "uniform": "u_phosphor", "slider": "phosphor" }
- ],
- "input": [
- { "sampler": "s_tex", "texture": "native" },
- { "sampler": "s_prev", "texture": "native" }
- ],
- "output": "previous"
- },
- { "effect": "blit",
- "name": "Total Skip",
- "disablewhen": [
- { "type": "slider", "condition": "notequal", "name": "adjustments", "value": 0 }
- ],
- "input": [
- { "sampler": "s_tex", "texture": "screen" }
- ],
- "output": "native"
- }
- ],
- "output": "native"
-} \ No newline at end of file
diff --git a/bgfx/effects/LICENSE b/bgfx/effects/LICENSE
new file mode 100644
index 00000000000..e1a4f1f53d6
--- /dev/null
+++ b/bgfx/effects/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/README.md b/bgfx/effects/README.md
new file mode 100644
index 00000000000..2b165723286
--- /dev/null
+++ b/bgfx/effects/README.md
@@ -0,0 +1,5 @@
+# **Tests** #
+
+Cointains definitions for BGFX shader chains
+
+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/bloom_scale.json b/bgfx/effects/bloom_scale.json
deleted file mode 100644
index 5ba081a5a19..00000000000
--- a/bgfx/effects/bloom_scale.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "blend": {
- "equation": "add",
- "srcColor": "1",
- "dstColor": "0",
- "srcAlpha": "1",
- "dstAlpha": "0"
- },
- "depth": {
- "function": "always"
- },
- "cull": { "mode": "none" },
- "write": {
- "rgb": "true",
- "alpha": "true"
- },
- "vertex": "vs_bloom_scale",
- "fragment": "fs_bloom_scale",
- "uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
- { "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }
- ]
-} \ No newline at end of file
diff --git a/bgfx/effects/color.json b/bgfx/effects/color.json
index 41e38714e9c..df6448631ec 100644
--- a/bgfx/effects/color.json
+++ b/bgfx/effects/color.json
@@ -17,12 +17,12 @@
"vertex": "vs_color",
"fragment": "fs_color",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
+ { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
{ "name": "u_red_ratios", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_grn_ratios", "type": "vec4", "values": [ 0.0, 1.0, 0.0, 0.0 ] },
{ "name": "u_blu_ratios", "type": "vec4", "values": [ 0.0, 0.0, 1.0, 0.0 ] },
{ "name": "u_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_scale", "type": "vec4", "values": [ 1.0, 1.0, 1.0, 0.0 ] },
- { "name": "u_saturation", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }
+ { "name": "u_scale", "type": "vec4", "values": [ 0.95, 0.95, 0.95, 0.0 ] },
+ { "name": "u_saturation", "type": "vec4", "values": [ 1.5, 0.0, 0.0, 0.0 ] }
]
} \ No newline at end of file
diff --git a/bgfx/effects/deconverge.json b/bgfx/effects/deconverge.json
index 69d67632497..8da0d5434b4 100644
--- a/bgfx/effects/deconverge.json
+++ b/bgfx/effects/deconverge.json
@@ -17,17 +17,13 @@
"vertex": "vs_deconverge",
"fragment": "fs_deconverge",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
- { "name": "u_texsize", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
- { "name": "u_screenrect", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
- { "name": "u_converge_red", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_converge_green", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
+ { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
+ { "name": "u_converge_red", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
+ { "name": "u_converge_green", "type": "vec4", "values": [ 0.0, 0.5, 0.0, 0.0 ] },
{ "name": "u_converge_blue", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_radial_converge_red", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_radial_converge_green", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_radial_converge_blue", "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_quad_dims", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_guest_dims", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
+ { "name": "u_source_dims", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }
]
} \ No newline at end of file
diff --git a/bgfx/effects/defocus.json b/bgfx/effects/defocus.json
index ddf8abf1b62..364283f9f48 100644
--- a/bgfx/effects/defocus.json
+++ b/bgfx/effects/defocus.json
@@ -17,10 +17,8 @@
"vertex": "vs_defocus",
"fragment": "fs_defocus",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
- { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_quad_dims", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_defocus", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
+ { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
+ { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
+ { "name": "u_defocus", "type": "vec4", "values": [ 0.5, 0.5, 0.0, 0.0 ] }
]
} \ No newline at end of file
diff --git a/bgfx/effects/distortion.json b/bgfx/effects/distortion.json
index e8fcb4722c7..de216b397b2 100644
--- a/bgfx/effects/distortion.json
+++ b/bgfx/effects/distortion.json
@@ -17,13 +17,13 @@
"vertex": "vs_distortion",
"fragment": "fs_distortion",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 0.0 ] },
- { "name": "u_screen_dims", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_curvature", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_round_corner", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_smooth_border", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_vignetting", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_reflection", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
+ { "name": "s_tex", "type": "int", "values": [ 0.0 ] },
+ { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
+ { "name": "u_curvature", "type": "vec4", "values": [ 0.25, 0.0, 0.0, 0.0 ] },
+ { "name": "u_round_corner", "type": "vec4", "values": [ 0.2, 0.0, 0.0, 0.0 ] },
+ { "name": "u_smooth_border", "type": "vec4", "values": [ 0.05, 0.0, 0.0, 0.0 ] },
+ { "name": "u_vignetting", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] },
+ { "name": "u_reflection", "type": "vec4", "values": [ 0.30, 0.0, 0.0, 0.0 ] },
{ "name": "u_rotation_type", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
]
} \ No newline at end of file
diff --git a/bgfx/effects/ntsc_decode.json b/bgfx/effects/ntsc_decode.json
index 89e8288f8b2..0bf1963c85f 100644
--- a/bgfx/effects/ntsc_decode.json
+++ b/bgfx/effects/ntsc_decode.json
@@ -17,18 +17,18 @@
"vertex": "vs_ntsc_decode",
"fragment": "fs_ntsc_decode",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
- { "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
- { "name": "u_a_value", "type": "vec4", "values": [ 0.5, 0.5, 0.5, 0.5 ] },
- { "name": "u_b_value", "type": "vec4", "values": [ 0.5, 0.5, 0.5, 0.5 ] },
- { "name": "u_cc_value", "type": "vec4", "values": [ 3.5795454, 3.5795454, 3.5795454, 3.5795454 ] },
- { "name": "u_o_value", "type": "vec4", "values": [ 1.570796325, 1.570796325, 1.570796325, 1.570796325 ] },
- { "name": "u_scan_time", "type": "vec4", "values": [ 52.6, 0.0, 0.0, 0.0 ] },
- { "name": "u_notch_width", "type": "vec4", "values": [ 2.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_y_freq_response", "type": "vec4", "values": [ 6.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_i_freq_response", "type": "vec4", "values": [ 1.2, 0.0, 0.0, 0.0 ] },
- { "name": "u_q_freq_response", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] },
- { "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_jitter_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
+ { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
+ { "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
+ { "name": "u_a_value", "type": "vec4", "values": [ 0.5, 0.5, 0.5, 0.5 ] },
+ { "name": "u_b_value", "type": "vec4", "values": [ 0.5, 0.5, 0.5, 0.5 ] },
+ { "name": "u_cc_value", "type": "vec4", "values": [ 3.5795454, 3.5795454, 3.5795454, 3.5795454 ] },
+ { "name": "u_o_value", "type": "vec4", "values": [ 1.570796325, 1.570796325, 1.570796325, 1.570796325 ] },
+ { "name": "u_scan_time", "type": "vec4", "values": [ 52.6, 0.0, 0.0, 0.0 ] },
+ { "name": "u_notch_width", "type": "vec4", "values": [ 2.0, 0.0, 0.0, 0.0 ] },
+ { "name": "u_y_freq_response", "type": "vec4", "values": [ 6.0, 0.0, 0.0, 0.0 ] },
+ { "name": "u_i_freq_response", "type": "vec4", "values": [ 1.2, 0.0, 0.0, 0.0 ] },
+ { "name": "u_q_freq_response", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] },
+ { "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
+ { "name": "u_jitter_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
]
} \ No newline at end of file
diff --git a/bgfx/effects/ntsc_encode.json b/bgfx/effects/ntsc_encode.json
index 9cee95af3c3..f635edad14c 100644
--- a/bgfx/effects/ntsc_encode.json
+++ b/bgfx/effects/ntsc_encode.json
@@ -17,14 +17,14 @@
"vertex": "vs_ntsc_encode",
"fragment": "fs_ntsc_encode",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
- { "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
- { "name": "u_a_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
- { "name": "u_b_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
- { "name": "u_cc_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
- { "name": "u_p_value", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_scan_time", "type": "vec4", "values": [ 52.6, 0.0, 0.0, 0.0 ] },
- { "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
- { "name": "u_jitter_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
+ { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
+ { "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
+ { "name": "u_a_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
+ { "name": "u_b_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
+ { "name": "u_cc_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
+ { "name": "u_p_value", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
+ { "name": "u_scan_time", "type": "vec4", "values": [ 52.6, 0.0, 0.0, 0.0 ] },
+ { "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
+ { "name": "u_jitter_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
]
} \ No newline at end of file
diff --git a/bgfx/effects/post.json b/bgfx/effects/post.json
index f73e2a0be7c..21936db55d6 100644
--- a/bgfx/effects/post.json
+++ b/bgfx/effects/post.json
@@ -17,12 +17,11 @@
"vertex": "vs_post",
"fragment": "fs_post",
"uniforms": [
- { "name": "DiffuseSampler", "type": "int", "values": [ 0.0 ] },
- { "name": "ShadowSampler", "type": "int", "values": [ 1.0 ] },
+ { "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": [ 1.0, 1.0, 0.0, 0.0 ] },
- { "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
- { "name": "u_shadow_dims", "type": "vec4", "values": [ 32.0, 32.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 ] },
@@ -41,8 +40,7 @@
{ "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_count", "type": "vec4", "values": [ 6.0, 4.0, 0.0, 0.0 ] },
- { "name": "u_shadow_uv", "type": "vec4", "values": [ 0.25, 0.25, 0.0, 0.0 ] },
+ { "name": "u_shadow_uv", "type": "vec4", "values": [ 0.25, 0.333, 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/ratios.json b/bgfx/effects/ratios.json
deleted file mode 100644
index 7b8af5c1875..00000000000
--- a/bgfx/effects/ratios.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "blend": {
- "equation": "add",
- "srcColor": "1",
- "dstColor": "0",
- "srcAlpha": "1",
- "dstAlpha": "0"
- },
- "depth": {
- "function": "always"
- },
- "cull": { "mode": "none" },
- "write": {
- "rgb": "true",
- "alpha": "true"
- },
- "vertex": "vs_ratios",
- "fragment": "fs_ratios",
- "uniforms": [
- { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
- { "name": "u_red_ratios", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 1.0 ] },
- { "name": "u_grn_ratios", "type": "vec4", "values": [ 0.0, 1.0, 0.0, 1.0 ] },
- { "name": "u_blu_ratios", "type": "vec4", "values": [ 0.0, 0.0, 1.0, 1.0 ] },
- { "name": "u_ratio_amount", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }
- ]
-} \ No newline at end of file
diff --git a/bgfx/effects/tint.json b/bgfx/effects/tint.json
deleted file mode 100644
index 9b022ebe993..00000000000
--- a/bgfx/effects/tint.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "blend": {
- "equation": "add",
- "srcColor": "1",
- "dstColor": "0",
- "srcAlpha": "1",
- "dstAlpha": "0"
- },
- "depth": {
- "function": "always"
- },
- "cull": { "mode": "none" },
- "write": {
- "rgb": "true",
- "alpha": "true"
- },
- "vertex": "vs_tint",
- "fragment": "fs_tint",
- "uniforms": [
- { "name": "s_tex", "type": "int", "values": [ 1.0 ] },
- { "name": "u_tint", "type": "vec4", "values": [ 1.0, 1.0, 1.0, 1.0 ] },
- { "name": "u_shift", "type": "vec4", "values": [ 0.1, 0.1, 0.0, 0.0 ] },
- { "name": "u_texsize", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }
- ]
-} \ No newline at end of file
diff --git a/bgfx/shaders/dx11/fs_blit.bin b/bgfx/shaders/dx11/fs_blit.bin
index 185d5a65b6a..ffaaa190950 100644
--- a/bgfx/shaders/dx11/fs_blit.bin
+++ b/bgfx/shaders/dx11/fs_blit.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_color.bin b/bgfx/shaders/dx11/fs_color.bin
index ce7cde86c96..5cbf93eb345 100644
--- a/bgfx/shaders/dx11/fs_color.bin
+++ b/bgfx/shaders/dx11/fs_color.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_deconverge.bin b/bgfx/shaders/dx11/fs_deconverge.bin
index 3c6744c0def..cfd2f01541b 100644
--- a/bgfx/shaders/dx11/fs_deconverge.bin
+++ b/bgfx/shaders/dx11/fs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_defocus.bin b/bgfx/shaders/dx11/fs_defocus.bin
index 3d4c59a7faf..27bae0bf11a 100644
--- a/bgfx/shaders/dx11/fs_defocus.bin
+++ b/bgfx/shaders/dx11/fs_defocus.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_distortion.bin b/bgfx/shaders/dx11/fs_distortion.bin
index 434d894b279..77295d7a4b7 100644
--- a/bgfx/shaders/dx11/fs_distortion.bin
+++ b/bgfx/shaders/dx11/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_gui.bin b/bgfx/shaders/dx11/fs_gui.bin
index 0c91226bafa..5f452bdc4f2 100644
--- a/bgfx/shaders/dx11/fs_gui.bin
+++ b/bgfx/shaders/dx11/fs_gui.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_ntsc_decode.bin b/bgfx/shaders/dx11/fs_ntsc_decode.bin
index ac5fd682c48..327d86d1fce 100644
--- a/bgfx/shaders/dx11/fs_ntsc_decode.bin
+++ b/bgfx/shaders/dx11/fs_ntsc_decode.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_ntsc_encode.bin b/bgfx/shaders/dx11/fs_ntsc_encode.bin
index 6f4d2bcfe36..05f2161a539 100644
--- a/bgfx/shaders/dx11/fs_ntsc_encode.bin
+++ b/bgfx/shaders/dx11/fs_ntsc_encode.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_phosphor.bin b/bgfx/shaders/dx11/fs_phosphor.bin
index bdc6523bb0d..1a9430af3ad 100644
--- a/bgfx/shaders/dx11/fs_phosphor.bin
+++ b/bgfx/shaders/dx11/fs_phosphor.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_post.bin b/bgfx/shaders/dx11/fs_post.bin
index 9797487029f..b0f7026a48b 100644
--- a/bgfx/shaders/dx11/fs_post.bin
+++ b/bgfx/shaders/dx11/fs_post.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_ratios.bin b/bgfx/shaders/dx11/fs_ratios.bin
index 491c3f99f47..e55574117d5 100644
--- a/bgfx/shaders/dx11/fs_ratios.bin
+++ b/bgfx/shaders/dx11/fs_ratios.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_screen.bin b/bgfx/shaders/dx11/fs_screen.bin
index 392fe4252b4..e1984860d6d 100644
--- a/bgfx/shaders/dx11/fs_screen.bin
+++ b/bgfx/shaders/dx11/fs_screen.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/fs_tint.bin b/bgfx/shaders/dx11/fs_tint.bin
index 04ce07637ab..708682bdaed 100644
--- a/bgfx/shaders/dx11/fs_tint.bin
+++ b/bgfx/shaders/dx11/fs_tint.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_blit.bin b/bgfx/shaders/dx11/vs_blit.bin
index c116cc2a4e9..5a91e418e0e 100644
--- a/bgfx/shaders/dx11/vs_blit.bin
+++ b/bgfx/shaders/dx11/vs_blit.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_color.bin b/bgfx/shaders/dx11/vs_color.bin
index fbb6b7a15cc..1abc2ad4ee4 100644
--- a/bgfx/shaders/dx11/vs_color.bin
+++ b/bgfx/shaders/dx11/vs_color.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_deconverge.bin b/bgfx/shaders/dx11/vs_deconverge.bin
index 8057739fc5a..e23c0d8a2c4 100644
--- a/bgfx/shaders/dx11/vs_deconverge.bin
+++ b/bgfx/shaders/dx11/vs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_defocus.bin b/bgfx/shaders/dx11/vs_defocus.bin
index 764b3bcce77..36da8e24752 100644
--- a/bgfx/shaders/dx11/vs_defocus.bin
+++ b/bgfx/shaders/dx11/vs_defocus.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_distortion.bin b/bgfx/shaders/dx11/vs_distortion.bin
index 732acef5941..4f021030a66 100644
--- a/bgfx/shaders/dx11/vs_distortion.bin
+++ b/bgfx/shaders/dx11/vs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_gui.bin b/bgfx/shaders/dx11/vs_gui.bin
index a4cb697e49b..f1707c28ed0 100644
--- a/bgfx/shaders/dx11/vs_gui.bin
+++ b/bgfx/shaders/dx11/vs_gui.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_ntsc_decode.bin b/bgfx/shaders/dx11/vs_ntsc_decode.bin
index e8488bee668..62adb591763 100644
--- a/bgfx/shaders/dx11/vs_ntsc_decode.bin
+++ b/bgfx/shaders/dx11/vs_ntsc_decode.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_ntsc_encode.bin b/bgfx/shaders/dx11/vs_ntsc_encode.bin
index eb7997d7482..c9695a27aea 100644
--- a/bgfx/shaders/dx11/vs_ntsc_encode.bin
+++ b/bgfx/shaders/dx11/vs_ntsc_encode.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_phosphor.bin b/bgfx/shaders/dx11/vs_phosphor.bin
index 42eca109791..18d3a86a8b4 100644
--- a/bgfx/shaders/dx11/vs_phosphor.bin
+++ b/bgfx/shaders/dx11/vs_phosphor.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_post.bin b/bgfx/shaders/dx11/vs_post.bin
index 3ec96991283..fa5c59c6818 100644
--- a/bgfx/shaders/dx11/vs_post.bin
+++ b/bgfx/shaders/dx11/vs_post.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_ratios.bin b/bgfx/shaders/dx11/vs_ratios.bin
index 0544af5799e..3b79123d4f9 100644
--- a/bgfx/shaders/dx11/vs_ratios.bin
+++ b/bgfx/shaders/dx11/vs_ratios.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_screen.bin b/bgfx/shaders/dx11/vs_screen.bin
index fe3145fa0ed..96dc86dc5f0 100644
--- a/bgfx/shaders/dx11/vs_screen.bin
+++ b/bgfx/shaders/dx11/vs_screen.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/vs_tint.bin b/bgfx/shaders/dx11/vs_tint.bin
index ae2f439ccc3..1545fd6243a 100644
--- a/bgfx/shaders/dx11/vs_tint.bin
+++ b/bgfx/shaders/dx11/vs_tint.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_color.bin b/bgfx/shaders/dx9/fs_color.bin
index b93489e973b..bcde8844dd2 100644
--- a/bgfx/shaders/dx9/fs_color.bin
+++ b/bgfx/shaders/dx9/fs_color.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_deconverge.bin b/bgfx/shaders/dx9/fs_deconverge.bin
index c9628442dc4..b98ee3cb31d 100644
--- a/bgfx/shaders/dx9/fs_deconverge.bin
+++ b/bgfx/shaders/dx9/fs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_defocus.bin b/bgfx/shaders/dx9/fs_defocus.bin
index 044c0f02dbd..6ba9faa3292 100644
--- a/bgfx/shaders/dx9/fs_defocus.bin
+++ b/bgfx/shaders/dx9/fs_defocus.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_distortion.bin b/bgfx/shaders/dx9/fs_distortion.bin
index 6e74df22b60..7b0fa91eb2f 100644
--- a/bgfx/shaders/dx9/fs_distortion.bin
+++ b/bgfx/shaders/dx9/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_gui.bin b/bgfx/shaders/dx9/fs_gui.bin
index ec504cbec18..405e3c1f4d9 100644
--- a/bgfx/shaders/dx9/fs_gui.bin
+++ b/bgfx/shaders/dx9/fs_gui.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_ntsc_decode.bin b/bgfx/shaders/dx9/fs_ntsc_decode.bin
index 855b1a4575f..c5731a1312b 100644
--- a/bgfx/shaders/dx9/fs_ntsc_decode.bin
+++ b/bgfx/shaders/dx9/fs_ntsc_decode.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_ntsc_encode.bin b/bgfx/shaders/dx9/fs_ntsc_encode.bin
index 26d087e2f18..375d4339fcc 100644
--- a/bgfx/shaders/dx9/fs_ntsc_encode.bin
+++ b/bgfx/shaders/dx9/fs_ntsc_encode.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/fs_post.bin b/bgfx/shaders/dx9/fs_post.bin
index fb01e30626c..8bb9bd011e5 100644
--- a/bgfx/shaders/dx9/fs_post.bin
+++ b/bgfx/shaders/dx9/fs_post.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/vs_deconverge.bin b/bgfx/shaders/dx9/vs_deconverge.bin
index 9ac3015468d..cd3e0330f90 100644
--- a/bgfx/shaders/dx9/vs_deconverge.bin
+++ b/bgfx/shaders/dx9/vs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_color.bin b/bgfx/shaders/gles/fs_color.bin
index aa4e13d03ae..a0379220e9c 100644
--- a/bgfx/shaders/gles/fs_color.bin
+++ b/bgfx/shaders/gles/fs_color.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_deconverge.bin b/bgfx/shaders/gles/fs_deconverge.bin
index 33f2f66a503..9a70a7b0737 100644
--- a/bgfx/shaders/gles/fs_deconverge.bin
+++ b/bgfx/shaders/gles/fs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_defocus.bin b/bgfx/shaders/gles/fs_defocus.bin
index 5dcbadcae38..ce0b956494a 100644
--- a/bgfx/shaders/gles/fs_defocus.bin
+++ b/bgfx/shaders/gles/fs_defocus.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_distortion.bin b/bgfx/shaders/gles/fs_distortion.bin
index b7afea3952d..d423d9b7fb8 100644
--- a/bgfx/shaders/gles/fs_distortion.bin
+++ b/bgfx/shaders/gles/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_ntsc_decode.bin b/bgfx/shaders/gles/fs_ntsc_decode.bin
index 199ef94c345..42be06119d1 100644
--- a/bgfx/shaders/gles/fs_ntsc_decode.bin
+++ b/bgfx/shaders/gles/fs_ntsc_decode.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_ntsc_encode.bin b/bgfx/shaders/gles/fs_ntsc_encode.bin
index d2d5c0d24f7..539db74272f 100644
--- a/bgfx/shaders/gles/fs_ntsc_encode.bin
+++ b/bgfx/shaders/gles/fs_ntsc_encode.bin
Binary files differ
diff --git a/bgfx/shaders/gles/fs_post.bin b/bgfx/shaders/gles/fs_post.bin
index 04cbd642e9c..737b66a600b 100644
--- a/bgfx/shaders/gles/fs_post.bin
+++ b/bgfx/shaders/gles/fs_post.bin
Binary files differ
diff --git a/bgfx/shaders/gles/vs_deconverge.bin b/bgfx/shaders/gles/vs_deconverge.bin
index 7f418b7ac9c..7454e88335b 100644
--- a/bgfx/shaders/gles/vs_deconverge.bin
+++ b/bgfx/shaders/gles/vs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_color.bin b/bgfx/shaders/glsl/fs_color.bin
index 6cf2162b523..fc0baf998d5 100644
--- a/bgfx/shaders/glsl/fs_color.bin
+++ b/bgfx/shaders/glsl/fs_color.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_deconverge.bin b/bgfx/shaders/glsl/fs_deconverge.bin
index 756c4da04af..7ccc3407545 100644
--- a/bgfx/shaders/glsl/fs_deconverge.bin
+++ b/bgfx/shaders/glsl/fs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_defocus.bin b/bgfx/shaders/glsl/fs_defocus.bin
index dd58019cf32..d56afae0f77 100644
--- a/bgfx/shaders/glsl/fs_defocus.bin
+++ b/bgfx/shaders/glsl/fs_defocus.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_distortion.bin b/bgfx/shaders/glsl/fs_distortion.bin
index a5abb519a56..9ec60e1a440 100644
--- a/bgfx/shaders/glsl/fs_distortion.bin
+++ b/bgfx/shaders/glsl/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_ntsc_decode.bin b/bgfx/shaders/glsl/fs_ntsc_decode.bin
index 877ddb808c5..768cfe694da 100644
--- a/bgfx/shaders/glsl/fs_ntsc_decode.bin
+++ b/bgfx/shaders/glsl/fs_ntsc_decode.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_ntsc_encode.bin b/bgfx/shaders/glsl/fs_ntsc_encode.bin
index 9d03f2897fe..2f316b21936 100644
--- a/bgfx/shaders/glsl/fs_ntsc_encode.bin
+++ b/bgfx/shaders/glsl/fs_ntsc_encode.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/fs_post.bin b/bgfx/shaders/glsl/fs_post.bin
index e5a745971d7..e8fde72d703 100644
--- a/bgfx/shaders/glsl/fs_post.bin
+++ b/bgfx/shaders/glsl/fs_post.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/vs_deconverge.bin b/bgfx/shaders/glsl/vs_deconverge.bin
index 305aae8f18f..5b332158522 100644
--- a/bgfx/shaders/glsl/vs_deconverge.bin
+++ b/bgfx/shaders/glsl/vs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_color.bin b/bgfx/shaders/metal/fs_color.bin
index f8009011b2d..41355632c6d 100644
--- a/bgfx/shaders/metal/fs_color.bin
+++ b/bgfx/shaders/metal/fs_color.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_deconverge.bin b/bgfx/shaders/metal/fs_deconverge.bin
index 296ba02f99f..60d2550f74d 100644
--- a/bgfx/shaders/metal/fs_deconverge.bin
+++ b/bgfx/shaders/metal/fs_deconverge.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_defocus.bin b/bgfx/shaders/metal/fs_defocus.bin
index 564475d1b22..76825e22010 100644
--- a/bgfx/shaders/metal/fs_defocus.bin
+++ b/bgfx/shaders/metal/fs_defocus.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_distortion.bin b/bgfx/shaders/metal/fs_distortion.bin
index 717075392c9..6c8b0562037 100644
--- a/bgfx/shaders/metal/fs_distortion.bin
+++ b/bgfx/shaders/metal/fs_distortion.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_ntsc_decode.bin b/bgfx/shaders/metal/fs_ntsc_decode.bin
index d3e0812ca51..a3ad6554fe6 100644
--- a/bgfx/shaders/metal/fs_ntsc_decode.bin
+++ b/bgfx/shaders/metal/fs_ntsc_decode.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_ntsc_encode.bin b/bgfx/shaders/metal/fs_ntsc_encode.bin
index 01459d63024..f961d2c9ab6 100644
--- a/bgfx/shaders/metal/fs_ntsc_encode.bin
+++ b/bgfx/shaders/metal/fs_ntsc_encode.bin
Binary files differ
diff --git a/bgfx/shaders/metal/fs_post.bin b/bgfx/shaders/metal/fs_post.bin
index 6f15dc13093..e0f1f4167ad 100644
--- a/bgfx/shaders/metal/fs_post.bin
+++ b/bgfx/shaders/metal/fs_post.bin
Binary files differ
diff --git a/bgfx/shaders/metal/vs_deconverge.bin b/bgfx/shaders/metal/vs_deconverge.bin
index e7cd9e2e1e9..d150d812cea 100644
--- a/bgfx/shaders/metal/vs_deconverge.bin
+++ b/bgfx/shaders/metal/vs_deconverge.bin
Binary files differ
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index 1e067fd262e..160e7dd8ceb 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -143,7 +143,9 @@ const options_entry osd_options::s_option_entries[] =
{ nullptr, nullptr, OPTION_HEADER, "BGFX POST-PROCESSING OPTIONS" },
{ OSDOPTION_BGFX_PATH, "bgfx", OPTION_STRING, "path to BGFX-related files" },
{ OSDOPTION_BGFX_SCREEN_CHAIN, "hlsl", OPTION_STRING, "screen chain JSON file to use" },
- { OSDOPTION_BGFX_SHADOW_MASK, "shadow-mask.png", OPTION_STRING, "shadow mask texture name" },
+ { OSDOPTION_BGFX_SHADOW_MASK, "shadow-mask.png", OPTION_STRING, "shadow mask texture name" },
+ { OSDOPTION_BGFX_PRESCALE_X, "1", OPTION_INTEGER, "x prescale" },
+ { OSDOPTION_BGFX_PRESCALE_Y, "1", OPTION_INTEGER, "y prescale" },
// End of list
{ nullptr }
diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h
index 1cfbe6dee72..78fc2620e64 100644
--- a/src/osd/modules/lib/osdobj_common.h
+++ b/src/osd/modules/lib/osdobj_common.h
@@ -78,8 +78,10 @@
#define OSDOPTVAL_NONE "none"
#define OSDOPTION_BGFX_PATH "bgfx_path"
-#define OSDOPTION_BGFX_SCREEN_CHAIN "screen_chain"
+#define OSDOPTION_BGFX_SCREEN_CHAIN "bgfx_screen_chain"
#define OSDOPTION_BGFX_SHADOW_MASK "bgfx_shadow_mask"
+#define OSDOPTION_BGFX_PRESCALE_X "bgfx_prescale_x"
+#define OSDOPTION_BGFX_PRESCALE_Y "bgfx_prescale_y"
//============================================================
// TYPE DEFINITIONS
@@ -153,6 +155,8 @@ public:
const char *bgfx_path() const { return value(OSDOPTION_BGFX_PATH); }
const char *bgfx_screen_chain() const { return value(OSDOPTION_BGFX_SCREEN_CHAIN); }
const char *bgfx_shadow_mask() const { return value(OSDOPTION_BGFX_SHADOW_MASK); }
+ const uint32_t bgfx_prescale_x() const { return int_value(OSDOPTION_BGFX_PRESCALE_X); }
+ const uint32_t bgfx_prescale_y() const { return int_value(OSDOPTION_BGFX_PRESCALE_Y); }
private:
static const options_entry s_option_entries[];
diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp
index 721ee9147aa..018c260f1fb 100644
--- a/src/osd/modules/render/bgfx/chain.cpp
+++ b/src/osd/modules/render/bgfx/chain.cpp
@@ -15,6 +15,7 @@
#include "entryuniform.h"
#include "texturemanager.h"
#include "vertex.h"
+#include "window.h"
#include "chain.h"
@@ -49,14 +50,24 @@ bgfx_chain::~bgfx_chain()
}
}
-void bgfx_chain::process(render_primitive* prim, int view, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint64_t blend)
+void bgfx_chain::process(render_primitive* prim, int view, texture_manager& textures, osd_window& window, uint64_t blend)
{
int current_view = view;
+ uint16_t screen_width = window.get_size().width();
+ uint16_t screen_height = window.get_size().height();
+ uint32_t rotation_type = (window.target()->orientation() & ROT90) == ROT90 ?
+ 1 : (window.target()->orientation() & ROT180) == ROT180 ?
+ 2 : (window.target()->orientation() & ROT270) == ROT270 ?
+ 3 : 0;
+ bool orientation_swap_xy = (window.machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
+ bool rotation_swap_xy = (window.target()->orientation() & ROT90) == ROT90 || (window.target()->orientation() & ROT270) == ROT270;
+ bool swap_xy = orientation_swap_xy ^ rotation_swap_xy;
+
for (bgfx_chain_entry* entry : m_entries)
{
if (!entry->skip())
{
- entry->submit(prim, current_view, textures, screen_width, screen_height, blend);
+ entry->submit(current_view, prim, textures, screen_width, screen_height, rotation_type, swap_xy, blend);
current_view++;
}
}
diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h
index 6eb4db71f4c..7ea1b1170a4 100644
--- a/src/osd/modules/render/bgfx/chain.h
+++ b/src/osd/modules/render/bgfx/chain.h
@@ -21,6 +21,7 @@ class render_primitive;
class bgfx_slider;
class bgfx_parameter;
class texture_manager;
+class osd_window;
class bgfx_chain
{
@@ -28,7 +29,7 @@ public:
bgfx_chain(std::string name, std::string author, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries, std::string output);
~bgfx_chain();
- void process(render_primitive* prim, int view, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint64_t blend = 0L);
+ void process(render_primitive* prim, int view, texture_manager& textures, osd_window &window, uint64_t blend = 0L);
// Getters
std::vector<bgfx_slider*>& sliders() { return m_sliders; }
diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp
index 8b36460ad0c..fdd56aac3ab 100644
--- a/src/osd/modules/render/bgfx/chainentry.cpp
+++ b/src/osd/modules/render/bgfx/chainentry.cpp
@@ -44,7 +44,7 @@ bgfx_chain_entry::~bgfx_chain_entry()
m_uniforms.clear();
}
-void bgfx_chain_entry::submit(render_primitive* prim, int view, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint64_t blend)
+void bgfx_chain_entry::submit(int view, render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, uint64_t blend)
{
bgfx::setViewSeq(view, true);
@@ -59,67 +59,85 @@ void bgfx_chain_entry::submit(render_primitive* prim, int view, texture_manager&
put_screen_buffer(prim, &buffer);
bgfx::setVertexBuffer(&buffer);
- bgfx_uniform* inv_screen_dims = m_effect->uniform("u_inv_screen_dims");
- bgfx_uniform* screen_dims = m_effect->uniform("u_screen_dims");
- if (screen_dims != nullptr || inv_screen_dims != nullptr)
+ setup_auto_uniforms(prim, textures, screen_width, screen_height, rotation_type, swap_xy);
+
+ for (bgfx_entry_uniform* uniform : m_uniforms)
{
- float values[2];
- float width = screen_width;
- float height = screen_height;
- if (m_inputs.size() > 0)
+ if (uniform->name() != "s_tex")
{
- width = float(textures.provider(m_inputs[0].texture())->width());
- height = float(textures.provider(m_inputs[0].texture())->height());
- }
-
- values[0] = 1.0f / width;
- values[1] = 1.0f / height;
- if (inv_screen_dims != nullptr) {
- inv_screen_dims->set(values, sizeof(float) * 2);
+ uniform->bind();
}
+ }
- values[0] = width;
- values[1] = height;
- if (screen_dims != nullptr) {
- screen_dims->set(values, sizeof(float) * 2);
- }
+ m_effect->submit(view, blend);
+
+ if (m_targets.target(m_output) != nullptr)
+ {
+ m_targets.target(m_output)->page_flip();
}
+}
+
+void bgfx_chain_entry::setup_screensize_uniforms(texture_manager& textures, uint16_t screen_width, uint16_t screen_height)
+{
+ float width = screen_width;
+ float height = screen_height;
+ if (m_inputs.size() > 0)
+ {
+ width = float(textures.provider(m_inputs[0].texture())->width());
+ height = float(textures.provider(m_inputs[0].texture())->height());
+ }
- bgfx_uniform* quad_dims = m_effect->uniform("u_quad_dims");
- if (quad_dims != nullptr)
+ bgfx_uniform* screen_dims = m_effect->uniform("u_screen_dims");
+ if (screen_dims != nullptr)
+ {
+ float values[2] = { width, height };
+ screen_dims->set(values, sizeof(float) * 2);
+ }
+
+ bgfx_uniform* inv_screen_dims = m_effect->uniform("u_inv_screen_dims");
+ if (inv_screen_dims != nullptr)
{
- float values[2];
- values[0] = prim->bounds.x1 - prim->bounds.x0;
- values[1] = prim->bounds.y1 - prim->bounds.y0;
- quad_dims->set(values, sizeof(float) * 2);
+ float values[2] = { 1.0f / width, 1.0f / height };
+ inv_screen_dims->set(values, sizeof(float) * 2);
}
+}
+void bgfx_chain_entry::setup_sourcesize_uniform(render_primitive* prim)
+{
bgfx_uniform* source_dims = m_effect->uniform("u_source_dims");
if (source_dims != nullptr)
{
- float values[2];
- values[0] = float(prim->texture.width);
- values[1] = float(prim->texture.height);
- if (source_dims != nullptr)
- {
- source_dims->set(values, sizeof(float) * 2);
- }
+ float values[2] = { float(prim->texture.width), float(prim->texture.height) };
+ source_dims->set(values, sizeof(float) * 2);
}
-
- for (bgfx_entry_uniform* uniform : m_uniforms)
- {
- if (uniform->name() != "DiffuseSampler")
- {
- uniform->bind();
- }
+}
+
+void bgfx_chain_entry::setup_rotationtype_uniform(uint32_t rotation_type)
+{
+ bgfx_uniform* rotation_type_uniform = m_effect->uniform("u_rotation_type");
+ if (rotation_type_uniform != nullptr)
+ {
+ float values[1] = { float(rotation_type) };
+ rotation_type_uniform->set(values, sizeof(float));
}
+}
- m_effect->submit(view, blend);
-
- if (m_targets.target(m_output) != nullptr)
- {
- m_targets.target(m_output)->page_flip();
- }
+void bgfx_chain_entry::setup_swapxy_uniform(bool swap_xy)
+{
+ bgfx_uniform* swap_xy_uniform = m_effect->uniform("u_swap_xy");
+ if (swap_xy_uniform != nullptr)
+ {
+ float values[1] = { swap_xy ? 1.0f : 0.0f };
+ swap_xy_uniform->set(values, sizeof(float));
+ }
+}
+
+void bgfx_chain_entry::setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy)
+{
+ setup_screensize_uniforms(textures, screen_width, screen_height);
+ setup_sourcesize_uniform(prim);
+ setup_rotationtype_uniform(rotation_type);
+ setup_swapxy_uniform(swap_xy);
}
void bgfx_chain_entry::setup_view(int view, uint16_t screen_width, uint16_t screen_height)
@@ -131,8 +149,8 @@ void bgfx_chain_entry::setup_view(int view, uint16_t screen_width, uint16_t scre
{
bgfx_target* output = m_targets.target(m_output);
handle = output->target();
- width = output->width();
- height = output->height();
+ width = output->width() * output->prescale_x();
+ height = output->height() * output->prescale_y();
}
bgfx::setViewFrameBuffer(view, handle);
diff --git a/src/osd/modules/render/bgfx/chainentry.h b/src/osd/modules/render/bgfx/chainentry.h
index d6e7edeaf09..5467f90ab5b 100644
--- a/src/osd/modules/render/bgfx/chainentry.h
+++ b/src/osd/modules/render/bgfx/chainentry.h
@@ -36,7 +36,7 @@ public:
bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output);
~bgfx_chain_entry();
- void submit(render_primitive* prim, int view, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint64_t blend);
+ void submit(int view, render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, uint64_t blend);
// Getters
std::string name() const { return m_name; }
@@ -44,6 +44,12 @@ public:
bool skip();
private:
+ void setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy);
+ void setup_screensize_uniforms(texture_manager& textures, uint16_t screen_width, uint16_t screen_height);
+ void setup_sourcesize_uniform(render_primitive* prim);
+ void setup_rotationtype_uniform(uint32_t rotation_type);
+ void setup_swapxy_uniform(bool swap_xy);
+
void setup_view(int view, uint16_t screen_width, uint16_t screen_height);
void put_screen_buffer(render_primitive* prim, bgfx::TransientVertexBuffer* buffer);
diff --git a/src/osd/modules/render/bgfx/chainentryreader.cpp b/src/osd/modules/render/bgfx/chainentryreader.cpp
index 0bf27e342cc..5c6d73e2ce9 100644
--- a/src/osd/modules/render/bgfx/chainentryreader.cpp
+++ b/src/osd/modules/render/bgfx/chainentryreader.cpp
@@ -10,6 +10,7 @@
#include "emu.h"
#include "rendutil.h"
+#include <modules/render/copyutil.h>
#include <modules/lib/osdobj_common.h>
@@ -73,11 +74,10 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, osd_op
const Value& texture_array = value["textures"];
for (UINT32 i = 0; i < texture_array.Size(); i++)
{
- char texture_name[2048];
- bitmap_argb32 bitmap;
- emu_file file(options.bgfx_shadow_mask(), OPEN_FLAG_READ);
- strcpy(texture_name, options.bgfx_shadow_mask());
- render_load_png(bitmap, file, nullptr, texture_name);
+ std::string texture_path = std::string(options.bgfx_path()) + "/artwork/";
+ std::string texture_name = texture_array[i].GetString();
+
+ textures.create_png_texture(texture_path, texture_name, texture_name);
}
}
diff --git a/src/osd/modules/render/bgfx/chainreader.cpp b/src/osd/modules/render/bgfx/chainreader.cpp
index 5addfc6fffa..68ba24183e3 100644
--- a/src/osd/modules/render/bgfx/chainreader.cpp
+++ b/src/osd/modules/render/bgfx/chainreader.cpp
@@ -11,6 +11,7 @@
#include <map>
#include "emu.h"
+#include <modules/lib/osdobj_common.h>
#include "chain.h"
#include "sliderreader.h"
@@ -87,12 +88,8 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, osd_options& optio
uint32_t mode = uint32_t(get_enum_from_value(target_array[i], "mode", TARGET_STYLE_NATIVE, STYLE_NAMES, STYLE_COUNT));
bool bilinear = get_bool(target_array[i], "bilinear", true);
bool double_buffer = get_bool(target_array[i], "doublebuffer", true);
-
- float prescalef = 1.0f;
- float default_prescale = 1.0f;
- get_float(target_array[i], "prescale", &prescalef, &default_prescale);
- int prescale = (int)floor(prescalef + 0.5f);
-
+ bool prescale = get_bool(target_array[i], "prescale", false);
+
uint16_t width = 0;
uint16_t height = 0;
switch (mode)
@@ -115,10 +112,14 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, osd_options& optio
break;
}
- width *= prescale;
- height *= prescale;
-
- targets.create_target(target_array[i]["name"].GetString(), bgfx::TextureFormat::RGBA8, width, height, mode, double_buffer, bilinear);
+ uint32_t prescale_x = 1;
+ uint32_t prescale_y = 1;
+ if (prescale)
+ {
+ prescale_x = options.bgfx_prescale_x();
+ prescale_y = options.bgfx_prescale_y();
+ }
+ targets.create_target(target_array[i]["name"].GetString(), bgfx::TextureFormat::RGBA8, width, height, prescale_x, prescale_y, mode, double_buffer, bilinear);
}
}
diff --git a/src/osd/modules/render/bgfx/fs_blit.sc b/src/osd/modules/render/bgfx/fs_blit.sc
index 5130d1bebb5..ff6befc4272 100644
--- a/src/osd/modules/render/bgfx/fs_blit.sc
+++ b/src/osd/modules/render/bgfx/fs_blit.sc
@@ -5,6 +5,7 @@ $input v_color0, v_texcoord0
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// Samplers
SAMPLER2D(s_tex, 0);
void main()
diff --git a/src/osd/modules/render/bgfx/fs_color.sc b/src/osd/modules/render/bgfx/fs_color.sc
index a90b380a8a9..fae98f2a39f 100644
--- a/src/osd/modules/render/bgfx/fs_color.sc
+++ b/src/osd/modules/render/bgfx/fs_color.sc
@@ -6,10 +6,9 @@ $input v_color0, v_texcoord0
// Color Convolution Effect
//-----------------------------------------------------------------------------
-// NB: intentionally wasteful of uniforms in order for easier slider utilization
-
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// User-supplied
uniform vec4 u_red_ratios;
uniform vec4 u_grn_ratios;
uniform vec4 u_blu_ratios;
@@ -17,34 +16,28 @@ uniform vec4 u_offset;
uniform vec4 u_scale;
uniform vec4 u_saturation;
-#define RedRatios u_red_ratios.xyz
-#define GrnRatios u_grn_ratios.xyz
-#define BluRatios u_blu_ratios.xyz
-#define Offset u_offset.xyz
-#define Scale u_scale.xyz
-#define Saturation u_saturation.x
-
-SAMPLER2D(DiffuseSampler, 0);
+// Samplers
+SAMPLER2D(s_tex, 0);
void main()
{
- vec4 BaseTexel = texture2D(DiffuseSampler, v_texcoord0);
+ vec4 BaseTexel = texture2D(s_tex, v_texcoord0);
vec3 OutRGB = BaseTexel.rgb;
// RGB Tint & Shift
- float ShiftedRed = dot(OutRGB, RedRatios);
- float ShiftedGrn = dot(OutRGB, GrnRatios);
- float ShiftedBlu = dot(OutRGB, BluRatios);
+ float ShiftedRed = dot(OutRGB, u_red_ratios.xyz);
+ float ShiftedGrn = dot(OutRGB, u_grn_ratios.xyz);
+ float ShiftedBlu = dot(OutRGB, u_blu_ratios.xyz);
// RGB Scale & Offset
- vec3 OutTexel = vec3(ShiftedRed, ShiftedGrn, ShiftedBlu) * Scale + Offset;
+ vec3 OutTexel = vec3(ShiftedRed, ShiftedGrn, ShiftedBlu) * u_scale.xyz + u_offset.xyz;
// Saturation
vec3 Grayscale = vec3(0.299, 0.587, 0.114);
float OutLuma = dot(OutTexel, Grayscale);
vec3 OutChroma = OutTexel - OutLuma;
- vec3 Saturated = OutLuma + OutChroma * Saturation;
+ vec3 Saturated = OutLuma + OutChroma * u_saturation.x;
gl_FragColor = vec4(Saturated, BaseTexel.a);
}
diff --git a/src/osd/modules/render/bgfx/fs_deconverge.sc b/src/osd/modules/render/bgfx/fs_deconverge.sc
index 343896cec2c..409896ce40a 100644
--- a/src/osd/modules/render/bgfx/fs_deconverge.sc
+++ b/src/osd/modules/render/bgfx/fs_deconverge.sc
@@ -6,16 +6,15 @@ $input v_color0, v_texcoord0, v_texcoord1, v_texcoord2
// Deconvergence Effect
//-----------------------------------------------------------------------------
-// NB: intentionally wasteful of uniforms in order for easier slider utilization
-
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-SAMPLER2D(DiffuseSampler, 0);
+// Samplers
+SAMPLER2D(s_tex, 0);
void main()
{
- float r = texture2D(DiffuseSampler, v_texcoord0).r;
- float g = texture2D(DiffuseSampler, v_texcoord1).g;
- float b = texture2D(DiffuseSampler, v_texcoord2).b;
+ float r = texture2D(s_tex, v_texcoord0).r;
+ float g = texture2D(s_tex, v_texcoord1).g;
+ float b = texture2D(s_tex, v_texcoord2).b;
gl_FragColor = vec4(r, g, b, 1.0) * v_color0;
}
diff --git a/src/osd/modules/render/bgfx/fs_defocus.sc b/src/osd/modules/render/bgfx/fs_defocus.sc
index acd0a715557..03c442e4780 100644
--- a/src/osd/modules/render/bgfx/fs_defocus.sc
+++ b/src/osd/modules/render/bgfx/fs_defocus.sc
@@ -8,14 +8,14 @@ $input v_color0, v_texcoord0
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-uniform vec4 u_screenrect;
+// Autos
+uniform vec4 u_screen_dims;
+// User-supplied
uniform vec4 u_defocus;
-uniform vec4 u_swap_xy;
-uniform vec4 u_screen_dims;
-
-SAMPLER2D(DiffuseSampler, 0);
+// Samplers
+SAMPLER2D(s_tex, 0);
//-----------------------------------------------------------------------------
// Constants
@@ -32,19 +32,17 @@ void main()
const vec2 Coord7Offset = vec2( 0.50, -0.75);
const vec2 Coord8Offset = vec2( 1.00, -0.25);
- vec2 QuadRatio = vec2(1.0, (u_swap_xy.x > 0.0) ? u_screen_dims.y / u_screen_dims.x : u_screen_dims.x / u_screen_dims.y);
-
vec2 DefocusTexelDims = u_defocus.xy / u_screen_dims.xy;
- vec4 d0 = texture2D(DiffuseSampler, v_texcoord0);
- vec4 d1 = texture2D(DiffuseSampler, v_texcoord0 + Coord1Offset * DefocusTexelDims);
- vec4 d2 = texture2D(DiffuseSampler, v_texcoord0 + Coord2Offset * DefocusTexelDims);
- vec4 d3 = texture2D(DiffuseSampler, v_texcoord0 + Coord3Offset * DefocusTexelDims);
- vec4 d4 = texture2D(DiffuseSampler, v_texcoord0 + Coord4Offset * DefocusTexelDims);
- vec4 d5 = texture2D(DiffuseSampler, v_texcoord0 + Coord5Offset * DefocusTexelDims);
- vec4 d6 = texture2D(DiffuseSampler, v_texcoord0 + Coord6Offset * DefocusTexelDims);
- vec4 d7 = texture2D(DiffuseSampler, v_texcoord0 + Coord7Offset * DefocusTexelDims);
- vec4 d8 = texture2D(DiffuseSampler, v_texcoord0 + Coord8Offset * DefocusTexelDims);
+ vec4 d0 = texture2D(s_tex, v_texcoord0);
+ vec4 d1 = texture2D(s_tex, v_texcoord0 + Coord1Offset * DefocusTexelDims);
+ vec4 d2 = texture2D(s_tex, v_texcoord0 + Coord2Offset * DefocusTexelDims);
+ vec4 d3 = texture2D(s_tex, v_texcoord0 + Coord3Offset * DefocusTexelDims);
+ vec4 d4 = texture2D(s_tex, v_texcoord0 + Coord4Offset * DefocusTexelDims);
+ vec4 d5 = texture2D(s_tex, v_texcoord0 + Coord5Offset * DefocusTexelDims);
+ vec4 d6 = texture2D(s_tex, v_texcoord0 + Coord6Offset * DefocusTexelDims);
+ vec4 d7 = texture2D(s_tex, v_texcoord0 + Coord7Offset * DefocusTexelDims);
+ vec4 d8 = texture2D(s_tex, v_texcoord0 + Coord8Offset * DefocusTexelDims);
vec4 blurred = (d0 + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8) / 9.0;
diff --git a/src/osd/modules/render/bgfx/fs_distortion.sc b/src/osd/modules/render/bgfx/fs_distortion.sc
index 3875c785e8d..a80286cfb1a 100644
--- a/src/osd/modules/render/bgfx/fs_distortion.sc
+++ b/src/osd/modules/render/bgfx/fs_distortion.sc
@@ -3,44 +3,26 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz,ImJezze
//-----------------------------------------------------------------------------
-// Defocus Effect
+// Distortion Effect
//-----------------------------------------------------------------------------
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-SAMPLER2D(DiffuseSampler, 0);
-
-//-----------------------------------------------------------------------------
-// Uniforms
-//-----------------------------------------------------------------------------
-
+// Autos
uniform vec4 u_screen_dims;
+uniform vec4 u_rotation_type;
+// User-supplied
uniform vec4 u_curvature;
uniform vec4 u_round_corner;
uniform vec4 u_smooth_border;
uniform vec4 u_vignetting;
uniform vec4 u_reflection;
-uniform vec4 u_rotation_type; // TODO
+// Samplers
+SAMPLER2D(s_tex, 0);
-#define CurvatureAmount u_curvature.x
-#define RoundCornerAmount u_round_corner.x
-#define SmoothBorderAmount u_smooth_border.x
-#define VignettingAmount u_vignetting.x
-#define ReflectionAmount u_reflection.x
-
-#define RotationType u_rotation_type.x // TODO
-
-//-----------------------------------------------------------------------------
// Functions
-//-----------------------------------------------------------------------------
-
-// Holy fuck the number of functions...
// www.stackoverflow.com/questions/5149544/can-i-generate-a-random-number-inside-a-pixel-shader/
float rand(vec2 seed)
@@ -103,11 +85,11 @@ float GetSpotAddend(vec2 coord, float amount)
// normalized screen quad ratio
// upper right quadrant
vec2 spotOffset = vec2(-0.25, 0.25); // 0 degrees
- if (RotationType == 1.0)
+ if (u_rotation_type.x == 1.0)
spotOffset = vec2(-0.25, -0.25); // 90 degrees
- if (RotationType == 2.0)
+ if (u_rotation_type.x == 2.0)
spotOffset = vec2(0.25, -0.25); // 180 degrees
- if (RotationType == 3.0)
+ if (u_rotation_type.x == 3.0)
spotOffset = vec2(0.25, 0.25); // 270 degrees
vec2 SpotCoord = (coord + spotOffset * RatioCorrection) / RatioCorrection;
@@ -193,20 +175,18 @@ vec2 GetCoords(vec2 coord, float distortionAmount)
return coord;
}
-//-----------------------------------------------------------------------------
-// Distortion Pixel Shader
-//-----------------------------------------------------------------------------
+// Shader
void main()
{
// Screen Curvature
- vec2 BaseCoord = GetCoords(v_texcoord0, CurvatureAmount * 0.25); // reduced amount
+ vec2 BaseCoord = GetCoords(v_texcoord0, u_curvature.x * 0.25); // reduced amount
vec2 BaseCoordCentered = BaseCoord;
BaseCoordCentered -= 0.5;
// Color
- vec4 BaseColor = texture2D(DiffuseSampler, BaseCoord);
+ vec4 BaseColor = texture2D(s_tex, BaseCoord);
BaseColor.a = 1.0;
// Clamp
@@ -216,7 +196,7 @@ void main()
// Vignetting Simulation
vec2 VignetteCoord = BaseCoordCentered;
- float VignetteFactor = GetVignetteFactor(VignetteCoord, VignettingAmount);
+ float VignetteFactor = GetVignetteFactor(VignetteCoord, u_vignetting.x);
BaseColor.rgb *= VignetteFactor;
// Light Reflection Simulation
@@ -225,14 +205,14 @@ void main()
vec2 SpotCoord = BaseCoordCentered;
vec2 NoiseCoord = BaseCoordCentered;
- float SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount);
+ float SpotAddend = GetSpotAddend(SpotCoord, u_reflection.x);
float NoiseFactor = GetNoiseFactor(SpotAddend, rand(NoiseCoord));
BaseColor.rgb += SpotAddend * NoiseFactor * LightColor;
// Round Corners Simulation
vec2 RoundCornerCoord = BaseCoordCentered;
- float roundCornerFactor = GetRoundCornerFactor(RoundCornerCoord, RoundCornerAmount, SmoothBorderAmount);
+ float roundCornerFactor = GetRoundCornerFactor(RoundCornerCoord, u_round_corner.x, u_smooth_border.x);
BaseColor.rgb *= roundCornerFactor;
gl_FragColor = BaseColor;
diff --git a/src/osd/modules/render/bgfx/fs_gui.sc b/src/osd/modules/render/bgfx/fs_gui.sc
index 28a1438d189..9f539c1182a 100644
--- a/src/osd/modules/render/bgfx/fs_gui.sc
+++ b/src/osd/modules/render/bgfx/fs_gui.sc
@@ -5,10 +5,10 @@ $input v_color0, v_texcoord0
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// Samplers
SAMPLER2D(s_tex, 0);
void main()
{
- vec4 texel = texture2D(s_tex, v_texcoord0);
- gl_FragColor = texel * v_color0;
+ gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0;
}
diff --git a/src/osd/modules/render/bgfx/fs_ntsc_decode.sc b/src/osd/modules/render/bgfx/fs_ntsc_decode.sc
index 41807a1cf6f..1f5c9305053 100644
--- a/src/osd/modules/render/bgfx/fs_ntsc_decode.sc
+++ b/src/osd/modules/render/bgfx/fs_ntsc_decode.sc
@@ -6,10 +6,12 @@ $input v_color0, v_texcoord0
// NTSC Decode Effect
//-----------------------------------------------------------------------------
-// NB: intentionally wasteful of uniforms in order for easier slider utilization
-
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// Autos
+uniform vec4 u_source_dims;
+
+// User-supplied
uniform vec4 u_a_value;
uniform vec4 u_b_value;
uniform vec4 u_cc_value;
@@ -19,12 +21,13 @@ uniform vec4 u_notch_width;
uniform vec4 u_y_freq_response;
uniform vec4 u_i_freq_response;
uniform vec4 u_q_freq_response;
-uniform vec4 u_jitter_amount;
uniform vec4 u_jitter_offset;
-uniform vec4 u_source_dims;
+// Parametric
+uniform vec4 u_jitter_amount;
-SAMPLER2D(DiffuseSampler, 0);
+// Samplers
+SAMPLER2D(s_tex, 0);
//-----------------------------------------------------------------------------
// Constants
@@ -32,7 +35,7 @@ SAMPLER2D(DiffuseSampler, 0);
void main()
{
- vec4 BaseTexel = texture2D(DiffuseSampler, v_texcoord0.xy);
+ vec4 BaseTexel = texture2D(s_tex, v_texcoord0.xy);
vec4 zero = vec4(0.0, 0.0, 0.0, 0.0);
vec4 quarter = vec4(0.25, 0.25, 0.25, 0.25);
@@ -71,7 +74,7 @@ void main()
vec4 Cx = v_texcoord0.xxxx + u_source_dims.xxxx * (n4 * quarter);
// theory: What if we put white in the input of the NTSC decode shader?
- vec4 C = texture2D(DiffuseSampler, vec2(Cx.x, v_texcoord0.y));
+ vec4 C = texture2D(s_tex, vec2(Cx.x, v_texcoord0.y));
vec4 T = Cx + HOffset + v_texcoord0.yyyy * VScale;
vec4 WT = W * T + u_o_value.xxxx;
diff --git a/src/osd/modules/render/bgfx/fs_ntsc_encode.sc b/src/osd/modules/render/bgfx/fs_ntsc_encode.sc
index 52246d270dd..61f5ae12ac9 100644
--- a/src/osd/modules/render/bgfx/fs_ntsc_encode.sc
+++ b/src/osd/modules/render/bgfx/fs_ntsc_encode.sc
@@ -10,17 +10,22 @@ $input v_color0, v_texcoord0
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// Autos
+uniform vec4 u_source_dims;
+
+// User-supplied
uniform vec4 u_a_value;
uniform vec4 u_b_value;
uniform vec4 u_cc_value;
uniform vec4 u_p_value;
uniform vec4 u_scan_time;
-uniform vec4 u_jitter_amount;
uniform vec4 u_jitter_offset;
-uniform vec4 u_source_dims;
+// Parametric
+uniform vec4 u_jitter_amount;
-SAMPLER2D(DiffuseSampler, 0);
+// Samplers
+SAMPLER2D(s_tex, 0);
//-----------------------------------------------------------------------------
// Constants
@@ -36,10 +41,10 @@ void main()
vec2 C3 = v_texcoord0 + PValueSourceTexel * vec2(0.75, 0.0);
vec4 Cx = vec4(C0.x, C1.x, C2.x, C3.x);
vec4 Cy = vec4(C0.y, C1.y, C2.y, C3.y);
- vec4 Texel0 = texture2D(DiffuseSampler, C0);
- vec4 Texel1 = texture2D(DiffuseSampler, C1);
- vec4 Texel2 = texture2D(DiffuseSampler, C2);
- vec4 Texel3 = texture2D(DiffuseSampler, C3);
+ vec4 Texel0 = texture2D(s_tex, C0);
+ vec4 Texel1 = texture2D(s_tex, C1);
+ vec4 Texel2 = texture2D(s_tex, C2);
+ vec4 Texel3 = texture2D(s_tex, C3);
vec4 HPosition = Cx;
vec4 VPosition = Cy;
diff --git a/src/osd/modules/render/bgfx/fs_phosphor.sc b/src/osd/modules/render/bgfx/fs_phosphor.sc
index 90c69746822..e5ac1d91f35 100644
--- a/src/osd/modules/render/bgfx/fs_phosphor.sc
+++ b/src/osd/modules/render/bgfx/fs_phosphor.sc
@@ -5,9 +5,11 @@ $input v_color0, v_texcoord0
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// User-supplied
uniform vec4 u_passthrough;
uniform vec4 u_phosphor;
+// Samplers
SAMPLER2D(s_tex, 0);
SAMPLER2D(s_prev, 1);
diff --git a/src/osd/modules/render/bgfx/fs_post.sc b/src/osd/modules/render/bgfx/fs_post.sc
index 0072ecfc525..bfe8eef42e4 100644
--- a/src/osd/modules/render/bgfx/fs_post.sc
+++ b/src/osd/modules/render/bgfx/fs_post.sc
@@ -8,45 +8,39 @@ $input v_color0, v_texcoord0, v_texcoord1
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// 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_screen_scale; // TODO: Hook up ScreenScale code-side
+uniform vec4 u_screen_offset; // TODO: Hook up ScreenOffset code-side
-uniform vec4 u_inv_screen_dims; // size of the window or fullscreen
-uniform vec4 u_source_dims; // size of the source texture
-
-uniform vec4 u_shadow_dims; // size of the shadow texture (extended to power-of-two size - not necessarily in bgfx)
-uniform vec4 u_shadow_uv_offset;
-
+// User-supplied
uniform vec4 u_prepare_bloom; // disables some effects for rendering bloom textures
uniform vec4 u_prepare_vector;
-
-uniform vec4 u_humbar_hertz_rate; // 60.0f / 59.94f - 1.0f; // difference between the 59.94 Hz field rate and 60 Hz line frequency (NTSC)
-uniform vec4 u_humbar_alpha; // 0.0f;
-
-uniform vec4 u_time; // 0.0f;
-
-uniform vec4 u_screen_scale; // TODO: ScreenScale
-uniform vec4 u_screen_offset; // TODO: ScreenOffset
-
uniform vec4 u_scanline_alpha;
uniform vec4 u_scanline_scale;
uniform vec4 u_scanline_bright_scale;
uniform vec4 u_scanline_bright_offset;
uniform vec4 u_scanline_jitter;
-uniform vec4 u_jitter_amount;
uniform vec4 u_scanline_height;
-
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_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)
+uniform vec4 u_humbar_alpha;
+uniform vec4 u_power;
+uniform vec4 u_floor;
-uniform vec4 u_shadow_tile_mode; // ShadowTileMode = 0; // 0 based on screen dimension, 1 based on source dimension
-uniform vec4 u_shadow_alpha; // ShadowAlpha = 0.0f;
-uniform vec4 u_shadow_count; // ShadowCount = float2(6.0f, 6.0f);
-uniform vec4 u_shadow_uv; // ShadowUV = float2(0.25f, 0.25f);
-
-uniform vec4 u_power; // Power = float3(1.0f, 1.0f, 1.0f);
-uniform vec4 u_floor; // Floor = float3(0.0f, 0.0f, 0.0f);
+// Parametric
+uniform vec4 u_time;
+uniform vec4 u_jitter_amount;
-SAMPLER2D(DiffuseSampler, 0);
-SAMPLER2D(ShadowSampler, 1);
+// Samplers
+SAMPLER2D(s_tex, 0);
+SAMPLER2D(s_shadow, 1);
//-----------------------------------------------------------------------------
// Scanline & Shadowmask Pixel Shader
@@ -71,17 +65,17 @@ vec2 GetAdjustedCoords(vec2 coord, vec2 center_offset)
void main()
{
- vec2 ScreenTexelDims = u_inv_screen_dims.xy;
+ vec2 ScreenTexelDims = vec2(1.0, 1.0) / u_screen_dims.xy;
vec2 SourceTexelDims = vec2(1.0, 1.0) / u_source_dims.xy;
vec2 SourceRes = u_source_dims.xy;
vec2 HalfSourceRect = vec2(0.5, 0.5);
- vec2 ScreenCoord = v_texcoord1 / u_inv_screen_dims.xy;
+ vec2 ScreenCoord = v_texcoord0.xy;
vec2 BaseCoord = GetAdjustedCoords(v_texcoord0, HalfSourceRect);
// Color
- vec4 BaseColor = texture2D(DiffuseSampler, BaseCoord);
+ vec4 BaseColor = texture2D(s_tex, BaseCoord);
BaseColor.a = 1.0;
if (BaseCoord.x < 0.0 || BaseCoord.y < 0.0)
@@ -92,18 +86,16 @@ void main()
// Mask Simulation (may not affect bloom)
if (u_prepare_bloom.x == 0.0 && u_shadow_alpha.x > 0.0)
{
- vec2 shadowDims = u_swap_xy.x > 0.0 ? u_shadow_dims.yx : u_shadow_dims.xy;
- vec2 screenCoord = u_shadow_tile_mode.x == 0.0 ? ScreenCoord : BaseCoord;
+ vec2 screenCoord = ScreenCoord;
screenCoord = u_swap_xy.x > 0.0 ? screenCoord.yx : screenCoord.xy;
- vec2 shadowCount = u_swap_xy.x > 0.0 ? u_shadow_count.yx : u_shadow_count.xy;
- vec2 shadowTile = ((u_shadow_tile_mode.x == 0.0 ? ScreenTexelDims : SourceTexelDims) * shadowCount);
+ 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 ShadowFrac = fract(screenCoord * shadowTile);
vec2 ShadowCoord = (ShadowFrac * u_shadow_uv.xy);
- vec4 ShadowColor = texture2D(ShadowSampler, ShadowCoord);
+ 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;
diff --git a/src/osd/modules/render/bgfx/fs_ratios.sc b/src/osd/modules/render/bgfx/fs_ratios.sc
deleted file mode 100644
index c45050d4a4f..00000000000
--- a/src/osd/modules/render/bgfx/fs_ratios.sc
+++ /dev/null
@@ -1,23 +0,0 @@
-$input v_color0, v_texcoord0
-
-// license:BSD-3-Clause
-// copyright-holders:Dario Manesku
-
-#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-
-uniform vec4 u_ratio_amount;
-uniform vec4 u_red_ratios;
-uniform vec4 u_grn_ratios;
-uniform vec4 u_blu_ratios;
-
-SAMPLER2D(s_tex, 0);
-
-void main()
-{
- vec4 texel = texture2D(s_tex, v_texcoord0);
- float red = dot(texel.rgb, u_red_ratios.rgb);
- float grn = dot(texel.rgb, u_grn_ratios.rgb);
- float blu = dot(texel.rgb, u_blu_ratios.rgb);
- vec3 mixed = mix(texel.rgb, vec3(red, grn, blu), u_ratio_amount.x);
- gl_FragColor = vec4(mixed, texel.a) * v_color0;
-}
diff --git a/src/osd/modules/render/bgfx/fs_screen.sc b/src/osd/modules/render/bgfx/fs_screen.sc
index 0d3539f2be8..cecf14b4730 100644
--- a/src/osd/modules/render/bgfx/fs_screen.sc
+++ b/src/osd/modules/render/bgfx/fs_screen.sc
@@ -5,6 +5,7 @@ $input v_color0, v_texcoord0
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
+// Samplers
SAMPLER2D(s_tex, 0);
void main()
diff --git a/src/osd/modules/render/bgfx/fs_tint.sc b/src/osd/modules/render/bgfx/fs_tint.sc
deleted file mode 100644
index 7bb433f9743..00000000000
--- a/src/osd/modules/render/bgfx/fs_tint.sc
+++ /dev/null
@@ -1,17 +0,0 @@
-$input v_color0, v_texcoord0
-
-// license:BSD-3-Clause
-// copyright-holders:Dario Manesku
-
-#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-
-uniform vec4 u_tint;
-uniform vec4 u_shift;
-
-SAMPLER2D(s_tex, 0);
-uniform vec4 u_texsize;
-
-void main()
-{
- gl_FragColor = texture2D(s_tex, v_texcoord0.xy + u_shift.xy * u_texsize.xy) * u_tint * v_color0 + vec4(0.0, 0.0, 0.0, 1.0);
-}
diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp
index 38845a67ea5..788daf5f109 100644
--- a/src/osd/modules/render/bgfx/inputpair.cpp
+++ b/src/osd/modules/render/bgfx/inputpair.cpp
@@ -9,6 +9,8 @@
//
//============================================================
+#include "emu.h"
+
#include "inputpair.h"
#include "texture.h"
#include "target.h"
@@ -25,5 +27,6 @@ bgfx_input_pair::bgfx_input_pair(int index, std::string sampler, std::string tex
void bgfx_input_pair::bind(bgfx_effect *effect, texture_manager& textures) const
{
+ assert(effect->uniform(m_sampler) != nullptr);
bgfx::setTexture(m_index, effect->uniform(m_sampler)->handle(), textures.handle(m_texture));
}
diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp
index e9262c82a9f..355b0c2a30a 100644
--- a/src/osd/modules/render/bgfx/slider.cpp
+++ b/src/osd/modules/render/bgfx/slider.cpp
@@ -27,8 +27,7 @@ bgfx_slider::bgfx_slider(running_machine &machine, std::string name, int32_t min
m_value = def;
if (m_type != slider_type::SLIDER_INT && m_type != slider_type::SLIDER_INT_ENUM)
{
- float temp = float(def) * scale;
- m_value = *reinterpret_cast<int32_t*>(&temp);
+ m_value = float(def) * scale;
}
for (std::string string : strings)
@@ -75,30 +74,28 @@ int32_t bgfx_slider::update(std::string *str, int32_t newval)
{
case SLIDER_INT_ENUM:
{
- INT32 *val_ptr = reinterpret_cast<INT32 *>(&m_value);
if (newval != SLIDER_NOCHANGE)
{
- *val_ptr = newval;
+ m_value = float(newval);
}
if (str != nullptr)
{
- *str = string_format(m_format, m_strings[*val_ptr]);
+ *str = string_format(m_format, m_strings[as_int()]);
}
- return *val_ptr;
+ return as_int();
}
case SLIDER_INT:
{
- int *val_ptr = reinterpret_cast<int *>(&m_value);
if (newval != SLIDER_NOCHANGE)
{
- *val_ptr = newval;
+ m_value = float(newval);
}
if (str != nullptr)
{
- *str = string_format(m_format, *val_ptr);
+ *str = string_format(m_format, as_int());
}
- return *val_ptr;
+ return as_int();
}
default:
diff --git a/src/osd/modules/render/bgfx/slider.h b/src/osd/modules/render/bgfx/slider.h
index 62929bd5fe1..5ba8427a54d 100644
--- a/src/osd/modules/render/bgfx/slider.h
+++ b/src/osd/modules/render/bgfx/slider.h
@@ -51,8 +51,8 @@ public:
// Getters
std::string name() const { return m_name; }
slider_type type() const { return m_type; }
- int32_t value() const { return m_value; }
- float uniform_value() const { return *(reinterpret_cast<const float*>(&m_value)); }
+ float value() const { return m_value; }
+ float uniform_value() const { return float(m_value); }
slider_state* core_slider() const { return m_slider_state; }
size_t size() const { return get_size_for_type(m_type); }
@@ -60,6 +60,7 @@ public:
protected:
slider_state* create_core_slider(running_machine &machine);
+ int32_t as_int() const { return int32_t(floor(m_value + 0.5f)); }
std::string m_name;
int32_t m_min;
@@ -72,7 +73,7 @@ protected:
std::string m_format;
std::string m_description;
std::vector<std::string> m_strings;
- int32_t m_value;
+ float m_value;
slider_state* m_slider_state;
};
diff --git a/src/osd/modules/render/bgfx/suppressor.cpp b/src/osd/modules/render/bgfx/suppressor.cpp
index d29e289ff2a..b01e0f94d04 100644
--- a/src/osd/modules/render/bgfx/suppressor.cpp
+++ b/src/osd/modules/render/bgfx/suppressor.cpp
@@ -39,7 +39,7 @@ bool bgfx_suppressor::suppress()
count = 3;
}
- int32_t current_values[3];
+ float current_values[3];
for (int32_t index = 0; index < count; index++)
{
current_values[index] = m_sliders[index]->value();
diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp
index 9fc05625b33..a71074f44d0 100644
--- a/src/osd/modules/render/bgfx/target.cpp
+++ b/src/osd/modules/render/bgfx/target.cpp
@@ -8,14 +8,16 @@
#include "target.h"
-bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t style, bool double_buffer, bool filter)
+bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t prescale_x, uint32_t prescale_y, uint32_t style, bool double_buffer, bool filter)
: m_name(name)
, m_format(format)
, m_targets(nullptr)
, m_textures(nullptr)
, m_width(width)
, m_height(height)
- , m_double_buffer(double_buffer)
+ , m_prescale_x(prescale_x)
+ , m_prescale_y(prescale_y)
+ , m_double_buffer(double_buffer)
, m_style(style)
, m_filter(filter)
, m_current_page(0)
@@ -28,7 +30,7 @@ bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uin
m_targets = new bgfx::FrameBufferHandle[m_page_count];
for (int page = 0; page < m_page_count; page++)
{
- m_textures[page] = bgfx::createTexture2D(width, height, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT);
+ m_textures[page] = bgfx::createTexture2D(width * prescale_x, height * prescale_y, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT);
m_targets[page] = bgfx::createFrameBuffer(1, &m_textures[page], false);
}
}
@@ -40,7 +42,9 @@ bgfx_target::bgfx_target(void *handle, uint16_t width, uint16_t height)
, m_textures(nullptr)
, m_width(width)
, m_height(height)
- , m_double_buffer(false)
+ , m_prescale_x(1)
+ , m_prescale_y(1)
+ , m_double_buffer(false)
, m_style(TARGET_STYLE_CUSTOM)
, m_filter(false)
, m_current_page(0)
diff --git a/src/osd/modules/render/bgfx/target.h b/src/osd/modules/render/bgfx/target.h
index a39f726c451..9900fc77f8e 100644
--- a/src/osd/modules/render/bgfx/target.h
+++ b/src/osd/modules/render/bgfx/target.h
@@ -27,7 +27,7 @@ enum
class bgfx_target : public bgfx_texture_handle_provider
{
public:
- bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t style, bool double_buffer, bool filter);
+ bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t prescale_x, uint32_t prescale_y, uint32_t style, bool double_buffer, bool filter);
bgfx_target(void *handle, uint16_t width, uint16_t height);
virtual ~bgfx_target();
@@ -40,6 +40,8 @@ public:
bool double_buffered() const { return m_double_buffer; }
uint32_t style() const { return m_style; }
bool filter() const { return m_filter; }
+ uint32_t prescale_x() const { return m_prescale_x; }
+ uint32_t prescale_y() const { return m_prescale_y; }
// bgfx_texture_handle_provider
virtual uint16_t width() const override { return m_width; }
@@ -57,7 +59,10 @@ private:
uint16_t m_width;
uint16_t m_height;
- bool m_double_buffer;
+ uint32_t m_prescale_x;
+ uint32_t m_prescale_y;
+
+ bool m_double_buffer;
uint32_t m_style;
bool m_filter;
diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp
index b04a280eb1d..ede2ceefaa3 100644
--- a/src/osd/modules/render/bgfx/targetmanager.cpp
+++ b/src/osd/modules/render/bgfx/targetmanager.cpp
@@ -25,9 +25,9 @@ target_manager::~target_manager()
m_targets.clear();
}
-bgfx_target* target_manager::create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, uint32_t style, bool double_buffer, bool filter)
+bgfx_target* target_manager::create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, uint32_t prescale_x, uint32_t prescale_y, uint32_t style, bool double_buffer, bool filter)
{
- bgfx_target* target = new bgfx_target(name, format, width, height, style, double_buffer, filter);
+ bgfx_target* target = new bgfx_target(name, format, width, height, prescale_x, prescale_y, style, double_buffer, filter);
m_targets[name] = target;
m_textures.add_provider(name, target);
@@ -67,9 +67,11 @@ void target_manager::update_guest_targets(uint16_t width, uint16_t height)
const bgfx::TextureFormat::Enum format = target_ptr->format();
const bool double_buffered = target_ptr->double_buffered();
const bool filter = target_ptr->filter();
+ const uint32_t prescale_x = target_ptr->prescale_x();
+ const uint32_t prescale_y = target_ptr->prescale_y();
delete target_ptr;
- target.second = new bgfx_target(name, format, width, height, TARGET_STYLE_GUEST, double_buffered, filter);
+ target.second = new bgfx_target(name, format, width, height, prescale_x, prescale_y, TARGET_STYLE_GUEST, double_buffered, filter);
m_textures.add_provider(name, target.second);
}
}
diff --git a/src/osd/modules/render/bgfx/targetmanager.h b/src/osd/modules/render/bgfx/targetmanager.h
index 34dab48ee81..e957c85fee5 100644
--- a/src/osd/modules/render/bgfx/targetmanager.h
+++ b/src/osd/modules/render/bgfx/targetmanager.h
@@ -28,7 +28,7 @@ public:
target_manager(texture_manager& textures) : m_textures(textures), m_guest_width(16), m_guest_height(16) { }
~target_manager();
- bgfx_target* create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, uint32_t style, bool double_buffer, bool filter);
+ bgfx_target* create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, uint32_t prescale_x, uint32_t prescale_y, uint32_t style, bool double_buffer, bool filter);
bgfx_target* create_backbuffer(void *handle, uint32_t width, uint32_t height);
void update_guest_targets(uint16_t width, uint16_t height);
diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp
index 3c32bcd13c3..f5423b34eed 100644
--- a/src/osd/modules/render/bgfx/texturemanager.cpp
+++ b/src/osd/modules/render/bgfx/texturemanager.cpp
@@ -11,8 +11,12 @@
#include <bgfx/bgfx.h>
+#include "emu.h"
+
#include "texturemanager.h"
#include "texture.h"
+#include "rendutil.h"
+#include "modules/render/copyutil.h"
texture_manager::~texture_manager()
{
@@ -46,15 +50,40 @@ bgfx_texture* texture_manager::create_texture(std::string name, bgfx::TextureFor
return texture;
}
+bgfx_texture* texture_manager::create_png_texture(std::string path, std::string file_name, std::string texture_name, uint32_t flags)
+{
+ bitmap_argb32 bitmap;
+ emu_file file(path.c_str(), OPEN_FLAG_READ);
+ render_load_png(bitmap, file, nullptr, file_name.c_str());
+
+ uint8_t *texture_data = new uint8_t[bitmap.width() * bitmap.height() * 4];
+
+ uint32_t width = bitmap.width();
+ uint32_t height = bitmap.height();
+ uint32_t rowpixels = bitmap.rowpixels();
+ void *base = bitmap.raw_pixptr(0);
+ for (int y = 0; y < height; y++) {
+ copy_util::copyline_argb32(reinterpret_cast<UINT32 *>(texture_data) + y * width, reinterpret_cast<UINT32 *>(base) + y * rowpixels, width, nullptr);
+ }
+
+ bgfx_texture* texture = create_texture(texture_name, bgfx::TextureFormat::RGBA8, width, height, texture_data, flags);
+
+ delete[] texture_data;
+
+ return texture;
+}
+
bgfx::TextureHandle texture_manager::handle(std::string name)
{
+ bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
std::map<std::string, bgfx_texture_handle_provider*>::iterator iter = m_textures.find(name);
if (iter != m_textures.end())
{
- return (iter->second)->texture();
+ handle = (iter->second)->texture();
}
- return BGFX_INVALID_HANDLE;
+ assert(handle.idx != bgfx::invalidHandle);
+ return handle;
}
bgfx_texture_handle_provider* texture_manager::provider(std::string name)
diff --git a/src/osd/modules/render/bgfx/texturemanager.h b/src/osd/modules/render/bgfx/texturemanager.h
index 1b757d20630..710ddc0bb34 100644
--- a/src/osd/modules/render/bgfx/texturemanager.h
+++ b/src/osd/modules/render/bgfx/texturemanager.h
@@ -28,6 +28,7 @@ public:
~texture_manager();
bgfx_texture* create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data = nullptr, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP);
+ bgfx_texture* create_png_texture(std::string path, std::string file_name, std::string texture_name, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP);
void add_provider(std::string name, bgfx_texture_handle_provider* texture);
// Getters
diff --git a/src/osd/modules/render/bgfx/vs_deconverge.sc b/src/osd/modules/render/bgfx/vs_deconverge.sc
index 21db02c490f..cb3b43f8a49 100644
--- a/src/osd/modules/render/bgfx/vs_deconverge.sc
+++ b/src/osd/modules/render/bgfx/vs_deconverge.sc
@@ -6,12 +6,10 @@ $output v_color0, v_texcoord0, v_texcoord1, v_texcoord2
#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-uniform vec4 u_texsize;
-uniform vec4 u_screenrect;
-
-uniform vec4 u_swap_xy;
-uniform vec4 u_quad_dims;
+// Autos
+uniform vec4 u_source_dims;
+// User-supplied
uniform vec4 u_converge_red;
uniform vec4 u_converge_green;
uniform vec4 u_converge_blue;
@@ -19,22 +17,15 @@ uniform vec4 u_radial_converge_red;
uniform vec4 u_radial_converge_green;
uniform vec4 u_radial_converge_blue;
-uniform vec4 u_source_dims;
-
void main()
{
gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0));
- vec2 HalfSourceRect = u_screenrect.xy * 0.5;
-
- vec2 QuadRatio = vec2(1.0, (u_swap_xy.x > 0.0) ? u_quad_dims.y / u_quad_dims.x : u_quad_dims.x / u_quad_dims.y);
-
- // radial converge offset to "translate" the most outer pixel as thay would be translated by the linar converge with the same amount
- vec2 radialConvergeOffset = 2.0 * u_screenrect.xy;
+ vec2 half_value = vec2(0.5, 0.5);
- v_texcoord0 = (a_texcoord0 - HalfSourceRect) * (1.0 + u_radial_converge_red.xy * radialConvergeOffset) + HalfSourceRect + u_converge_red.xy * (vec2(1.0, 1.0) / u_source_dims.xy);
- v_texcoord1 = (a_texcoord0 - HalfSourceRect) * (1.0 + u_radial_converge_green.xy * radialConvergeOffset) + HalfSourceRect + u_converge_green.xy * (vec2(1.0, 1.0) / u_source_dims.xy);
- v_texcoord2 = (a_texcoord0 - HalfSourceRect) * (1.0 + u_radial_converge_blue.xy * radialConvergeOffset) + HalfSourceRect + u_converge_blue.xy * (vec2(1.0, 1.0) / u_source_dims.xy);
+ v_texcoord0 = (a_texcoord0 - half_value) * (1.0 + u_radial_converge_red.xy ) + half_value + u_converge_red.xy * (vec2(1.0, 1.0) / u_source_dims.xy);
+ v_texcoord1 = (a_texcoord0 - half_value) * (1.0 + u_radial_converge_green.xy) + half_value + u_converge_green.xy * (vec2(1.0, 1.0) / u_source_dims.xy);
+ v_texcoord2 = (a_texcoord0 - half_value) * (1.0 + u_radial_converge_blue.xy ) + half_value + u_converge_blue.xy * (vec2(1.0, 1.0) / u_source_dims.xy);
v_color0 = a_color0;
}
diff --git a/src/osd/modules/render/bgfx/vs_ratios.sc b/src/osd/modules/render/bgfx/vs_ratios.sc
deleted file mode 100644
index c3699f6fbd9..00000000000
--- a/src/osd/modules/render/bgfx/vs_ratios.sc
+++ /dev/null
@@ -1,14 +0,0 @@
-$input a_position, a_texcoord0, a_color0
-$output v_texcoord0, v_color0
-
-// license:BSD-3-Clause
-// copyright-holders:Dario Manesku
-
-#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-
-void main()
-{
- gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0));
- v_texcoord0 = a_texcoord0;
- v_color0 = a_color0;
-}
diff --git a/src/osd/modules/render/bgfx/vs_tint.sc b/src/osd/modules/render/bgfx/vs_tint.sc
deleted file mode 100644
index c3699f6fbd9..00000000000
--- a/src/osd/modules/render/bgfx/vs_tint.sc
+++ /dev/null
@@ -1,14 +0,0 @@
-$input a_position, a_texcoord0, a_color0
-$output v_texcoord0, v_color0
-
-// license:BSD-3-Clause
-// copyright-holders:Dario Manesku
-
-#include "../../../../../3rdparty/bgfx/examples/common/common.sh"
-
-void main()
-{
- gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0));
- v_texcoord0 = a_texcoord0;
- v_color0 = a_color0;
-}
diff --git a/src/osd/modules/render/copyutil.h b/src/osd/modules/render/copyutil.h
new file mode 100644
index 00000000000..f3cd3f6851a
--- /dev/null
+++ b/src/osd/modules/render/copyutil.h
@@ -0,0 +1,167 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+//============================================================
+//
+// copyutil.h - bitmap-conversion functions
+//
+//============================================================
+
+#pragma once
+
+#ifndef __RENDER_COPYUTIL__
+#define __RENDER_COPYUTIL__
+
+#include "emu.h"
+
+class copy_util
+{
+public:
+ static inline void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ rgb_t srcpixel = palette[*src++];
+ *dst++ = 0xff000000 | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r();
+ }
+ }
+
+ static inline void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ rgb_t srcpixel = palette[*src++];
+ *dst++ = (srcpixel.a() << 24) | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r();
+ }
+ }
+
+ static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette)
+ {
+ int x;
+
+ // palette (really RGB map) case
+ if (palette != nullptr)
+ {
+ for (x = 0; x < width; x++)
+ {
+ rgb_t srcpix = *src++;
+ *dst++ = 0xff000000 | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()];
+ }
+ }
+
+ // direct case
+ else
+ {
+ for (x = 0; x < width; x++)
+ {
+ rgb_t srcpix = *src++;
+ *dst++ = 0xff000000 | (srcpix.b() << 16) | (srcpix.g() << 8) | srcpix.r();
+ }
+ }
+ }
+
+ static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette)
+ {
+ int x;
+ // palette (really RGB map) case
+ if (palette != nullptr)
+ {
+ for (x = 0; x < width; x++)
+ {
+ rgb_t srcpix = *src++;
+ *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()];
+ }
+ }
+
+ // direct case
+ else
+ {
+ for (x = 0; x < width; x++)
+ {
+ rgb_t srcpix = *src++;
+ *dst++ = (srcpix.a() << 24) | (srcpix.b() << 16) | (srcpix.g() << 8) | srcpix.r();
+ }
+ }
+ }
+
+ static inline UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr)
+ {
+ /* original equations:
+
+ C = Y - 16
+ D = Cb - 128
+ E = Cr - 128
+
+ R = clip(( 298 * C + 409 * E + 128) >> 8)
+ G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8)
+ B = clip(( 298 * C + 516 * D + 128) >> 8)
+
+ R = clip(( 298 * (Y - 16) + 409 * (Cr - 128) + 128) >> 8)
+ G = clip(( 298 * (Y - 16) - 100 * (Cb - 128) - 208 * (Cr - 128) + 128) >> 8)
+ B = clip(( 298 * (Y - 16) + 516 * (Cb - 128) + 128) >> 8)
+
+ R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8)
+ G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8)
+ B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8)
+
+ R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8)
+ G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8)
+ B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8)
+ */
+ int r, g, b, common;
+
+ common = 298 * y - 298 * 16;
+ r = (common + 409 * cr - 409 * 128 + 128) >> 8;
+ g = (common - 100 * cb + 100 * 128 - 208 * cr + 208 * 128 + 128) >> 8;
+ b = (common + 516 * cb - 516 * 128 + 128) >> 8;
+
+ if (r < 0) r = 0;
+ else if (r > 255) r = 255;
+ if (g < 0) g = 0;
+ else if (g > 255) g = 255;
+ if (b < 0) b = 0;
+ else if (b > 255) b = 255;
+
+ return 0xff000000 | (b << 16) | (g << 8) | r;
+ }
+
+ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xprescale)
+ {
+ int x;
+
+ assert(width % 2 == 0);
+
+ // palette (really RGB map) case
+ if (palette != nullptr)
+ {
+ for (x = 0; x < width / 2; x++)
+ {
+ UINT16 srcpix0 = *src++;
+ UINT16 srcpix1 = *src++;
+ UINT8 cb = srcpix0 & 0xff;
+ UINT8 cr = srcpix1 & 0xff;
+ for (int x2 = 0; x2 < xprescale; x2++)
+ *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr);
+ for (int x2 = 0; x2 < xprescale; x2++)
+ *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr);
+ }
+ }
+
+ // direct case
+ else
+ {
+ for (x = 0; x < width; x += 2)
+ {
+ UINT16 srcpix0 = *src++;
+ UINT16 srcpix1 = *src++;
+ UINT8 cb = srcpix0 & 0xff;
+ UINT8 cr = srcpix1 & 0xff;
+ for (int x2 = 0; x2 < xprescale; x2++)
+ *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr);
+ for (int x2 = 0; x2 < xprescale; x2++)
+ *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr);
+ }
+ }
+ }
+};
+
+#endif // __RENDER_COPYUTIL__ \ No newline at end of file
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 539c9ee4d14..4d305983ff0 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -23,6 +23,7 @@
// MAMEOS headers
#include "emu.h"
#include "window.h"
+#include "rendutil.h"
#include <bgfx/bgfxplatform.h>
#include <bgfx/bgfx.h>
@@ -31,6 +32,7 @@
#include <algorithm>
#include "drawbgfx.h"
+#include "copyutil.h"
#include "bgfx/texturemanager.h"
#include "bgfx/targetmanager.h"
#include "bgfx/shadermanager.h"
@@ -62,7 +64,6 @@ const char* renderer_bgfx::WINDOW_PREFIX = "Window 0, ";
//============================================================
#define GIBBERISH (0)
-#define USE_NEW_SHADERS (1)
//============================================================
// INLINES
@@ -164,16 +165,17 @@ int renderer_bgfx::create()
m_screen_effect[2] = m_effects->effect("screen_multiply");
m_screen_effect[3] = m_effects->effect("screen_add");
-#if USE_NEW_SHADERS
m_chains = new chain_manager(options, *m_textures, *m_targets, *m_effects, m_width[window().m_index], m_height[window().m_index]);
m_screen_chain = m_chains->chain(options.bgfx_screen_chain(), window().machine(), window().m_index);
m_sliders_dirty = true;
-#endif
uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
m_texture_cache = m_textures->create_texture("#cache", bgfx::TextureFormat::RGBA8, CACHE_SIZE, CACHE_SIZE, nullptr, flags);
- memset(m_white, 0xff, sizeof(uint32_t) * 16 * 16);
+ uint32_t shadow_flags = 0;//BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
+ m_textures->create_png_texture(window().machine().options().art_path(), options.bgfx_shadow_mask(), "shadow", shadow_flags);
+
+ memset(m_white, 0xff, sizeof(uint32_t) * 16 * 16);
m_texinfo.push_back(rectangle_packer::packable_rectangle(WHITE_HASH, PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32), 16, 16, 16, nullptr, m_white));
return 0;
@@ -186,9 +188,7 @@ int renderer_bgfx::create()
renderer_bgfx::~renderer_bgfx()
{
// Cleanup.
-#if USE_NEW_SHADERS
delete m_chains;
-#endif
delete m_effects;
delete m_shaders;
delete m_textures;
@@ -325,25 +325,15 @@ void renderer_bgfx::process_screen_quad(int view, render_primitive* prim)
m_textures->add_provider("screen", texture);
m_targets->update_guest_targets(tex_width, tex_height);
- m_screen_chain->process(prim, view, *m_textures, window().get_size().width(), window().get_size().height(), get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags)));
+ m_screen_chain->process(prim, view, *m_textures, window(), get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags)));
m_textures->add_provider("screen", nullptr);
delete texture;
}
-void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim)
+void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer)
{
- bgfx::TransientVertexBuffer buffer;
- if (bgfx::checkAvailTransientVertexBuffer(6, ScreenVertex::ms_decl))
- {
- bgfx::allocTransientVertexBuffer(&buffer, 6, ScreenVertex::ms_decl);
- }
- else
- {
- return;
- }
-
- ScreenVertex* vertex = reinterpret_cast<ScreenVertex*>(buffer.data);
+ ScreenVertex* vertex = reinterpret_cast<ScreenVertex*>(buffer->data);
vertex[0].m_x = prim->bounds.x0;
vertex[0].m_y = prim->bounds.y0;
@@ -388,7 +378,7 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim)
vertex[5].m_v = prim->texcoords.tl.v;
UINT32 blend = PRIMFLAG_GET_BLENDMODE(prim->flags);
- bgfx::setVertexBuffer(&buffer);
+ bgfx::setVertexBuffer(buffer);
bgfx::setTexture(0, m_screen_effect[blend]->uniform("s_tex")->handle(), m_targets->target(m_screen_chain->output())->texture());
m_screen_effect[blend]->submit(view);
}
@@ -654,176 +644,6 @@ uint32_t renderer_bgfx::u32Color(uint32_t r, uint32_t g, uint32_t b, uint32_t a
return (a << 24) | (b << 16) | (g << 8) | r;
}
-//============================================================
-// copyline_palette16
-//============================================================
-
-static inline void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette)
-{
- for (int x = 0; x < width; x++)
- {
- rgb_t srcpixel = palette[*src++];
- *dst++ = 0xff000000 | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r();
- }
-}
-
-
-//============================================================
-// copyline_palettea16
-//============================================================
-
-static inline void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette)
-{
- for (int x = 0; x < width; x++)
- {
- rgb_t srcpixel = palette[*src++];
- *dst++ = (srcpixel.a() << 24) | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r();
- }
-}
-
-
-//============================================================
-// copyline_rgb32
-//============================================================
-
-static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette)
-{
- int x;
-
- // palette (really RGB map) case
- if (palette != nullptr)
- {
- for (x = 0; x < width; x++)
- {
- rgb_t srcpix = *src++;
- *dst++ = 0xff000000 | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()];
- }
- }
-
- // direct case
- else
- {
- for (x = 0; x < width; x++)
- {
- rgb_t srcpix = *src++;
- *dst++ = 0xff000000 | (srcpix.b() << 16) | (srcpix.g() << 8) | srcpix.r();
- }
- }
-}
-
-
-//============================================================
-// copyline_argb32
-//============================================================
-
-static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette)
-{
- int x;
- // palette (really RGB map) case
- if (palette != nullptr)
- {
- for (x = 0; x < width; x++)
- {
- rgb_t srcpix = *src++;
- *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()];
- }
- }
-
- // direct case
- else
- {
- for (x = 0; x < width; x++)
- {
- rgb_t srcpix = *src++;
- *dst++ = (srcpix.a() << 24) | (srcpix.b() << 16) | (srcpix.g() << 8) | srcpix.r();
- }
- }
-}
-
-static inline UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr)
-{
- /* original equations:
-
- C = Y - 16
- D = Cb - 128
- E = Cr - 128
-
- R = clip(( 298 * C + 409 * E + 128) >> 8)
- G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8)
- B = clip(( 298 * C + 516 * D + 128) >> 8)
-
- R = clip(( 298 * (Y - 16) + 409 * (Cr - 128) + 128) >> 8)
- G = clip(( 298 * (Y - 16) - 100 * (Cb - 128) - 208 * (Cr - 128) + 128) >> 8)
- B = clip(( 298 * (Y - 16) + 516 * (Cb - 128) + 128) >> 8)
-
- R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8)
- G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8)
- B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8)
-
- R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8)
- G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8)
- B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8)
- */
- int r, g, b, common;
-
- common = 298 * y - 298 * 16;
- r = (common + 409 * cr - 409 * 128 + 128) >> 8;
- g = (common - 100 * cb + 100 * 128 - 208 * cr + 208 * 128 + 128) >> 8;
- b = (common + 516 * cb - 516 * 128 + 128) >> 8;
-
- if (r < 0) r = 0;
- else if (r > 255) r = 255;
- if (g < 0) g = 0;
- else if (g > 255) g = 255;
- if (b < 0) b = 0;
- else if (b > 255) b = 255;
-
- return 0xff000000 | (b << 16) | (g << 8) | r;
-}
-
-//============================================================
-// copyline_yuy16_to_argb
-//============================================================
-
-static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xprescale)
-{
- int x;
-
- assert(width % 2 == 0);
-
- // palette (really RGB map) case
- if (palette != nullptr)
- {
- for (x = 0; x < width / 2; x++)
- {
- UINT16 srcpix0 = *src++;
- UINT16 srcpix1 = *src++;
- UINT8 cb = srcpix0 & 0xff;
- UINT8 cr = srcpix1 & 0xff;
- for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr);
- for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr);
- }
- }
-
- // direct case
- else
- {
- for (x = 0; x < width; x += 2)
- {
- UINT16 srcpix0 = *src++;
- UINT16 srcpix1 = *src++;
- UINT8 cb = srcpix0 & 0xff;
- UINT8 cr = srcpix1 & 0xff;
- for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr);
- for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr);
- }
- }
-}
-
const bgfx::Memory* renderer_bgfx::mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base)
{
const bgfx::Memory* mem = bgfx::alloc(width * height * 4);
@@ -832,19 +652,19 @@ const bgfx::Memory* renderer_bgfx::mame_texture_data_to_bgfx_texture_data(UINT32
switch (format)
{
case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16):
- copyline_palette16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette);
+ copy_util::copyline_palette16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette);
break;
case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16):
- copyline_palettea16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette);
+ copy_util::copyline_palettea16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette);
break;
case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16):
- copyline_yuy16_to_argb((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette, 1);
+ copy_util::copyline_yuy16_to_argb((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette, 1);
break;
case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32):
- copyline_argb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette);
+ copy_util::copyline_argb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette);
break;
case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32):
- copyline_rgb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette);
+ copy_util::copyline_rgb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette);
break;
default:
break;
@@ -972,6 +792,7 @@ int renderer_bgfx::draw(int update)
if (status != BUFFER_EMPTY)
{
+ //printf("Drawing with gui effect\n"); fflush(stdout);
bgfx::setVertexBuffer(&buffer);
bgfx::setTexture(0, m_gui_effect[blend]->uniform("s_tex")->handle(), m_texture_cache->texture());
m_gui_effect[blend]->submit(view_index);
@@ -982,6 +803,7 @@ int renderer_bgfx::draw(int update)
prim = prim->next();
}
}
+ //printf("Done\n\n\n"); fflush(stdout);
window().m_primlist->release_lock();
@@ -1009,6 +831,7 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(int view, bool atl
switch ((*prim)->type)
{
case render_primitive::LINE:
+ //printf("Putting a line at vertex index %d, vertices now %d\n", vertices, vertices + 30); fflush(stdout);
put_line((*prim)->bounds.x0, (*prim)->bounds.y0, (*prim)->bounds.x1, (*prim)->bounds.y1, 1.0f, u32Color((*prim)->color.r * 255, (*prim)->color.g * 255, (*prim)->color.b * 255, (*prim)->color.a * 255), (ScreenVertex*)buffer->data + vertices, 1.0f);
vertices += 30;
break;
@@ -1017,6 +840,7 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(int view, bool atl
if ((*prim)->texture.base == nullptr)
{
put_packed_quad(*prim, WHITE_HASH, (ScreenVertex*)buffer->data + vertices);
+ //printf("Putting a blank quad at vertex index %d, vertices now %d\n", vertices, vertices + 6); fflush(stdout);
vertices += 6;
}
else
@@ -1025,23 +849,29 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(int view, bool atl
if (atlas_valid && (*prim)->packable(PACKABLE_SIZE) && hash != 0 && m_hash_to_entry[hash].hash())
{
put_packed_quad(*prim, hash, (ScreenVertex*)buffer->data + vertices);
+ //printf("Putting a packable quad at vertex index %d, vertices now %d\n", vertices, vertices + 6); fflush(stdout);
vertices += 6;
}
else
{
-#if USE_NEW_SHADERS
+ if (vertices > 0)
+ {
+ //printf("Pre-flushing buffer\n");
+ return BUFFER_PRE_FLUSH;
+ }
+
if (PRIMFLAG_GET_SCREENTEX((*prim)->flags))
{
//render_screen_quad(view, *prim);
- render_post_screen_quad(view, *prim);
+ //printf("Rendering a screen quad at vertex index %d\n", vertices); fflush(stdout);
+ render_post_screen_quad(view, *prim, buffer);
}
else
{
+ //printf("Rendering an unpackable quad at vertex index %d\n", vertices); fflush(stdout);
render_textured_quad(view, *prim, buffer);
}
-#else
- render_textured_quad(*view, *prim, buffer);
-#endif
+ //printf("Ignored %d vertices\n", vertices); fflush(stdout);
return BUFFER_EMPTY;
}
}
@@ -1060,6 +890,7 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(int view, bool atl
*prim = (*prim)->next();
}
+ //printf("Rendered %d vertices\n", vertices); fflush(stdout);
if (*prim == nullptr)
{
return BUFFER_DONE;
@@ -1202,7 +1033,7 @@ bool renderer_bgfx::check_for_dirty_atlas()
void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::TransientVertexBuffer *buffer)
{
int vertices = 0;
-
+ //printf("Allocating buffer\n");
bool mode_switched = false;
while (prim != nullptr && !mode_switched)
{
@@ -1210,6 +1041,7 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
{
case render_primitive::LINE:
vertices += 30;
+ //printf("Encountered a line, vertices now %d\n", vertices);
break;
case render_primitive::QUAD:
@@ -1218,19 +1050,33 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
if (prim->texture.base == nullptr)
{
vertices += 6;
+ //printf("Encountered a blank quad, vertices now %d\n", vertices);
}
else
{
- mode_switched = true;
if (vertices == 0)
{
vertices += 6;
+ if (!PRIMFLAG_GET_SCREENTEX(prim->flags))
+ {
+ //printf("Encountered a screen quad, vertices now %d\n", vertices);
+ }
+ else
+ {
+ //printf("Encountered an unpackable quad, vertices now %d\n", vertices);
+ }
+ }
+ else
+ {
+ //printf("Encountered an unpackable/screen quad with %d vertices left in the buffer, ending loop.\n", vertices);
}
+ mode_switched = true;
}
}
else
{
vertices += 6;
+ //printf("Encountered a packable quad, vertices now %d\n", vertices);
}
break;
default:
@@ -1248,6 +1094,7 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
if (vertices > 0 && bgfx::checkAvailTransientVertexBuffer(vertices, ScreenVertex::ms_decl))
{
+ //printf("Allocating %d transient vertices\n", vertices);
bgfx::allocTransientVertexBuffer(buffer, vertices, ScreenVertex::ms_decl);
}
}
@@ -1255,7 +1102,6 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
slider_state* renderer_bgfx::get_slider_list()
{
slider_state *listhead = nullptr;
-#if USE_NEW_SHADERS
slider_state **tailptr = &listhead;
std::vector<bgfx_slider*> sliders = m_screen_chain->sliders();
for (bgfx_slider* slider : sliders)
@@ -1272,6 +1118,5 @@ slider_state* renderer_bgfx::get_slider_list()
}
(*tailptr)->next = nullptr;
m_sliders_dirty = false;
-#endif
return listhead;
}
diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h
index 3b19d4edffa..2c4fc934a26 100644
--- a/src/osd/modules/render/drawbgfx.h
+++ b/src/osd/modules/render/drawbgfx.h
@@ -74,7 +74,7 @@ private:
void process_screen_quad(int view, render_primitive* prim);
void render_textured_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer);
- void render_post_screen_quad(int view, render_primitive* prim);
+ void render_post_screen_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer);
void put_packed_quad(render_primitive *prim, UINT32 hash, ScreenVertex* vertex);
void put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, ScreenVertex* vertex);