Add most of the rest of the D3D HLSL chain, nw

This commit is contained in:
therealmogminer@gmail.com 2016-03-15 05:17:38 +01:00
parent 9c33c40b82
commit b212e5dc2e
128 changed files with 1021 additions and 110 deletions

View File

@ -26,12 +26,40 @@
{ "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_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 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 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 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": "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": "float", "name": "scanline_alpha", "text": "Scanline Amount", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
{ "type": "float", "name": "scanline_scale", "text": "Overall Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
{ "type": "float", "name": "scanline_bright_scale", "text": "Scanline Brightness Scale", "default": 100, "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": "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.7f", "screen": "crt" },
{ "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 100, "max": 10000, "min": 0, "step": 1, "scale": 0.00001, "format": "%1.2f", "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": "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" }
],
"parameters": [
{ "name": "jitter", "type": "frame", "period": 2 }
{ "name": "jitter", "type": "frame", "period": 2 },
{ "name": "time", "type": "time", "limit": 0.0 }
],
"targets": [
{
@ -40,12 +68,6 @@
"prescale": 1,
"doublebuffer": true
},
{
"name": "deadend",
"mode": "guest",
"prescale": 1,
"doublebuffer": true
},
{ "name": "native",
"mode": "native",
"prescale": 1,
@ -55,6 +77,12 @@
"mode": "native",
"prescale": 1,
"doublebuffer": true
},
{ "name": "bloom",
"mode": "native",
"prescale": 1,
"doublebuffer": true,
"pyramid": true
}
],
"passes": [
@ -141,6 +169,15 @@
},
{ "effect": "deconverge",
"name": "Deconvergence",
"disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "converge_red", "value": [ 0, 0 ] },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "converge_green", "value": [ 0, 0 ] },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "converge_blue", "value": [ 0, 0 ] },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "radial_converge_red", "value": [ 0, 0 ] },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "radial_converge_green", "value": [ 0, 0 ] },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "radial_converge_blue", "value": [ 0, 0 ] }
],
"uniforms": [
{ "uniform": "u_converge_red", "slider": "converge_red" },
{ "uniform": "u_converge_green", "slider": "converge_green" },
@ -153,6 +190,123 @@
{ "sampler": "DiffuseSampler", "texture": "native" }
],
"output": "native"
},
{ "effect": "defocus",
"name": "Defocus Pass 1",
"disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "or", "name": "defocus", "value": [ 0, 0 ] }
],
"uniforms": [
{ "uniform": "u_defocus", "slider": "defocus" }
],
"input": [
{ "sampler": "DiffuseSampler", "texture": "native" }
],
"output": "native"
},
{ "effect": "defocus",
"name": "Defocus Pass 2",
"disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "or", "name": "defocus", "value": [ 0, 0 ] }
],
"uniforms": [
{ "uniform": "u_defocus", "slider": "defocus" }
],
"input": [
{ "sampler": "DiffuseSampler", "texture": "native" }
],
"output": "native"
},
{ "effect": "phosphor",
"name": "Phosphor Decay",
"disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "or", "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", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "or", "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": "post",
"name": "Non-Bloom Post Pass",
"disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "scanline_alpha", "value": 0.0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "shadow_alpha", "value": 0.0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "humbar_alpha", "value": 0.0 },
{ "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" },
{ "uniform": "u_humbar_alpha", "slider": "humbar_alpha" },
{ "uniform": "u_humbar_hertz_rate", "slider": "humbar_hertz_rate" },
{ "uniform": "u_floor", "slider": "floor" },
{ "uniform": "u_power", "slider": "power" },
{ "uniform": "u_scanline_jitter", "slider": "scanline_jitter_amount" },
{ "uniform": "u_jitter_amount", "parameter": "jitter" },
{ "uniform": "u_time", "parameter": "time" }
],
"input": [
{ "sampler": "DiffuseSampler", "texture": "native" },
{ "sampler": "ShadowSampler", "texture": "shadow" }
],
"output": "native"
},
{ "effect": "distortion",
"name": "Distortion Pass",
"disablewhen": [
{ "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "curvature", "value": 0.0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "round_corner", "value": 0.0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "smooth_border", "value": 0.0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "vignetting", "value": 0.0 },
{ "type": "slider", "condition": "equal", "combine": "and", "name": "reflection", "value": 0.0 }
],
"uniforms": [
{ "uniform": "u_curvature", "slider": "curvature" },
{ "uniform": "u_round_corner", "slider": "round_corner" },
{ "uniform": "u_smooth_border", "slider": "smooth_border" },
{ "uniform": "u_vignetting", "slider": "vignetting" },
{ "uniform": "u_reflection", "slider": "reflection" }
],
"input": [
{ "sampler": "DiffuseSampler", "texture": "native" }
],
"output": "native"
}
],
"output": "native"

