Cleanup in the bgfx aisle, nw

This commit is contained in:
therealmogminer@gmail.com 2016-03-25 18:44:18 +01:00
parent 37a32099cd
commit 22f0c31238
99 changed files with 419 additions and 175 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
//}
//}
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;
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;
gl_FragColor = Output;
}

View File

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

View File

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

View File

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

View File

@ -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()
{

View File

@ -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()
{

View File

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

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

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

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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) }
};

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
//============================================================
//
// suppressor.h - Conditionally suppress a bgfx chain entry
// from being processed.
// from being processed.
//
//============================================================

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
// copyright-holders:Ryan Holtz
//============================================================
//
// timeparameter.cpp - Time-based dynamic shader param
// timeparameter.h - Time-based dynamic shader param
//
//============================================================

View File

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

View File

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

View File

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