diff options
author | 2016-03-25 18:44:18 +0100 | |
---|---|---|
committer | 2016-03-25 18:44:46 +0100 | |
commit | 22f0c31238f40e79902d88c9860d4aebc228424d (patch) | |
tree | facb6e639bdf31a3c424bbd73413a8af4bf1bb15 | |
parent | 37a32099cd8072362a3ab56929bb4dddc751794a (diff) |
Cleanup in the bgfx aisle, nw
99 files changed, 421 insertions, 177 deletions
diff --git a/bgfx/effects/blit.json b/bgfx/effects/blit.json index 3954b4d0b74..bbc9fd295d4 100644 --- a/bgfx/effects/blit.json +++ b/bgfx/effects/blit.json @@ -1,22 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// blit.json: A simple texture-to-target copy. +// +//============================================================ { + // blend (required): The blend state for this effect. "blend": { + // equation (optional): What equation to perform on the source and destination blend values. + // values: "add", "sub", "revSub", "min", "max" + // default: "add" + // + // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" "equation": "add", + + // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. + // values: "0", "1", "srcColor", "1-srcColor", "dstColor", "1-dstColor", "srcAlpha", "1-srcAlpha", "dstAlpha", "1-dstAlpha" + // defaults (srcColor, srcAlpha): "1" + // defaults (dstColor, dstAlpha): "0" + // + // "zero", "one", "invSrcColor", "invDstColor", "invSrcAlpha", and "invDstAlpha" are provided as aliases for "0", "1", "1-srcColor", "1-dstColor", "1-srcAlpha", and "1-dstAlpha" "srcColor": "1", "dstColor": "0", "srcAlpha": "1", "dstAlpha": "0" }, + + // depth (required): The depth state for this effect. "depth": { - "function": "always" + // function (optional): The depth function to use when drawing. + // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" + // default: "always" + "function": "always", + + // writeenable (optional): Whether to store Z-buffer data. + // values: true, false + // default: false + "writeenable": false }, - "cull": { "mode": "none" }, + + // cull (required): The cull mode for this effect. + "cull": { + // mode (optional): What winding, if any, to cull. + // values: "none", "cw", "ccw" + // default: "ccw" + // + // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" + "mode": "none" + }, + + // write (required): Write enable for color and alpha channels. "write": { - "rgb": "true", - "alpha": "true" + // rgb (optional): Whether to store color data when drawing. + // values: true, false + // default: false + "rgb": true, + + // alpha (optional): Whether to store alpha data when drawing. + // values: true, false + // default: false + "alpha": true }, + + // vertex (required): The vertex shader to use when drawing. + // value: A string containing the name of a shader file to use, minus the extension. "vertex": "vs_blit", + + // pixel/fragment (required): The pixel or fragment shader to use when drawing. + // value: A string containing the name of a shader file to use, minus the extension. "fragment": "fs_blit", - "uniforms": [ - { "name": "s_tex", "type": "int", "values": [ 1.0 ] } + + // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. + "uniforms": [ + { + // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. + // value: A string containing the name of the uniform as described above. + // + // NOTE: Some names correspond to special values that will be automatically filled by the BGFX + // code if they are used by the shader. These names are: + // "u_screen_dims" + // The dimensions of the first texture input if present, otherwise the dimensions of the output window. + // Valid values: xy + // "u_inv_screen_dims" + // The reciprocal of u_screen_dims. + // Valid values: xy + // "u_source_dims" + // The size, in pixels, of the screen texture incoming to the chain. + // Valid values: xy + // "u_rotation_type" + // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. + // Valid values: x + // "u_swap_xy" + // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. + // Valid values: x + // "u_quad_dims" + // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. + // Valid values: xy + // "u_tex_sizeN" + // The dimensions, in pixels, of the texture in input pair N. Starts at 0. + // valid values: xy + "name": "s_tex", + + // type (required): The type of the uniform. + // values: "int", "vec4", "mat3", "mat4" + // + // Note: "int" should only be used for samplers. + "type": "int", + + // values (required): The array of numbers with which to initialize the uniform. + // value: A JSON array containin the correct amount of numbers to initialize a uniform of the + // above-specified type. The following size rules should be followed: + // "int": 1 float + // "vec4": 4 floats + // "mat3": 9 floats + // "mat4": 16 floats + "values": [ 1.0 ] + } ] }
\ No newline at end of file diff --git a/bgfx/effects/color.json b/bgfx/effects/color.json index df6448631ec..5a033140233 100644 --- a/bgfx/effects/color.json +++ b/bgfx/effects/color.json @@ -1,3 +1,10 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// color.json: Color aberration shader for CRT simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +18,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_color", "fragment": "fs_color", diff --git a/bgfx/effects/deconverge.json b/bgfx/effects/deconverge.json index f438bd4f016..dafd2fb630e 100644 --- a/bgfx/effects/deconverge.json +++ b/bgfx/effects/deconverge.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// deconverge.json: Electron-gun misalignment shader for CRT +// simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,14 +19,14 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_deconverge", "fragment": "fs_deconverge", "uniforms": [ { "name": "s_tex", "type": "int", "values": [ 1.0 ] }, - { "name": "u_tex_size0", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }, + { "name": "u_source_size", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.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 ] }, diff --git a/bgfx/effects/defocus.json b/bgfx/effects/defocus.json index 4c14ae05d76..7ba4b2cec49 100644 --- a/bgfx/effects/defocus.json +++ b/bgfx/effects/defocus.json @@ -1,3 +1,10 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// defocus.json: Foucs adjustment shader for CRT simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +18,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_defocus", "fragment": "fs_defocus", diff --git a/bgfx/effects/distortion.json b/bgfx/effects/distortion.json index 13de69a40f6..e8bbac16095 100644 --- a/bgfx/effects/distortion.json +++ b/bgfx/effects/distortion.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:ImJezze +//============================================================ +// +// distortion.json: Output distortion shader for CRT +// simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_distortion", "fragment": "fs_distortion", diff --git a/bgfx/effects/gui_add.json b/bgfx/effects/gui_add.json index d8672a0f026..bff6517b739 100644 --- a/bgfx/effects/gui_add.json +++ b/bgfx/effects/gui_add.json @@ -1,9 +1,17 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// gui_add.json: Generic additive-blend shader for GUI +// elements. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "srcAlpha", + "srcColor": "srcalpha", "dstColor": "1", - "srcAlpha": "srcAlpha", + "srcAlpha": "srcalpha", "dstAlpha": "1" }, "depth": { @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_gui", "fragment": "fs_gui", diff --git a/bgfx/effects/gui_blend.json b/bgfx/effects/gui_blend.json index d8cfda51672..2ef99b816e7 100644 --- a/bgfx/effects/gui_blend.json +++ b/bgfx/effects/gui_blend.json @@ -1,18 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// gui_blend.json: Generic modulate-blend shader for GUI +// elements. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "srcAlpha", - "dstColor": "1-srcAlpha", - "srcAlpha": "srcAlpha", - "dstAlpha": "1-srcAlpha" + "srcColor": "srcalpha", + "dstColor": "1-srcalpha", + "srcAlpha": "srcalpha", + "dstAlpha": "1-srcalpha" }, "depth": { "function": "always" }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_gui", "fragment": "fs_gui", diff --git a/bgfx/effects/gui_multiply.json b/bgfx/effects/gui_multiply.json index fa70d303aec..14551be8190 100644 --- a/bgfx/effects/gui_multiply.json +++ b/bgfx/effects/gui_multiply.json @@ -1,9 +1,17 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// gui_multiply.json: Generic multiplicative blend shader +// for GUI elements. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "dstColor", + "srcColor": "dstcolor", "dstColor": "0", - "srcAlpha": "dstAlpha", + "srcAlpha": "dstalpha", "dstAlpha": "0" }, "depth": { @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_gui", "fragment": "fs_gui", diff --git a/bgfx/effects/gui_opaque.json b/bgfx/effects/gui_opaque.json index 58d1a324d2d..53e6f732828 100644 --- a/bgfx/effects/gui_opaque.json +++ b/bgfx/effects/gui_opaque.json @@ -1,3 +1,10 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// gui_opaque.json: Generic opaque shader for GUI elements. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +18,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_gui", "fragment": "fs_gui", diff --git a/bgfx/effects/ntsc_decode.json b/bgfx/effects/ntsc_decode.json index 0bf1963c85f..208f35b0ff3 100644 --- a/bgfx/effects/ntsc_decode.json +++ b/bgfx/effects/ntsc_decode.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// ntsc_decode.json: Composite NTSC decoder shader for CRT +// simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_ntsc_decode", "fragment": "fs_ntsc_decode", diff --git a/bgfx/effects/ntsc_encode.json b/bgfx/effects/ntsc_encode.json index f635edad14c..8ff193398b2 100644 --- a/bgfx/effects/ntsc_encode.json +++ b/bgfx/effects/ntsc_encode.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// ntsc_encode.json: Composite NTSC encoder shader for CRT +// simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_ntsc_encode", "fragment": "fs_ntsc_encode", diff --git a/bgfx/effects/phosphor.json b/bgfx/effects/phosphor.json index 68038e3e99b..aaa3c12f727 100644 --- a/bgfx/effects/phosphor.json +++ b/bgfx/effects/phosphor.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// phosphor.json: Phosphor persistence shader for CRT +// simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_phosphor", "fragment": "fs_phosphor", diff --git a/bgfx/effects/post.json b/bgfx/effects/post.json index 4a660a70411..525bbfc39b8 100644 --- a/bgfx/effects/post.json +++ b/bgfx/effects/post.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz,ImJezze +//============================================================ +// +// post.json: Scanline, hum-bar, shadow-mask, and final +// color convolution shader for CRT simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_post", "fragment": "fs_post", diff --git a/bgfx/effects/prescale.json b/bgfx/effects/prescale.json index 492f8a11ad6..a636c4316e0 100644 --- a/bgfx/effects/prescale.json +++ b/bgfx/effects/prescale.json @@ -1,3 +1,11 @@ +// license:BSD-3-Clause +// copyright-holders:ImJezze +//============================================================ +// +// prescale.json: Unfiltered upscale shader for CRT +// simulation. +// +//============================================================ { "blend": { "equation": "add", @@ -11,8 +19,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_prescale", "fragment": "fs_prescale", diff --git a/bgfx/effects/screen_add.json b/bgfx/effects/screen_add.json index 43d110fc2d1..ed1d6aae00c 100644 --- a/bgfx/effects/screen_add.json +++ b/bgfx/effects/screen_add.json @@ -1,9 +1,18 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// screen_add.json: Shader used when drawing a final +// post-processed screen image to the output window with +// additive blending. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "srcAlpha", + "srcColor": "srcalpha", "dstColor": "1", - "srcAlpha": "srcAlpha", + "srcAlpha": "srcalpha", "dstAlpha": "1" }, "depth": { @@ -11,8 +20,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_screen", "fragment": "fs_screen", diff --git a/bgfx/effects/screen_blend.json b/bgfx/effects/screen_blend.json index 37da6abf24f..d10e119d23d 100644 --- a/bgfx/effects/screen_blend.json +++ b/bgfx/effects/screen_blend.json @@ -1,18 +1,27 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// screen_blend.json: Shader used when drawing a final +// post-processed screen image to the output window with +// modulate blending. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "srcAlpha", - "dstColor": "1-srcAlpha", - "srcAlpha": "srcAlpha", - "dstAlpha": "1-srcAlpha" + "srcColor": "srcalpha", + "dstColor": "1-srcalpha", + "srcAlpha": "srcalpha", + "dstAlpha": "1-srcalpha" }, "depth": { "function": "always" }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_screen", "fragment": "fs_screen", diff --git a/bgfx/effects/screen_multiply.json b/bgfx/effects/screen_multiply.json index cd37b997954..feca7eb7ef0 100644 --- a/bgfx/effects/screen_multiply.json +++ b/bgfx/effects/screen_multiply.json @@ -1,9 +1,18 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// screen_multiply.json: Shader used when drawing a final +// post-processed screen image to the output window with +// multiply blending. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "dstColor", + "srcColor": "dstcolor", "dstColor": "0", - "srcAlpha": "dstAlpha", + "srcAlpha": "dstalpha", "dstAlpha": "0" }, "depth": { @@ -11,8 +20,8 @@ }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_screen", "fragment": "fs_screen", diff --git a/bgfx/effects/screen_opaque.json b/bgfx/effects/screen_opaque.json index 121439837ab..6e9dc300cde 100644 --- a/bgfx/effects/screen_opaque.json +++ b/bgfx/effects/screen_opaque.json @@ -1,18 +1,27 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// screen_opaque.json: Shader used when drawing a final +// post-processed screen image to the output window with +// no blending. +// +//============================================================ { "blend": { "equation": "add", - "srcColor": "srcAlpha", - "dstColor": "1-srcAlpha", - "srcAlpha": "srcAlpha", - "dstAlpha": "1-srcAlpha" + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" }, "depth": { "function": "always" }, "cull": { "mode": "none" }, "write": { - "rgb": "true", - "alpha": "true" + "rgb": true, + "alpha": true }, "vertex": "vs_screen", "fragment": "fs_screen", diff --git a/bgfx/shaders/dx11/fs_blit.bin b/bgfx/shaders/dx11/fs_blit.bin Binary files differindex 0d17db9e972..97c305a440d 100644 --- a/bgfx/shaders/dx11/fs_blit.bin +++ b/bgfx/shaders/dx11/fs_blit.bin diff --git a/bgfx/shaders/dx11/fs_color.bin b/bgfx/shaders/dx11/fs_color.bin Binary files differindex 7ada1d530ff..145c0e72c3b 100644 --- a/bgfx/shaders/dx11/fs_color.bin +++ b/bgfx/shaders/dx11/fs_color.bin diff --git a/bgfx/shaders/dx11/fs_deconverge.bin b/bgfx/shaders/dx11/fs_deconverge.bin Binary files differindex 21266fc0729..34032932b6b 100644 --- a/bgfx/shaders/dx11/fs_deconverge.bin +++ b/bgfx/shaders/dx11/fs_deconverge.bin diff --git a/bgfx/shaders/dx11/fs_defocus.bin b/bgfx/shaders/dx11/fs_defocus.bin Binary files differindex 89a9eabf154..2b1552c0cf6 100644 --- a/bgfx/shaders/dx11/fs_defocus.bin +++ b/bgfx/shaders/dx11/fs_defocus.bin diff --git a/bgfx/shaders/dx11/fs_distortion.bin b/bgfx/shaders/dx11/fs_distortion.bin Binary files differindex 991c224260e..19a7124084e 100644 --- a/bgfx/shaders/dx11/fs_distortion.bin +++ b/bgfx/shaders/dx11/fs_distortion.bin diff --git a/bgfx/shaders/dx11/fs_gui.bin b/bgfx/shaders/dx11/fs_gui.bin Binary files differindex bab438f0bc8..de921a8ac60 100644 --- a/bgfx/shaders/dx11/fs_gui.bin +++ b/bgfx/shaders/dx11/fs_gui.bin diff --git a/bgfx/shaders/dx11/fs_ntsc_decode.bin b/bgfx/shaders/dx11/fs_ntsc_decode.bin Binary files differindex 34e0a451339..e42dfd9ab0b 100644 --- a/bgfx/shaders/dx11/fs_ntsc_decode.bin +++ b/bgfx/shaders/dx11/fs_ntsc_decode.bin diff --git a/bgfx/shaders/dx11/fs_ntsc_encode.bin b/bgfx/shaders/dx11/fs_ntsc_encode.bin Binary files differindex 82929ef7b61..76ed9fc6b9d 100644 --- a/bgfx/shaders/dx11/fs_ntsc_encode.bin +++ b/bgfx/shaders/dx11/fs_ntsc_encode.bin diff --git a/bgfx/shaders/dx11/fs_phosphor.bin b/bgfx/shaders/dx11/fs_phosphor.bin Binary files differindex 39b9243398b..cb4067339e1 100644 --- a/bgfx/shaders/dx11/fs_phosphor.bin +++ b/bgfx/shaders/dx11/fs_phosphor.bin diff --git a/bgfx/shaders/dx11/fs_post.bin b/bgfx/shaders/dx11/fs_post.bin Binary files differindex 9a9c4d5340b..142a5ce6296 100644 --- a/bgfx/shaders/dx11/fs_post.bin +++ b/bgfx/shaders/dx11/fs_post.bin diff --git a/bgfx/shaders/dx11/fs_prescale.bin b/bgfx/shaders/dx11/fs_prescale.bin Binary files differindex cd3f1b4bbf6..48b30509c0b 100644 --- a/bgfx/shaders/dx11/fs_prescale.bin +++ b/bgfx/shaders/dx11/fs_prescale.bin diff --git a/bgfx/shaders/dx11/fs_screen.bin b/bgfx/shaders/dx11/fs_screen.bin Binary files differindex 741898018e7..da6666a4c60 100644 --- a/bgfx/shaders/dx11/fs_screen.bin +++ b/bgfx/shaders/dx11/fs_screen.bin diff --git a/bgfx/shaders/dx11/vs_blit.bin b/bgfx/shaders/dx11/vs_blit.bin Binary files differindex 7d81d4ca2c6..296cdf52be7 100644 --- a/bgfx/shaders/dx11/vs_blit.bin +++ b/bgfx/shaders/dx11/vs_blit.bin diff --git a/bgfx/shaders/dx11/vs_color.bin b/bgfx/shaders/dx11/vs_color.bin Binary files differindex 910dcf83eb6..a0673685469 100644 --- a/bgfx/shaders/dx11/vs_color.bin +++ b/bgfx/shaders/dx11/vs_color.bin diff --git a/bgfx/shaders/dx11/vs_deconverge.bin b/bgfx/shaders/dx11/vs_deconverge.bin Binary files differindex 57e88242548..43c6c33410e 100644 --- a/bgfx/shaders/dx11/vs_deconverge.bin +++ b/bgfx/shaders/dx11/vs_deconverge.bin diff --git a/bgfx/shaders/dx11/vs_defocus.bin b/bgfx/shaders/dx11/vs_defocus.bin Binary files differindex add460bbedb..eb5d2fc8e4a 100644 --- a/bgfx/shaders/dx11/vs_defocus.bin +++ b/bgfx/shaders/dx11/vs_defocus.bin diff --git a/bgfx/shaders/dx11/vs_distortion.bin b/bgfx/shaders/dx11/vs_distortion.bin Binary files differindex 42f4c175d20..2d5d08866b9 100644 --- a/bgfx/shaders/dx11/vs_distortion.bin +++ b/bgfx/shaders/dx11/vs_distortion.bin diff --git a/bgfx/shaders/dx11/vs_gui.bin b/bgfx/shaders/dx11/vs_gui.bin Binary files differindex af3243fbdf8..b1640861f2b 100644 --- a/bgfx/shaders/dx11/vs_gui.bin +++ b/bgfx/shaders/dx11/vs_gui.bin diff --git a/bgfx/shaders/dx11/vs_ntsc_decode.bin b/bgfx/shaders/dx11/vs_ntsc_decode.bin Binary files differindex 0ae50c5a1a4..29e62929df3 100644 --- a/bgfx/shaders/dx11/vs_ntsc_decode.bin +++ b/bgfx/shaders/dx11/vs_ntsc_decode.bin diff --git a/bgfx/shaders/dx11/vs_ntsc_encode.bin b/bgfx/shaders/dx11/vs_ntsc_encode.bin Binary files differindex ab7d6786fbf..87c60815602 100644 --- a/bgfx/shaders/dx11/vs_ntsc_encode.bin +++ b/bgfx/shaders/dx11/vs_ntsc_encode.bin diff --git a/bgfx/shaders/dx11/vs_phosphor.bin b/bgfx/shaders/dx11/vs_phosphor.bin Binary files differindex ac5c9fce4d4..29f497b4a65 100644 --- a/bgfx/shaders/dx11/vs_phosphor.bin +++ b/bgfx/shaders/dx11/vs_phosphor.bin diff --git a/bgfx/shaders/dx11/vs_post.bin b/bgfx/shaders/dx11/vs_post.bin Binary files differindex f993a26347b..70639fc75f7 100644 --- a/bgfx/shaders/dx11/vs_post.bin +++ b/bgfx/shaders/dx11/vs_post.bin diff --git a/bgfx/shaders/dx11/vs_prescale.bin b/bgfx/shaders/dx11/vs_prescale.bin Binary files differindex bf2f1254cf6..c173aff6efd 100644 --- a/bgfx/shaders/dx11/vs_prescale.bin +++ b/bgfx/shaders/dx11/vs_prescale.bin diff --git a/bgfx/shaders/dx11/vs_screen.bin b/bgfx/shaders/dx11/vs_screen.bin Binary files differindex fa7bb70f238..766a9c4e93b 100644 --- a/bgfx/shaders/dx11/vs_screen.bin +++ b/bgfx/shaders/dx11/vs_screen.bin diff --git a/bgfx/shaders/dx9/fs_post.bin b/bgfx/shaders/dx9/fs_post.bin Binary files differindex a8b1990b02f..aad4df72ddd 100644 --- a/bgfx/shaders/dx9/fs_post.bin +++ b/bgfx/shaders/dx9/fs_post.bin diff --git a/bgfx/shaders/dx9/vs_deconverge.bin b/bgfx/shaders/dx9/vs_deconverge.bin Binary files differindex 6d4cd09eaec..dbe6e584767 100644 --- a/bgfx/shaders/dx9/vs_deconverge.bin +++ b/bgfx/shaders/dx9/vs_deconverge.bin diff --git a/bgfx/shaders/gles/fs_post.bin b/bgfx/shaders/gles/fs_post.bin Binary files differindex 03e4d278687..72279deee43 100644 --- a/bgfx/shaders/gles/fs_post.bin +++ b/bgfx/shaders/gles/fs_post.bin diff --git a/bgfx/shaders/gles/vs_deconverge.bin b/bgfx/shaders/gles/vs_deconverge.bin Binary files differindex fab2c05298b..1183e5872a0 100644 --- a/bgfx/shaders/gles/vs_deconverge.bin +++ b/bgfx/shaders/gles/vs_deconverge.bin diff --git a/bgfx/shaders/glsl/fs_post.bin b/bgfx/shaders/glsl/fs_post.bin Binary files differindex 3b507c5815c..23e7d687606 100644 --- a/bgfx/shaders/glsl/fs_post.bin +++ b/bgfx/shaders/glsl/fs_post.bin diff --git a/bgfx/shaders/glsl/vs_deconverge.bin b/bgfx/shaders/glsl/vs_deconverge.bin Binary files differindex dc288268197..137a591a958 100644 --- a/bgfx/shaders/glsl/vs_deconverge.bin +++ b/bgfx/shaders/glsl/vs_deconverge.bin diff --git a/bgfx/shaders/metal/fs_post.bin b/bgfx/shaders/metal/fs_post.bin Binary files differindex c5795b2fed5..4da4ca2e2c1 100644 --- a/bgfx/shaders/metal/fs_post.bin +++ b/bgfx/shaders/metal/fs_post.bin diff --git a/bgfx/shaders/metal/vs_deconverge.bin b/bgfx/shaders/metal/vs_deconverge.bin Binary files differindex 14d0472286d..071a3a6d612 100644 --- a/bgfx/shaders/metal/vs_deconverge.bin +++ b/bgfx/shaders/metal/vs_deconverge.bin @@ -1560,7 +1560,7 @@ shaders: bgfx-tools -$(call MKDIR,build/bgfx/shaders/gles) -$(call MKDIR,build/bgfx/shaders/glsl) -$(call MKDIR,build/bgfx/shaders/metal) - $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx rebuild + $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx/shaders rebuild #------------------------------------------------- # Translation diff --git a/src/osd/modules/render/bgfx/blendreader.cpp b/src/osd/modules/render/bgfx/blendreader.cpp index f96f20a4ba8..9e7ddb17ce3 100644 --- a/src/osd/modules/render/bgfx/blendreader.cpp +++ b/src/osd/modules/render/bgfx/blendreader.cpp @@ -14,8 +14,8 @@ const blend_reader::string_to_enum blend_reader::EQUATION_NAMES[blend_reader::EQ { "add", BGFX_STATE_BLEND_EQUATION_ADD }, { "sub", BGFX_STATE_BLEND_EQUATION_SUB }, { "subtract", BGFX_STATE_BLEND_EQUATION_SUB }, - { "revSub", BGFX_STATE_BLEND_EQUATION_REVSUB }, - { "revSubtract", BGFX_STATE_BLEND_EQUATION_REVSUB }, + { "revsub", BGFX_STATE_BLEND_EQUATION_REVSUB }, + { "revsubtract", BGFX_STATE_BLEND_EQUATION_REVSUB }, { "min", BGFX_STATE_BLEND_EQUATION_MIN }, { "max", BGFX_STATE_BLEND_EQUATION_MAX } }; @@ -25,18 +25,18 @@ const blend_reader::string_to_enum blend_reader::FUNCTION_NAMES[blend_reader::FU { "zero", BGFX_STATE_BLEND_ZERO }, { "1", BGFX_STATE_BLEND_ONE }, { "one", BGFX_STATE_BLEND_ONE }, - { "srcColor", BGFX_STATE_BLEND_SRC_COLOR }, - { "1-srcColor", BGFX_STATE_BLEND_INV_SRC_COLOR }, - { "invSrcColor", BGFX_STATE_BLEND_INV_SRC_COLOR }, - { "dstColor", BGFX_STATE_BLEND_DST_COLOR }, - { "1-dstColor", BGFX_STATE_BLEND_INV_DST_COLOR }, - { "invDstColor", BGFX_STATE_BLEND_INV_DST_COLOR }, - { "srcAlpha", BGFX_STATE_BLEND_SRC_ALPHA }, - { "1-srcAlpha", BGFX_STATE_BLEND_INV_SRC_ALPHA }, - { "invSrcAlpha", BGFX_STATE_BLEND_INV_SRC_ALPHA }, - { "dstAlpha", BGFX_STATE_BLEND_DST_ALPHA }, - { "1-dstAlpha", BGFX_STATE_BLEND_INV_DST_ALPHA }, - { "invDstAlpha", BGFX_STATE_BLEND_INV_DST_ALPHA } + { "srccolor", BGFX_STATE_BLEND_SRC_COLOR }, + { "1-srccolor", BGFX_STATE_BLEND_INV_SRC_COLOR }, + { "invsrccolor", BGFX_STATE_BLEND_INV_SRC_COLOR }, + { "dstcolor", BGFX_STATE_BLEND_DST_COLOR }, + { "1-dstcolor", BGFX_STATE_BLEND_INV_DST_COLOR }, + { "invdstcolor", BGFX_STATE_BLEND_INV_DST_COLOR }, + { "srcalpha", BGFX_STATE_BLEND_SRC_ALPHA }, + { "1-srcalpha", BGFX_STATE_BLEND_INV_SRC_ALPHA }, + { "invsrcalpha", BGFX_STATE_BLEND_INV_SRC_ALPHA }, + { "dstalpha", BGFX_STATE_BLEND_DST_ALPHA }, + { "1-dstalpha", BGFX_STATE_BLEND_INV_DST_ALPHA }, + { "invdstalpha", BGFX_STATE_BLEND_INV_DST_ALPHA } }; uint64_t blend_reader::read_from_value(const Value& value) diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 22be450be40..cba1bbc3c3d 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -4,8 +4,8 @@ // // chainmanager.cpp - BGFX shader chain manager // -// Maintains a string-to-entry lookup of BGFX shader effect -// chains, defined by chain.h and read by chainreader.h +// Provides loading for BGFX shader effect chains, defined +// by chain.h and read by chainreader.h // //============================================================ @@ -60,7 +60,7 @@ bgfx_chain* chain_manager::load_chain(std::string name, running_machine& machine data[size] = 0; Document document; - document.Parse<0>(data); + document.Parse<kParseCommentsFlag>(data); delete [] data; diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h index 07e1dfd8594..8ed0b218bb4 100644 --- a/src/osd/modules/render/bgfx/chainmanager.h +++ b/src/osd/modules/render/bgfx/chainmanager.h @@ -4,8 +4,8 @@ // // chainmanager.h - BGFX shader chain manager // -// Maintains a string-to-entry lookup of BGFX shader -// effect chains, defined by chain.h and read by chainreader.h +// Provides loading for BGFX shader effect chains, defined +// by chain.h and read by chainreader.h // //============================================================ diff --git a/src/osd/modules/render/bgfx/cullreader.cpp b/src/osd/modules/render/bgfx/cullreader.cpp index 593e712fecb..616e7cabfe4 100644 --- a/src/osd/modules/render/bgfx/cullreader.cpp +++ b/src/osd/modules/render/bgfx/cullreader.cpp @@ -11,9 +11,11 @@ #include "cullreader.h" const cull_reader::string_to_enum cull_reader::MODE_NAMES[cull_reader::MODE_COUNT] = { - { "none", 0 }, - { "cw", BGFX_STATE_CULL_CW }, - { "ccw", BGFX_STATE_CULL_CCW } + { "none", 0 }, + { "cw", BGFX_STATE_CULL_CW }, + { "clockwise", BGFX_STATE_CULL_CW }, + { "ccw", BGFX_STATE_CULL_CCW }, + { "counterclockwise", BGFX_STATE_CULL_CCW } }; uint64_t cull_reader::read_from_value(const Value& value) diff --git a/src/osd/modules/render/bgfx/cullreader.h b/src/osd/modules/render/bgfx/cullreader.h index 5c521a108a2..0cb2a3d0f67 100644 --- a/src/osd/modules/render/bgfx/cullreader.h +++ b/src/osd/modules/render/bgfx/cullreader.h @@ -18,7 +18,7 @@ public: static uint64_t read_from_value(const Value& value); private: - static const int MODE_COUNT = 3; + static const int MODE_COUNT = 5; static const string_to_enum MODE_NAMES[MODE_COUNT]; }; diff --git a/src/osd/modules/render/bgfx/depthreader.cpp b/src/osd/modules/render/bgfx/depthreader.cpp index e904604b84d..b32eb426bb7 100644 --- a/src/osd/modules/render/bgfx/depthreader.cpp +++ b/src/osd/modules/render/bgfx/depthreader.cpp @@ -27,7 +27,7 @@ uint64_t depth_reader::read_from_value(const Value& value, std::string prefix) if (value.HasMember("writeenable")) { if (!READER_CHECK(value["writeenable"].IsBool(), (prefix + "Value 'writeenable' must be a boolean\n").c_str())) return 0; - write_enable = value["writeenable"].GetBool() ? BGFX_STATE_DEPTH_WRITE: 0; + write_enable = value["writeenable"].GetBool() ? BGFX_STATE_DEPTH_WRITE : 0; } uint64_t function = get_enum_from_value(value, "function", BGFX_STATE_DEPTH_TEST_ALWAYS, FUNCTION_NAMES, FUNCTION_COUNT); diff --git a/src/osd/modules/render/bgfx/effect.h b/src/osd/modules/render/bgfx/effect.h index 8c1c3c4f617..c4a5d49b2c5 100644 --- a/src/osd/modules/render/bgfx/effect.h +++ b/src/osd/modules/render/bgfx/effect.h @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz //============================================================ // -// effect.cpp - BGFX shader material to be applied to a mesh +// effect.h - BGFX shader material to be applied to a mesh // //============================================================ diff --git a/src/osd/modules/render/bgfx/effectmanager.cpp b/src/osd/modules/render/bgfx/effectmanager.cpp index bbe1ce33482..cf5d4172c6d 100644 --- a/src/osd/modules/render/bgfx/effectmanager.cpp +++ b/src/osd/modules/render/bgfx/effectmanager.cpp @@ -68,7 +68,7 @@ bgfx_effect* effect_manager::load_effect(std::string name) data[size] = 0; Document document; - document.Parse<0>(data); + document.Parse<kParseCommentsFlag>(data); delete [] data; @@ -85,7 +85,7 @@ bgfx_effect* effect_manager::load_effect(std::string name) printf("Unable to load effect %s\n", path.c_str()); return nullptr; } - + m_effects[name] = effect; return effect; diff --git a/src/osd/modules/render/bgfx/frameparameter.h b/src/osd/modules/render/bgfx/frameparameter.h index 022a6f2065b..b7ab5525eda 100644 --- a/src/osd/modules/render/bgfx/frameparameter.h +++ b/src/osd/modules/render/bgfx/frameparameter.h @@ -1,9 +1,8 @@ - // license:BSD-3-Clause // copyright-holders:Ryan Holtz //============================================================ // -// frameparameter.cpp - Frame-based dynamic shader param +// frameparameter.h - Frame-based dynamic shader param // //============================================================ diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp index ce4ece9508b..1f48171da7b 100644 --- a/src/osd/modules/render/bgfx/inputpair.cpp +++ b/src/osd/modules/render/bgfx/inputpair.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz //============================================================ // -// inputpair.h - BGFX sampler-and-texture pair +// inputpair.cpp - BGFX sampler-and-texture pair // // Keeps track of the texture which is bound to the sampler // which is bound to the specified stage index. diff --git a/src/osd/modules/render/bgfx/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/fs_blit.sc index ff6befc4272..a6835ff890d 100644 --- a/src/osd/modules/render/bgfx/fs_blit.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_blit.sc @@ -3,7 +3,7 @@ $input v_color0, v_texcoord0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Samplers SAMPLER2D(s_tex, 0); diff --git a/src/osd/modules/render/bgfx/fs_color.sc b/src/osd/modules/render/bgfx/shaders/fs_color.sc index fae98f2a39f..65c128a6a2a 100644 --- a/src/osd/modules/render/bgfx/fs_color.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_color.sc @@ -6,7 +6,7 @@ $input v_color0, v_texcoord0 // Color Convolution Effect //----------------------------------------------------------------------------- -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // User-supplied uniform vec4 u_red_ratios; diff --git a/src/osd/modules/render/bgfx/fs_deconverge.sc b/src/osd/modules/render/bgfx/shaders/fs_deconverge.sc index 409896ce40a..d58e1bf6df9 100644 --- a/src/osd/modules/render/bgfx/fs_deconverge.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_deconverge.sc @@ -6,7 +6,7 @@ $input v_color0, v_texcoord0, v_texcoord1, v_texcoord2 // Deconvergence Effect //----------------------------------------------------------------------------- -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Samplers SAMPLER2D(s_tex, 0); diff --git a/src/osd/modules/render/bgfx/fs_defocus.sc b/src/osd/modules/render/bgfx/shaders/fs_defocus.sc index 8c3ee7a4e6c..44ca7a93612 100644 --- a/src/osd/modules/render/bgfx/fs_defocus.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_defocus.sc @@ -6,7 +6,7 @@ $input v_color0, v_texcoord0 // Defocus Effect //----------------------------------------------------------------------------- -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Autos uniform vec4 u_tex_size0; diff --git a/src/osd/modules/render/bgfx/fs_distortion.sc b/src/osd/modules/render/bgfx/shaders/fs_distortion.sc index b3678abc669..1b93578a2cf 100644 --- a/src/osd/modules/render/bgfx/fs_distortion.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_distortion.sc @@ -6,7 +6,7 @@ $input v_color0, v_texcoord0 // Distortion Effect //----------------------------------------------------------------------------- -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Autos uniform vec4 u_swap_xy; diff --git a/src/osd/modules/render/bgfx/fs_gui.sc b/src/osd/modules/render/bgfx/shaders/fs_gui.sc index 9f539c1182a..a6285212d2f 100644 --- a/src/osd/modules/render/bgfx/fs_gui.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_gui.sc @@ -3,7 +3,7 @@ $input v_color0, v_texcoord0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Samplers SAMPLER2D(s_tex, 0); diff --git a/src/osd/modules/render/bgfx/fs_ntsc_decode.sc b/src/osd/modules/render/bgfx/shaders/fs_ntsc_decode.sc index 1f5c9305053..cc8f633bf5b 100644 --- a/src/osd/modules/render/bgfx/fs_ntsc_decode.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_ntsc_decode.sc @@ -6,7 +6,7 @@ $input v_color0, v_texcoord0 // NTSC Decode Effect //----------------------------------------------------------------------------- -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Autos uniform vec4 u_source_dims; diff --git a/src/osd/modules/render/bgfx/fs_ntsc_encode.sc b/src/osd/modules/render/bgfx/shaders/fs_ntsc_encode.sc index 61f5ae12ac9..3aeac29d20d 100644 --- a/src/osd/modules/render/bgfx/fs_ntsc_encode.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_ntsc_encode.sc @@ -8,7 +8,7 @@ $input v_color0, v_texcoord0 // NB: intentionally wasteful of uniforms in order for easier slider utilization -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Autos uniform vec4 u_source_dims; diff --git a/src/osd/modules/render/bgfx/fs_phosphor.sc b/src/osd/modules/render/bgfx/shaders/fs_phosphor.sc index e5ac1d91f35..4e752d94137 100644 --- a/src/osd/modules/render/bgfx/fs_phosphor.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_phosphor.sc @@ -3,7 +3,7 @@ $input v_color0, v_texcoord0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // User-supplied uniform vec4 u_passthrough; diff --git a/src/osd/modules/render/bgfx/fs_post.sc b/src/osd/modules/render/bgfx/shaders/fs_post.sc index 8fe9f227e3c..4a77dc88cbb 100644 --- a/src/osd/modules/render/bgfx/fs_post.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_post.sc @@ -6,7 +6,7 @@ $input v_color0, v_texcoord0, v_texcoord1 // Defocus Effect //----------------------------------------------------------------------------- -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Autos uniform vec4 u_swap_xy; @@ -113,11 +113,11 @@ void main() BaseColor.b = pow(BaseColor.b, u_power.b); // Scanline Simulation (may not affect bloom) - //if (u_prepare_bloom.x == 0.0) - //{ + if (u_prepare_bloom.x == 0.0) + { // Scanline Simulation (may not affect vector screen) - //if (u_prepare_vector.x == 0.0 && u_scanline_alpha.x > 0.0f) - //{ + if (u_prepare_vector.x == 0.0 && u_scanline_alpha.x > 0.0f) + { float BrightnessOffset = (u_scanline_bright_offset.x * u_scanline_alpha.x); float BrightnessScale = (u_scanline_bright_scale.x * u_scanline_alpha.x) + (1.0 - u_scanline_alpha.x); @@ -131,19 +131,19 @@ void main() float ScanBrightness = ScanSineScaled * BrightnessScale + BrightnessOffset * BrightnessScale; BaseColor.rgb *= mix(vec3(1.0, 1.0, 1.0), vec3(ScanBrightness, ScanBrightness, ScanBrightness), u_scanline_alpha.xxx); - //} + } // Hum Bar Simulation (may not affect vector screen) - //if (u_prepare_vector.x == 0.0 && u_humbar_alpha.x > 0.0f) - //{ - //float HumTimeStep = fract(u_time.x * 0.001); - //float HumBrightness = 1.0 - fract(BaseCoord.y + HumTimeStep) * u_humbar_alpha.x; - //BaseColor.rgb *= HumBrightness; - //} - //} - - //vec4 Output = u_prepare_vector.x > 0.0 ? BaseColor * (v_color0 + vec4(1.0, 1.0, 1.0, 0.0)) : BaseColor * v_color0; - //Output.a = 1.0; - - gl_FragColor = vec4(BaseColor.rgb, 1.0);//Output; + if (u_prepare_vector.x == 0.0 && u_humbar_alpha.x > 0.0f) + { + float HumTimeStep = fract(u_time.x * 0.001); + float HumBrightness = 1.0 - fract(BaseCoord.y + HumTimeStep) * u_humbar_alpha.x; + BaseColor.rgb *= HumBrightness; + } + } + + vec4 Output = u_prepare_vector.x > 0.0 ? BaseColor * (v_color0 + vec4(1.0, 1.0, 1.0, 0.0)) : BaseColor * v_color0; + Output.a = 1.0; + + gl_FragColor = Output; } diff --git a/src/osd/modules/render/bgfx/fs_prescale.sc b/src/osd/modules/render/bgfx/shaders/fs_prescale.sc index a6f377991f2..48d177b19fa 100644 --- a/src/osd/modules/render/bgfx/fs_prescale.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_prescale.sc @@ -3,7 +3,7 @@ $input v_color0, v_texcoord0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Samplers SAMPLER2D(s_tex, 0); diff --git a/src/osd/modules/render/bgfx/fs_screen.sc b/src/osd/modules/render/bgfx/shaders/fs_screen.sc index cecf14b4730..d0eaa170d49 100644 --- a/src/osd/modules/render/bgfx/fs_screen.sc +++ b/src/osd/modules/render/bgfx/shaders/fs_screen.sc @@ -3,7 +3,7 @@ $input v_color0, v_texcoord0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Samplers SAMPLER2D(s_tex, 0); diff --git a/src/osd/modules/render/bgfx/makefile b/src/osd/modules/render/bgfx/shaders/makefile index 86735a61c38..737ca43554b 100644 --- a/src/osd/modules/render/bgfx/makefile +++ b/src/osd/modules/render/bgfx/shaders/makefile @@ -1,6 +1,6 @@ -BGFX_DIR=../../../../../3rdparty/bgfx -RUNTIME_DIR=../../../../.. -BUILD_DIR=../../../../../build +BGFX_DIR=../../../../../../3rdparty/bgfx +RUNTIME_DIR=../../../../../.. +BUILD_DIR=../../../../../../build include $(BGFX_DIR)/scripts/shader.mk diff --git a/src/osd/modules/render/bgfx/varying.def.sc b/src/osd/modules/render/bgfx/shaders/varying.def.sc index 95b607539a7..95b607539a7 100644 --- a/src/osd/modules/render/bgfx/varying.def.sc +++ b/src/osd/modules/render/bgfx/shaders/varying.def.sc diff --git a/src/osd/modules/render/bgfx/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/vs_blit.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_blit.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_blit.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_color.sc b/src/osd/modules/render/bgfx/shaders/vs_color.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_color.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_color.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_deconverge.sc b/src/osd/modules/render/bgfx/shaders/vs_deconverge.sc index 284fe96e67b..6e13814c89b 100644 --- a/src/osd/modules/render/bgfx/vs_deconverge.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_deconverge.sc @@ -4,10 +4,10 @@ $output v_color0, v_texcoord0, v_texcoord1, v_texcoord2 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" // Autos -uniform vec4 u_tex_size0; +uniform vec4 u_source_size; // User-supplied uniform vec4 u_converge_red; @@ -23,9 +23,9 @@ void main() vec2 half_value = vec2(0.5, 0.5); - 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_tex_size0.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_tex_size0.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_tex_size0.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_size.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_size.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_size.xy); v_color0 = a_color0; } diff --git a/src/osd/modules/render/bgfx/vs_defocus.sc b/src/osd/modules/render/bgfx/shaders/vs_defocus.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_defocus.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_defocus.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_distortion.sc b/src/osd/modules/render/bgfx/shaders/vs_distortion.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_distortion.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_distortion.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_gui.sc b/src/osd/modules/render/bgfx/shaders/vs_gui.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_gui.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_gui.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_ntsc_decode.sc b/src/osd/modules/render/bgfx/shaders/vs_ntsc_decode.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_ntsc_decode.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_ntsc_decode.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_ntsc_encode.sc b/src/osd/modules/render/bgfx/shaders/vs_ntsc_encode.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_ntsc_encode.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_ntsc_encode.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_phosphor.sc b/src/osd/modules/render/bgfx/shaders/vs_phosphor.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_phosphor.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_phosphor.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_post.sc b/src/osd/modules/render/bgfx/shaders/vs_post.sc index 12b4931a1ae..89923cc9338 100644 --- a/src/osd/modules/render/bgfx/vs_post.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_post.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_texcoord1, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" uniform vec4 u_swap_xy; diff --git a/src/osd/modules/render/bgfx/vs_prescale.sc b/src/osd/modules/render/bgfx/shaders/vs_prescale.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_prescale.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_prescale.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/vs_screen.sc b/src/osd/modules/render/bgfx/shaders/vs_screen.sc index c3699f6fbd9..fd37320eefb 100644 --- a/src/osd/modules/render/bgfx/vs_screen.sc +++ b/src/osd/modules/render/bgfx/shaders/vs_screen.sc @@ -4,7 +4,7 @@ $output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" +#include "../../../../../../3rdparty/bgfx/examples/common/common.sh" void main() { diff --git a/src/osd/modules/render/bgfx/sliderreader.cpp b/src/osd/modules/render/bgfx/sliderreader.cpp index 3efe8749c03..b76d3d2c472 100644 --- a/src/osd/modules/render/bgfx/sliderreader.cpp +++ b/src/osd/modules/render/bgfx/sliderreader.cpp @@ -12,7 +12,7 @@ #include "slider.h" const slider_reader::string_to_enum slider_reader::TYPE_NAMES[slider_reader::TYPE_COUNT] = { - { "int_enum", uint64_t(bgfx_slider::slider_type::SLIDER_INT_ENUM) }, + { "intenum", uint64_t(bgfx_slider::slider_type::SLIDER_INT_ENUM) }, { "float", uint64_t(bgfx_slider::slider_type::SLIDER_FLOAT) }, { "int", uint64_t(bgfx_slider::slider_type::SLIDER_INT) }, { "color", uint64_t(bgfx_slider::slider_type::SLIDER_COLOR) }, @@ -24,11 +24,11 @@ const slider_reader::string_to_enum slider_reader::SCREEN_NAMES[slider_reader::S { "raster", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_RASTER) }, { "vector", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_VECTOR) }, { "crt", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_VECTOR_OR_RASTER) }, - { "vector_raster", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_VECTOR_OR_RASTER) }, + { "vectorraster", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_VECTOR_OR_RASTER) }, { "lcd", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD) }, - { "non_vector", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD_OR_RASTER) }, - { "lcd_raster", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD_OR_RASTER) }, - { "lcd_vector", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD_OR_VECTOR) }, + { "nonvector", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD_OR_RASTER) }, + { "lcdraster", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD_OR_RASTER) }, + { "lcdvector", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_LCD_OR_VECTOR) }, { "any", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_ANY) }, { "all", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_ANY) } }; diff --git a/src/osd/modules/render/bgfx/statereader.cpp b/src/osd/modules/render/bgfx/statereader.cpp index 0f5c0a2f88c..a318422d69d 100644 --- a/src/osd/modules/render/bgfx/statereader.cpp +++ b/src/osd/modules/render/bgfx/statereader.cpp @@ -1,5 +1,12 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +//================================================================ +// +// statereader.cpp - Generic functions for reading state from +// a JSON file using RapidJSON. +// +//================================================================ + #include "statereader.h" uint64_t state_reader::get_enum_from_value(const Value& value, std::string name, const uint64_t default_value, const string_to_enum* enums, const int count) diff --git a/src/osd/modules/render/bgfx/statereader.h b/src/osd/modules/render/bgfx/statereader.h index 5b9a5f5625d..968837a1a19 100644 --- a/src/osd/modules/render/bgfx/statereader.h +++ b/src/osd/modules/render/bgfx/statereader.h @@ -1,5 +1,12 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +//================================================================ +// +// statereader.h - Generic functions for reading state from a +// JSON file using RapidJSON. +// +//================================================================ + #pragma once #ifndef __DRAWBGFX_STATE_READER__ diff --git a/src/osd/modules/render/bgfx/suppressor.cpp b/src/osd/modules/render/bgfx/suppressor.cpp index b01e0f94d04..41a260d5d73 100644 --- a/src/osd/modules/render/bgfx/suppressor.cpp +++ b/src/osd/modules/render/bgfx/suppressor.cpp @@ -2,8 +2,8 @@ // copyright-holders:Ryan Holtz //============================================================ // -// suppressor.h - Conditionally suppress a bgfx chain entry -// from being processed. +// suppressor.cpp - Conditionally suppress a bgfx chain entry +// from being processed. // //============================================================ diff --git a/src/osd/modules/render/bgfx/suppressor.h b/src/osd/modules/render/bgfx/suppressor.h index 93166eff693..dd3702439ad 100644 --- a/src/osd/modules/render/bgfx/suppressor.h +++ b/src/osd/modules/render/bgfx/suppressor.h @@ -3,7 +3,7 @@ //============================================================ // // suppressor.h - Conditionally suppress a bgfx chain entry -// from being processed. +// from being processed. // //============================================================ diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp index 7702d0700b4..ff4acf7c088 100644 --- a/src/osd/modules/render/bgfx/targetmanager.cpp +++ b/src/osd/modules/render/bgfx/targetmanager.cpp @@ -4,8 +4,8 @@ // // targetmanager.cpp - BGFX render target manager // -// Maintains a string-to-entry mapping for any registered -// render targets. +// Maintains a per-screen string-to-entry mapping for any +// registered render targets. // //============================================================ diff --git a/src/osd/modules/render/bgfx/targetmanager.h b/src/osd/modules/render/bgfx/targetmanager.h index 0ffc7a934b8..45865c0eb8b 100644 --- a/src/osd/modules/render/bgfx/targetmanager.h +++ b/src/osd/modules/render/bgfx/targetmanager.h @@ -4,8 +4,8 @@ // // targetmanager.h - BGFX render target manager // -// Maintains a string-to-entry mapping for any registered -// render targets. +// Maintains a per-screen string-to-entry mapping for any +// registered render targets. // //============================================================ diff --git a/src/osd/modules/render/bgfx/texturehandleprovider.h b/src/osd/modules/render/bgfx/texturehandleprovider.h index e309bea8d59..5620e54974e 100644 --- a/src/osd/modules/render/bgfx/texturehandleprovider.h +++ b/src/osd/modules/render/bgfx/texturehandleprovider.h @@ -2,7 +2,8 @@ // copyright-holders:Ryan Holtz //============================================================ // -// texturehandleprovider.h +// texturehandleprovider.h - base class for any class that +// can potentially return information about a texture handle // //============================================================ diff --git a/src/osd/modules/render/bgfx/timeparameter.h b/src/osd/modules/render/bgfx/timeparameter.h index 6a05be4fc03..f06bf2f1abb 100644 --- a/src/osd/modules/render/bgfx/timeparameter.h +++ b/src/osd/modules/render/bgfx/timeparameter.h @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz //============================================================ // -// timeparameter.cpp - Time-based dynamic shader param +// timeparameter.h - Time-based dynamic shader param // //============================================================ diff --git a/src/osd/modules/render/bgfx/valueuniform.h b/src/osd/modules/render/bgfx/valueuniform.h index 2cce6970958..cf71742e8da 100644 --- a/src/osd/modules/render/bgfx/valueuniform.h +++ b/src/osd/modules/render/bgfx/valueuniform.h @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz //============================================================ // -// valueuniform.cpp - BGFX shader chain fixed uniform +// valueuniform.h - BGFX shader chain fixed uniform // // Represents the mapping between a fixed value and a chain // shader uniform for a given entry diff --git a/src/osd/modules/render/bgfx/writereader.cpp b/src/osd/modules/render/bgfx/writereader.cpp index 7fd36a03fda..6ec148f9e46 100644 --- a/src/osd/modules/render/bgfx/writereader.cpp +++ b/src/osd/modules/render/bgfx/writereader.cpp @@ -1,26 +1,18 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +//============================================================ +// +// cullreader.h - BGFX alpha/color write state JSON reader +// +//============================================================ + #include <bgfx/bgfx.h> #include "writereader.h" -const write_reader::string_to_enum write_reader::RGB_NAMES[write_reader::RGB_COUNT] = { - { "true", BGFX_STATE_RGB_WRITE }, - { "false", 0 }, - { "1", BGFX_STATE_RGB_WRITE }, - { "0", 0 } -}; - -const write_reader::string_to_enum write_reader::ALPHA_NAMES[write_reader::ALPHA_COUNT] = { - { "true", BGFX_STATE_ALPHA_WRITE }, - { "false", 0 }, - { "1", BGFX_STATE_ALPHA_WRITE }, - { "0", 0 } -}; - uint64_t write_reader::read_from_value(const Value& value) { - uint64_t rgb = get_enum_from_value(value, "rgb", 0, RGB_NAMES, RGB_COUNT); - uint64_t alpha = get_enum_from_value(value, "alpha", 0, ALPHA_NAMES, ALPHA_COUNT); + uint64_t rgb = get_bool(value, "rgb", false) ? BGFX_STATE_RGB_WRITE : 0; + uint64_t alpha = get_bool(value, "alpha", false) ? BGFX_STATE_ALPHA_WRITE : 0; return rgb | alpha; } diff --git a/src/osd/modules/render/bgfx/writereader.h b/src/osd/modules/render/bgfx/writereader.h index bd43b5899f5..7dcd1ac16c9 100644 --- a/src/osd/modules/render/bgfx/writereader.h +++ b/src/osd/modules/render/bgfx/writereader.h @@ -1,5 +1,11 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +//============================================================ +// +// cullreader.h - BGFX alpha/color write state JSON reader +// +//============================================================ + #pragma once #ifndef __DRAWBGFX_WRITE_READER__ @@ -10,12 +16,6 @@ class write_reader : public state_reader { public: static uint64_t read_from_value(const Value& value); - -private: - static const int RGB_COUNT = 4; - static const int ALPHA_COUNT = 4; - static const string_to_enum RGB_NAMES[RGB_COUNT]; - static const string_to_enum ALPHA_NAMES[ALPHA_COUNT]; }; #endif // __DRAWBGFX_WRITE_READER__ |