summaryrefslogtreecommitdiffstatshomepage
path: root/bgfx
diff options
context:
space:
mode:
author MooglyGuy <MooglyGuy@users.noreply.github.com>2022-12-26 04:40:43 +0100
committer GitHub <noreply@github.com>2022-12-26 14:40:43 +1100
commit2d893a60b4675359285737be173dfa632269cab3 (patch)
tree7460d5c8a16462b4e04f97343a00415c92802f53 /bgfx
parentaede45e42e930a74cc0b56e43b152a8c51c6c0f7 (diff)
-bgfx: Adjusted per-pass blending handling - fixes MT07586 and MT07587. (#10747) [Ryan Holtz]
Diffstat (limited to 'bgfx')
-rw-r--r--bgfx/effects/gui_multiply.json4
-rw-r--r--bgfx/effects/misc/blit.json8
-rw-r--r--bgfx/effects/misc/blit_alpha.json121
-rw-r--r--bgfx/effects/screen_multiply.json4
4 files changed, 127 insertions, 10 deletions
diff --git a/bgfx/effects/gui_multiply.json b/bgfx/effects/gui_multiply.json
index 15ac24c91a9..9bd4decdcc8 100644
--- a/bgfx/effects/gui_multiply.json
+++ b/bgfx/effects/gui_multiply.json
@@ -10,9 +10,7 @@
"blend": {
"equation": "add",
"srcColor": "dstcolor",
- "dstColor": "0",
- "srcAlpha": "dstalpha",
- "dstAlpha": "0"
+ "dstColor": "0"
},
"depth": {
"function": "always"
diff --git a/bgfx/effects/misc/blit.json b/bgfx/effects/misc/blit.json
index a5e5c544336..85dcba27635 100644
--- a/bgfx/effects/misc/blit.json
+++ b/bgfx/effects/misc/blit.json
@@ -21,10 +21,10 @@
// 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": "srcalpha",
- "dstColor": "1-srcalpha",
- "srcAlpha": "srcalpha",
- "dstAlpha": "1-srcalpha"
+ "srcColor": "1",
+ "dstColor": "0",
+ "srcAlpha": "1",
+ "dstAlpha": "0"
},
// depth (required): The depth state for this effect.
diff --git a/bgfx/effects/misc/blit_alpha.json b/bgfx/effects/misc/blit_alpha.json
new file mode 100644
index 00000000000..c8d86a79cff
--- /dev/null
+++ b/bgfx/effects/misc/blit_alpha.json
@@ -0,0 +1,121 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+//============================================================
+//
+// blit_alpha.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": "srcalpha",
+ "dstColor": "1-srcalpha",
+ "srcAlpha": "srcalpha",
+ "dstAlpha": "1-srcalpha"
+ },
+
+ // depth (required): The depth state for this effect.
+ "depth": {
+ // function (optional): The depth function to use when drawing.
+ // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always"
+ // default: "always"
+ "function": "always",
+
+ // writeenable (optional): Whether to store Z-buffer data.
+ // values: true, false
+ // default: false
+ "writeenable": false
+ },
+
+ // cull (required): The cull mode for this effect.
+ "cull": {
+ // mode (optional): What winding, if any, to cull.
+ // values: "none", "cw", "ccw"
+ // default: "ccw"
+ //
+ // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw"
+ "mode": "none"
+ },
+
+ // write (required): Write enable for color and alpha channels.
+ "write": {
+ // rgb (optional): Whether to store color data when drawing.
+ // values: true, false
+ // default: false
+ "rgb": true,
+
+ // alpha (optional): Whether to store alpha data when drawing.
+ // values: true, false
+ // default: false
+ "alpha": true
+ },
+
+ // vertex (required): The vertex shader to use when drawing.
+ // value: A string containing the path and name of a shader file to use, minus the extension.
+ "vertex": "chains/misc/vs_blit",
+
+ // pixel/fragment (required): The pixel or fragment shader to use when drawing.
+ // value: A string containing the path and name of a shader file to use, minus the extension.
+ "fragment": "chains/misc/fs_blit",
+
+ // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist.
+ "uniforms": [
+ {
+ // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader.
+ // value: A string containing the name of the uniform as described above.
+ //
+ // NOTE: Some names correspond to special values that will be automatically filled by the BGFX
+ // code if they are used by the shader. These names are:
+ // "u_screen_dims"
+ // The dimensions of the first texture input if present, otherwise the dimensions of the output window.
+ // Valid values: xy
+ // "u_inv_screen_dims"
+ // The reciprocal of u_screen_dims.
+ // Valid values: xy
+ // "u_source_dims"
+ // The size, in pixels, of the screen texture incoming to the chain.
+ // Valid values: xy
+ // "u_rotation_type"
+ // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270.
+ // Valid values: x
+ // "u_swap_xy"
+ // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false.
+ // Valid values: x
+ // "u_quad_dims"
+ // The dimensions, in pixels, occupied by this one screen primitive itself in the output window.
+ // Valid values: xy
+ // "u_tex_sizeN"
+ // The dimensions, in pixels, of the texture in input pair N. Starts at 0.
+ // valid values: xy
+ "name": "s_tex",
+
+ // type (required): The type of the uniform.
+ // values: "int", "vec4", "mat3", "mat4"
+ //
+ // Note: "int" should only be used for samplers.
+ "type": "int",
+
+ // values (required): The array of numbers with which to initialize the uniform.
+ // value: A JSON array containin the correct amount of numbers to initialize a uniform of the
+ // above-specified type. The following size rules should be followed:
+ // "int": 1 float
+ // "vec4": 4 floats
+ // "mat3": 9 floats
+ // "mat4": 16 floats
+ "values": [ 1.0 ]
+ }
+ ]
+}
diff --git a/bgfx/effects/screen_multiply.json b/bgfx/effects/screen_multiply.json
index 93bfb90c358..5cd216f11b3 100644
--- a/bgfx/effects/screen_multiply.json
+++ b/bgfx/effects/screen_multiply.json
@@ -11,9 +11,7 @@
"blend": {
"equation": "add",
"srcColor": "dstcolor",
- "dstColor": "0",
- "srcAlpha": "dstalpha",
- "dstAlpha": "0"
+ "dstColor": "0"
},
"depth": {
"function": "always"