mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
More bgfx HLSL fixups, nw
This commit is contained in:
parent
e1883e3090
commit
493cf7289b
@ -7,7 +7,6 @@
|
||||
{ "type": "float", "name": "a_value", "text": "NTSC A Value", "default": 50, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "b_value", "text": "NTSC B Value", "default": 50, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "cc_value", "text": "NTSC Color Carrier (Hz)", "default": 35795454, "max": 36795454, "min": 34795454, "step": 100, "scale": 0.0000001, "format": "%1.7f", "screen": "raster" },
|
||||
{ "type": "float", "name": "o_value", "text": "NTSC Time Offset", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "p_value", "text": "NTSC Phase Offset", "default": 100, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "scan_time", "text": "NTSC Scanline Duration (uSec)", "default": 526, "max": 1500, "min": 1, "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "float", "name": "notch_width", "text": "NTSC Color Notch Filter Width", "default": 100, "max": 400, "min": 1, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
@ -46,8 +45,8 @@
|
||||
{ "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": "float", "name": "humbar_alpha", "text": "Hum Bar Amount", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 100, "max": 10000, "min": 0, "step": 1, "scale": 0.00001, "format": "%1.7f", "screen": "crt" },
|
||||
{ "type": "color", "name": "floor", "text": "Signal Floor, ", "default": [ 0, 0, 0 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "color", "name": "power", "text": "Signal Exponent, ", "default": [ 100, 100, 100 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
|
||||
@ -116,7 +115,6 @@
|
||||
{ "uniform": "u_a_value", "slider": "a_value" },
|
||||
{ "uniform": "u_b_value", "slider": "b_value" },
|
||||
{ "uniform": "u_cc_value", "slider": "cc_value" },
|
||||
{ "uniform": "u_o_value", "slider": "o_value" },
|
||||
{ "uniform": "u_scan_time", "slider": "scan_time" },
|
||||
{ "uniform": "u_notch_width", "slider": "notch_width" },
|
||||
{ "uniform": "u_y_freq_response", "slider": "y_freq_response" },
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
@ -19,10 +19,10 @@
|
||||
"uniforms": [
|
||||
{ "name": "DiffuseSampler", "type": "int", "values": [ 1.0 ] },
|
||||
{ "name": "u_source_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_a_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_b_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_cc_value", "type": "vec4", "values": [ 3.5795454, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_o_value", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_a_value", "type": "vec4", "values": [ 0.5, 0.5, 0.5, 0.5 ] },
|
||||
{ "name": "u_b_value", "type": "vec4", "values": [ 0.5, 0.5, 0.5, 0.5 ] },
|
||||
{ "name": "u_cc_value", "type": "vec4", "values": [ 3.5795454, 3.5795454, 3.5795454, 3.5795454 ] },
|
||||
{ "name": "u_o_value", "type": "vec4", "values": [ 1.570796325, 1.570796325, 1.570796325, 1.570796325 ] },
|
||||
{ "name": "u_scan_time", "type": "vec4", "values": [ 52.6, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_notch_width", "type": "vec4", "values": [ 2.0, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_y_freq_response", "type": "vec4", "values": [ 6.0, 0.0, 0.0, 0.0 ] },
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
@ -21,8 +21,8 @@
|
||||
{ "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 ] },
|
||||
{ "name": "u_p_value", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_cc_value", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_p_value", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_scan_time", "type": "vec4", "values": [ 52.6, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_jitter_amount", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "u_jitter_offset", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"blend": {
|
||||
"equation": "add",
|
||||
"srcColor": "srcAlpha",
|
||||
"dstColor": "1-srcAlpha",
|
||||
"srcAlpha": "srcAlpha",
|
||||
"dstAlpha": "1-srcAlpha"
|
||||
"srcColor": "1",
|
||||
"dstColor": "0",
|
||||
"srcAlpha": "1",
|
||||
"dstAlpha": "0"
|
||||
},
|
||||
"depth": {
|
||||
"function": "always"
|
||||
|
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.
@ -24,12 +24,13 @@
|
||||
#include "vertex.h"
|
||||
#include "suppressor.h"
|
||||
|
||||
bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair> inputs, std::vector<bgfx_entry_uniform*> uniforms, bgfx_target* output)
|
||||
bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output)
|
||||
: m_name(name)
|
||||
, m_effect(effect)
|
||||
, m_suppressors(suppressors)
|
||||
, m_inputs(inputs)
|
||||
, m_uniforms(uniforms)
|
||||
, m_targets(targets)
|
||||
, m_output(output)
|
||||
{
|
||||
}
|
||||
@ -104,16 +105,20 @@ void bgfx_chain_entry::submit(render_primitive* prim, int view, texture_manager&
|
||||
source_dims->set(values, sizeof(float) * 2);
|
||||
}
|
||||
}
|
||||
|
||||
for (bgfx_entry_uniform* uniform : m_uniforms)
|
||||
{
|
||||
if (uniform->name() != "DiffuseSampler")
|
||||
{
|
||||
uniform->bind();
|
||||
}
|
||||
}
|
||||
|
||||
m_effect->submit(view, blend);
|
||||
|
||||
if (m_output != nullptr)
|
||||
if (m_targets.target(m_output) != nullptr)
|
||||
{
|
||||
m_output->page_flip();
|
||||
m_targets.target(m_output)->page_flip();
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,11 +127,12 @@ void bgfx_chain_entry::setup_view(int view, uint16_t screen_width, uint16_t scre
|
||||
bgfx::FrameBufferHandle handle = BGFX_INVALID_HANDLE;
|
||||
uint16_t width = screen_width;
|
||||
uint16_t height = screen_height;
|
||||
if (m_output != nullptr)
|
||||
if (m_targets.target(m_output) != nullptr)
|
||||
{
|
||||
handle = m_output->target();
|
||||
width = m_output->width();
|
||||
height = m_output->height();
|
||||
bgfx_target* output = m_targets.target(m_output);
|
||||
handle = output->target();
|
||||
width = output->width();
|
||||
height = output->height();
|
||||
}
|
||||
|
||||
bgfx::setViewFrameBuffer(view, handle);
|
||||
@ -136,7 +142,7 @@ void bgfx_chain_entry::setup_view(int view, uint16_t screen_width, uint16_t scre
|
||||
bx::mtxIdentity(viewMat);
|
||||
|
||||
float projMat[16];
|
||||
bx::mtxOrtho(projMat, 0.0f, width, height, 0.0f, 0.0f, 100.0f);
|
||||
bx::mtxOrtho(projMat, 0.0f, screen_width, screen_height, 0.0f, 0.0f, 100.0f);
|
||||
bgfx::setViewTransform(view, viewMat, projMat);
|
||||
|
||||
bgfx::setViewClear(view, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x000000ff, 1.0f, 0);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "inputpair.h"
|
||||
#include "targetmanager.h"
|
||||
|
||||
class render_primitive;
|
||||
class bgfx_effect;
|
||||
@ -27,18 +28,19 @@ class bgfx_target;
|
||||
class bgfx_entry_uniform;
|
||||
class bgfx_suppressor;
|
||||
class texture_manager;
|
||||
class target_manager;
|
||||
|
||||
class bgfx_chain_entry
|
||||
{
|
||||
public:
|
||||
bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair> inputs, std::vector<bgfx_entry_uniform*> uniforms, bgfx_target* output);
|
||||
bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output);
|
||||
~bgfx_chain_entry();
|
||||
|
||||
void submit(render_primitive* prim, int view, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint64_t blend);
|
||||
|
||||
// Getters
|
||||
std::string name() const { return m_name; }
|
||||
bgfx_target* target() const { return m_output; }
|
||||
bgfx_target* target() const { return m_targets.target(m_output); }
|
||||
bool skip();
|
||||
|
||||
private:
|
||||
@ -50,7 +52,8 @@ private:
|
||||
std::vector<bgfx_suppressor*> m_suppressors;
|
||||
std::vector<bgfx_input_pair> m_inputs;
|
||||
std::vector<bgfx_entry_uniform*> m_uniforms;
|
||||
bgfx_target* m_output;
|
||||
target_manager& m_targets;
|
||||
std::string m_output;
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_CHAIN_ENTRY__
|
||||
|
@ -84,11 +84,11 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, osd_op
|
||||
std::string output_name = value["output"].GetString();
|
||||
if (output_name != std::string("backbuffer"))
|
||||
{
|
||||
return new bgfx_chain_entry(value["name"].GetString(), effect, suppressors, inputs, uniforms, targets.target(output_name));
|
||||
return new bgfx_chain_entry(value["name"].GetString(), effect, suppressors, inputs, uniforms, targets, output_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new bgfx_chain_entry(value["name"].GetString(), effect, suppressors, inputs, uniforms, nullptr);
|
||||
return new bgfx_chain_entry(value["name"].GetString(), effect, suppressors, inputs, uniforms, targets, "none");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,9 +84,9 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, osd_options& optio
|
||||
{
|
||||
assert(target_array[i].HasMember("name"));
|
||||
assert(target_array[i]["name"].IsString());
|
||||
uint32_t mode = uint32_t(get_enum_from_value(value, "mode", TARGET_STYLE_NATIVE, STYLE_NAMES, STYLE_COUNT));
|
||||
bool bilinear = get_bool(target_array[i], "bilinear", false);
|
||||
bool double_buffer = get_bool(target_array[i], "doublebuffer", false);
|
||||
uint32_t mode = uint32_t(get_enum_from_value(target_array[i], "mode", TARGET_STYLE_NATIVE, STYLE_NAMES, STYLE_COUNT));
|
||||
bool bilinear = get_bool(target_array[i], "bilinear", true);
|
||||
bool double_buffer = get_bool(target_array[i], "doublebuffer", true);
|
||||
|
||||
float prescalef = 1.0f;
|
||||
float default_prescale = 1.0f;
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
virtual ~bgfx_entry_uniform() { }
|
||||
|
||||
virtual void bind() = 0;
|
||||
std::string name() const { return m_uniform->name(); }
|
||||
|
||||
protected:
|
||||
bgfx_uniform* m_uniform;
|
||||
|
@ -24,9 +24,6 @@ uniform vec4 u_saturation;
|
||||
#define Scale u_scale.xyz
|
||||
#define Saturation u_saturation.x
|
||||
|
||||
uniform vec4 u_texsize;
|
||||
uniform vec4 u_screenrect;
|
||||
|
||||
SAMPLER2D(DiffuseSampler, 0);
|
||||
|
||||
void main()
|
||||
|
@ -28,7 +28,7 @@ SAMPLER2D(DiffuseSampler, 0);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 PValueSourceTexel = vec2(u_p_value.x, 0.0) * u_source_dims.xy;
|
||||
vec2 PValueSourceTexel = vec2(u_p_value.x, 0.0) / u_source_dims.xy;
|
||||
|
||||
vec2 C0 = v_texcoord0 + PValueSourceTexel * vec2(0.0, 0.0);
|
||||
vec2 C1 = v_texcoord0 + PValueSourceTexel * vec2(0.25, 0.0);
|
||||
@ -41,6 +41,9 @@ void main()
|
||||
vec4 Texel2 = texture2D(DiffuseSampler, C2);
|
||||
vec4 Texel3 = texture2D(DiffuseSampler, C3);
|
||||
|
||||
vec4 HPosition = Cx;
|
||||
vec4 VPosition = Cy;
|
||||
|
||||
const vec4 YDot = vec4(0.299, 0.587, 0.114, 0.0);
|
||||
const vec4 IDot = vec4(0.595716, -0.274453, -0.321263, 0.0);
|
||||
const vec4 QDot = vec4(0.211456, -0.522591, 0.311135, 0.0);
|
||||
@ -48,18 +51,17 @@ void main()
|
||||
vec4 I = vec4(dot(Texel0, IDot), dot(Texel1, IDot), dot(Texel2, IDot), dot(Texel3, IDot));
|
||||
vec4 Q = vec4(dot(Texel0, QDot), dot(Texel1, QDot), dot(Texel2, QDot), dot(Texel3, QDot));
|
||||
|
||||
const vec4 PI = vec4(3.1415927, 3.1415927, 3.1415927, 3.1415927);
|
||||
const vec4 PI2 = vec4(6.2831854, 6.2831854, 6.2831854, 6.2831854);
|
||||
vec4 W = PI2 * u_cc_value.xxxx * u_scan_time.xxxx;
|
||||
vec4 WoPI = W / PI;
|
||||
const float PI = 3.1415927;
|
||||
const float PI2 = 6.2831854;
|
||||
|
||||
vec4 HOffset = (u_b_value.xxxx + u_jitter_amount.xxxx * u_jitter_offset.xxxx) / WoPI;
|
||||
vec4 VScale = (u_a_value.xxxx * u_source_dims.yyyy) / WoPI;
|
||||
float W = PI2 * u_cc_value.x * u_scan_time.x;
|
||||
float WoPI = W / PI;
|
||||
|
||||
vec4 T = Cx + HOffset + Cy * VScale;
|
||||
float HOffset = (u_a_value.x + u_jitter_amount.x * u_jitter_offset.x) / WoPI;
|
||||
float VScale = (u_b_value.x * u_source_dims.y) / WoPI;
|
||||
|
||||
vec4 T = Cx + vec4(HOffset, HOffset, HOffset, HOffset) + Cy * vec4(VScale, VScale, VScale, VScale);
|
||||
vec4 TW = T * W;
|
||||
|
||||
vec4 output_rgb = Y + I * cos(TW) + Q * sin(TW);
|
||||
|
||||
gl_FragColor = vec4(output_rgb.xyz, 1.0);
|
||||
gl_FragColor = Y + I * cos(TW) + Q * sin(TW);
|
||||
}
|
@ -22,7 +22,7 @@ bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uin
|
||||
, m_page_count(double_buffer ? 2 : 1)
|
||||
{
|
||||
uint32_t wrap_mode = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP;
|
||||
uint32_t filter_mode = filter ? 0 : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT);
|
||||
uint32_t filter_mode = filter ? (BGFX_TEXTURE_MIN_ANISOTROPIC | BGFX_TEXTURE_MAG_ANISOTROPIC) : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT);
|
||||
|
||||
m_textures = new bgfx::TextureHandle[m_page_count];
|
||||
m_targets = new bgfx::FrameBufferHandle[m_page_count];
|
||||
|
@ -58,19 +58,20 @@ void target_manager::update_guest_targets(uint16_t width, uint16_t height)
|
||||
{
|
||||
m_guest_width = width;
|
||||
m_guest_height = height;
|
||||
std::vector<bgfx_target*> to_resize;
|
||||
for (std::pair<std::string, bgfx_target*> target : m_targets)
|
||||
{
|
||||
if ((target.second)->style() == TARGET_STYLE_GUEST)
|
||||
{
|
||||
to_resize.push_back(target.second);
|
||||
}
|
||||
}
|
||||
bgfx_target* target_ptr = target.second;
|
||||
std::string name = target_ptr->name();
|
||||
const bgfx::TextureFormat::Enum format = target_ptr->format();
|
||||
const bool double_buffered = target_ptr->double_buffered();
|
||||
const bool filter = target_ptr->filter();
|
||||
delete target_ptr;
|
||||
|
||||
for (bgfx_target* target : to_resize)
|
||||
{
|
||||
m_targets[target->name()] = new bgfx_target(target->name(), target->format(), width, height, TARGET_STYLE_GUEST, target->double_buffered(), target->filter());
|
||||
delete target;
|
||||
target.second = new bgfx_target(name, format, width, height, TARGET_STYLE_GUEST, double_buffered, filter);
|
||||
m_textures.add_provider(name, target.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,17 @@ texture_manager::~texture_manager()
|
||||
}
|
||||
|
||||
void texture_manager::add_provider(std::string name, bgfx_texture_handle_provider* provider)
|
||||
{
|
||||
std::map<std::string, bgfx_texture_handle_provider*>::iterator iter = m_textures.find(name);
|
||||
if (iter != m_textures.end())
|
||||
{
|
||||
iter->second = provider;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textures[name] = provider;
|
||||
}
|
||||
}
|
||||
|
||||
bgfx_texture* texture_manager::create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data, uint32_t flags)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user