View File

@ -0,0 +1,23 @@
{
"blend": {
"equation": "add",
"srcColor": "srcAlpha",
"dstColor": "1-srcAlpha",
"srcAlpha": "srcAlpha",
"dstAlpha": "1-srcAlpha"
},
"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 ] }
]
}

26
bgfx/effects/defocus.json Normal file
View File

@ -0,0 +1,26 @@
{
"blend": {
"equation": "add",
"srcColor": "srcAlpha",
"dstColor": "1-srcAlpha",
"srcAlpha": "srcAlpha",
"dstAlpha": "1-srcAlpha"
},
"depth": {
"function": "always"
},
"cull": { "mode": "none" },
"write": {
"rgb": "true",
"alpha": "true"
},
"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 ] }
]
}

View File

@ -0,0 +1,29 @@
{
"blend": {
"equation": "add",
"srcColor": "srcAlpha",
"dstColor": "1-srcAlpha",
"srcAlpha": "srcAlpha",
"dstAlpha": "1-srcAlpha"
},
"depth": {
"function": "always"
},
"cull": { "mode": "none" },
"write": {
"rgb": "true",
"alpha": "true"
},
"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": "u_rotation_type", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
]
}

View File

@ -18,8 +18,7 @@
"fragment": "fs_ntsc_decode",
"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_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": [ 3.5795454, 0.0, 0.0, 0.0 ] },

View File

@ -18,8 +18,7 @@
"fragment": "fs_ntsc_encode",
"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_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": [ 3.5795454, 0.0, 0.0, 0.0 ] },

49
bgfx/effects/post.json Normal file
View File

@ -0,0 +1,49 @@
{
"blend": {
"equation": "add",
"srcColor": "srcAlpha",
"dstColor": "1-srcAlpha",
"srcAlpha": "srcAlpha",
"dstAlpha": "1-srcAlpha"
},
"depth": {
"function": "always"
},
"cull": { "mode": "none" },
"write": {
"rgb": "true",
"alpha": "true"
},
"vertex": "vs_post",
"fragment": "fs_post",
"uniforms": [
{ "name": "DiffuseSampler", "type": "int", "values": [ 0.0 ] },
{ "name": "ShadowSampler", "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_shadow_uv_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_prepare_bloom", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_prepare_vector", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_humbar_hertz_rate", "type": "vec4", "values": [ 0.001, 0.0, 0.0, 0.0 ] },
{ "name": "u_humbar_alpha", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_time", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_screen_scale", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
{ "name": "u_screen_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_scanline_alpha", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_scanline_scale", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_scanline_bright_scale", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_scanline_bright_offset", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_scanline_jitter", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_scanline_height", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_back_color", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_shadow_tile_mode", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_shadow_alpha", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "u_shadow_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_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 ] }
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -133,6 +133,7 @@ function osdmodulesbuild()
MAME_DIR .. "src/osd/modules/render/bgfx/entryuniformreader.cpp",
MAME_DIR .. "src/osd/modules/render/bgfx/inputpair.cpp",
MAME_DIR .. "src/osd/modules/render/bgfx/frameparameter.cpp",
MAME_DIR .. "src/osd/modules/render/bgfx/timeparameter.cpp",
MAME_DIR .. "src/osd/modules/render/bgfx/paramreader.cpp",
MAME_DIR .. "src/osd/modules/render/bgfx/paramuniform.cpp",
MAME_DIR .. "src/osd/modules/render/bgfx/shadermanager.cpp",

View File

@ -141,9 +141,10 @@ const options_entry osd_options::s_option_entries[] =
{ OSDOPTION_AUDIO_EFFECT "9", OSDOPTVAL_NONE, OPTION_STRING, "AudioUnit effect 9" },
#endif
{ 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" },
{ 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" },
// End of list
{ nullptr }

View File

@ -80,6 +80,7 @@
#define OSDOPTION_BGFX_PATH "bgfx_path"
#define OSDOPTION_BGFX_SCREEN_CHAIN "screen_chain"
#define OSDOPTION_BGFX_SHADOW_MASK "bgfx_shadow_mask"
//============================================================
// TYPE DEFINITIONS
@ -153,6 +154,7 @@ public:
// BGFX specific options
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); }
private:
static const options_entry s_option_entries[];

View File

@ -235,6 +235,7 @@ public:
virtual void record() { };
virtual void toggle_fsfx() { };
virtual bool sliders_dirty() { return m_sliders_dirty; }
virtual bool multi_window_sliders() { return false; }
static osd_renderer* make_for_type(int mode, osd_window *window, int extra_flags = FLAG_NONE);

View File

@ -8,6 +8,8 @@
#include "emu.h"
#include <bx/timer.h>
#include "slider.h"
#include "parameter.h"
#include "entryuniform.h"
@ -23,6 +25,7 @@ bgfx_chain::bgfx_chain(std::string name, std::string author, std::vector<bgfx_sl
, m_params(params)
, m_entries(entries)
, m_output(output)
, m_current_time(0)
{
for (bgfx_slider* slider : m_sliders)
{
@ -49,22 +52,35 @@ 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)
{
int current_view = view;
for (int index = 0; index < m_entries.size(); index++)
for (bgfx_chain_entry* entry : m_entries)
{
if (!m_entries[index]->skip())
if (!entry->skip())
{
m_entries[index]->submit(prim, current_view, textures, screen_width, screen_height, blend);
entry->submit(prim, current_view, textures, screen_width, screen_height, blend);
current_view++;
}
}
m_current_time = bx::getHPCounter();
static int64_t last = m_current_time;
const int64_t frameTime = m_current_time - last;
last = m_current_time;
const double freq = double(bx::getHPFrequency());
const double toMs = 1000.0 / freq;
const double frameTimeInSeconds = (double)frameTime / 1000000.0;
for (bgfx_parameter* param : m_params)
{
param->tick(frameTimeInSeconds* toMs);
}
}
uint32_t bgfx_chain::applicable_passes()
{
int applicable_passes = 0;
for (int index = 0; index < m_entries.size(); index++)
{
if (!m_entries[index]->skip())
for (bgfx_chain_entry* entry : m_entries)
{
if (!entry->skip())
{
applicable_passes++;
}

View File

@ -43,6 +43,7 @@ private:
std::vector<bgfx_chain_entry*> m_entries;
std::map<std::string, bgfx_slider*> m_slider_map;
std::string m_output;
int64_t m_current_time;
};
#endif // __DRAWBGFX_CHAIN__

View File

@ -58,8 +58,9 @@ void bgfx_chain_entry::submit(render_primitive* prim, int view, texture_manager&
put_screen_buffer(prim, &buffer);
bgfx::setVertexBuffer(&buffer);
bgfx_uniform* screen_rect = m_effect->uniform("u_screenrect");
if (screen_rect != nullptr)
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)
{
float values[2];
float width = screen_width;
@ -69,9 +70,18 @@ void bgfx_chain_entry::submit(render_primitive* prim, int view, texture_manager&
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;
screen_rect->set(values, sizeof(float) * 2);
if (inv_screen_dims != nullptr) {
inv_screen_dims->set(values, sizeof(float) * 2);
}
values[0] = width;
values[1] = height;
if (screen_dims != nullptr) {
screen_dims->set(values, sizeof(float) * 2);
}
}
bgfx_uniform* quad_dims = m_effect->uniform("u_quad_dims");
@ -83,13 +93,16 @@ void bgfx_chain_entry::submit(render_primitive* prim, int view, texture_manager&
quad_dims->set(values, sizeof(float) * 2);
}
bgfx_uniform* guest_dims = m_effect->uniform("u_guest_dims");
if (guest_dims != nullptr)
bgfx_uniform* source_dims = m_effect->uniform("u_source_dims");
if (source_dims != nullptr)
{
float values[2];
values[0] = 1.0f / float(prim->texture.width);
values[1] = 1.0f / float(prim->texture.height);
guest_dims->set(values, sizeof(float) * 2);
values[0] = float(prim->texture.width);
values[1] = float(prim->texture.height);
if (source_dims != nullptr)
{
source_dims->set(values, sizeof(float) * 2);
}
}
for (bgfx_entry_uniform* uniform : m_uniforms)
{

View File

@ -9,6 +9,9 @@
#include <string>
#include "emu.h"
#include "rendutil.h"
#include <modules/lib/osdobj_common.h>
#include "chainentryreader.h"
@ -23,7 +26,7 @@
#include "suppressor.h"
#include "suppressorreader.h"
bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects, std::map<std::string, bgfx_slider*>& sliders, std::map<std::string, bgfx_parameter*>& params)
bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, std::map<std::string, bgfx_slider*>& sliders, std::map<std::string, bgfx_parameter*>& params)
{
validate_parameters(value);
@ -64,6 +67,20 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, textur
}
}
if (value.HasMember("textures"))
{
assert(value["textures"].IsArray());
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 output_name = value["output"].GetString();
if (output_name != std::string("backbuffer"))
{

View File

@ -15,6 +15,7 @@
#include "statereader.h"
class osd_options;
class bgfx_chain_entry;
class texture_manager;
class target_manager;
@ -25,7 +26,7 @@ class bgfx_parameter;
class chain_entry_reader : public state_reader
{
public:
static bgfx_chain_entry* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects, std::map<std::string, bgfx_slider*>& sliders, std::map<std::string, bgfx_parameter*>& params);
static bgfx_chain_entry* read_from_value(const Value& value, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, std::map<std::string, bgfx_slider*>& sliders, std::map<std::string, bgfx_parameter*>& params);
private:
static void validate_parameters(const Value& value);

View File

@ -58,7 +58,7 @@ bgfx_chain* chain_manager::load_chain(std::string name, running_machine& machine
Document document;
document.Parse<0>(data);
bgfx_chain* chain = chain_reader::read_from_value(document, machine, window_index, m_textures, m_targets, m_effects, m_width, m_height);
bgfx_chain* chain = chain_reader::read_from_value(document, m_options, machine, window_index, m_textures, m_targets, m_effects, m_width, m_height);
m_chains[name + std::to_string(window_index)] = chain;

View File

@ -28,7 +28,7 @@ const chain_reader::string_to_enum chain_reader::STYLE_NAMES[chain_reader::STYLE
{ "custom", TARGET_STYLE_CUSTOM }
};
bgfx_chain* chain_reader::read_from_value(const Value& value, running_machine& machine, uint32_t window_index, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t screen_width, uint32_t screen_height)
bgfx_chain* chain_reader::read_from_value(const Value& value, osd_options& options, running_machine& machine, uint32_t window_index, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t screen_width, uint32_t screen_height)
{
validate_parameters(value);
@ -42,7 +42,7 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, running_machine& m
const Value& slider_array = value["sliders"];
for (UINT32 i = 0; i < slider_array.Size(); i++)
{
std::vector<bgfx_slider*> expanded_sliders = slider_reader::read_from_value(slider_array[i], machine);
std::vector<bgfx_slider*> expanded_sliders = slider_reader::read_from_value(slider_array[i], machine, window_index);
for (bgfx_slider* slider : expanded_sliders)
{
sliders.push_back(slider);
@ -129,7 +129,7 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, running_machine& m
const Value& entry_array = value["passes"];
for (UINT32 i = 0; i < entry_array.Size(); i++)
{
entries.push_back(chain_entry_reader::read_from_value(entry_array[i], textures, targets, effects, slider_map, param_map));
entries.push_back(chain_entry_reader::read_from_value(entry_array[i], options, textures, targets, effects, slider_map, param_map));
}
}

Some files were not shown because too many files have changed in this diff Show More