-bgfx: Added default LUT PNG, fixes LUT-effect crash. Fixed external texture loading, restoring HQx filters. [Ryan Holtz] (#9401)

This commit is contained in:
MooglyGuy 2022-03-13 02:30:02 +01:00 committed by GitHub
parent 7b1512ce9e
commit 1ad39cb5dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 14 additions and 20 deletions

BIN
artwork/lut-default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

View File

@ -19,14 +19,9 @@
"vertex": "chains/misc/vs_lut",
"fragment": "chains/misc/fs_lut",
"uniforms": [
{
"name": "s_tex",
"type": "int",
"values": [ 1.0 ]
}, {
"name": "s_3dlut",
"type": "int",
"values": [ 1.0 ]
}
{ "name": "s_tex", "type": "int", "values": [ 1.0 ] },
{ "name": "s_3dlut", "type": "int", "values": [ 1.0 ] },
{ "name": "u_tex_size1", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] },
{ "name": "u_inv_tex_size1", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }
]
}

View File

@ -159,7 +159,7 @@ const options_entry osd_options::s_option_entries[] =
{ OSDOPTION_BGFX_DEBUG, "0", OPTION_BOOLEAN, "enable BGFX debugging statistics" },
{ OSDOPTION_BGFX_SCREEN_CHAINS, "default", OPTION_STRING, "comma-delimited list of screen chain JSON names, colon-delimited per-window" },
{ OSDOPTION_BGFX_SHADOW_MASK, "slot-mask.png", OPTION_STRING, "shadow mask texture name" },
{ OSDOPTION_BGFX_LUT, "", OPTION_STRING, "LUT texture name" },
{ OSDOPTION_BGFX_LUT, "lut-default.png", OPTION_STRING, "LUT texture name" },
{ OSDOPTION_BGFX_AVI_NAME, OSDOPTVAL_AUTO, OPTION_STRING, "filename for BGFX output logging" },
// End of list

View File

@ -5,9 +5,9 @@ $input v_color0, v_texcoord0
#include "common.sh"
#define LUT_TEXTURE_WIDTH 4096.0f
#define LUT_SIZE 64.0f
#define LUT_SCALE vec2(1.0f / LUT_TEXTURE_WIDTH, 1.0f / LUT_SIZE)
// Autos
uniform vec4 u_tex_size1;
uniform vec4 u_inv_tex_size1;
SAMPLER2D(s_tex, 0);
SAMPLER2D(s_3dlut, 1);
@ -17,13 +17,12 @@ void main()
vec4 bp = texture2D(s_tex, v_texcoord0);
vec3 color = bp.rgb;
// NOTE: Do not change the order of parameters here.
vec3 lutcoord = vec3(color.rg * ((LUT_SIZE - 1.0f) + 0.5f) *
LUT_SCALE, (LUT_SIZE - 1.0f) * color.b);
vec3 lutcoord = vec3(color.rg * ((u_tex_size1.y - 1.0) + 0.5) * u_inv_tex_size1.xy, (u_tex_size1.y - 1.0) * color.b);
float shift = floor(lutcoord.z);
lutcoord.x += shift * LUT_SCALE.y;
lutcoord.x += shift * u_inv_tex_size1.y;
color.rgb = mix(texture2D(s_3dlut, lutcoord.xy).rgb,
texture2D(s_3dlut, vec2(lutcoord.x + LUT_SCALE.y,
texture2D(s_3dlut, vec2(lutcoord.x + u_inv_tex_size1.y,
lutcoord.y)).rgb, lutcoord.z - shift);
gl_FragColor = vec4(color, bp.a) * v_color0;
}

View File

@ -81,7 +81,7 @@ bgfx_texture* texture_manager::create_png_texture(std::string path, std::string
auto* base = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(0));
for (int y = 0; y < height; y++)
{
copy_util::copyline_argb32(data32 + y * width, base + y * rowpixels, width, nullptr);
copy_util::copyline_argb32_to_bgra(data32 + y * width, base + y * rowpixels, width, nullptr);
}
if (screen >= 0)

View File

@ -262,9 +262,9 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.04", OPTION_FLOAT, "bloom level 6 weight (1/4 smaller that level 5 target)" },
{ WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.02", OPTION_FLOAT, "bloom level 7 weight (1/4 smaller that level 6 target)" },
{ WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.01", OPTION_FLOAT, "bloom level 8 weight (1/4 smaller that level 7 target)" },
{ WINOPTION_LUT_TEXTURE, "", OPTION_STRING, "3D LUT texture filename for screen, PNG format" },
{ WINOPTION_LUT_TEXTURE, "lut-default.png", OPTION_STRING, "3D LUT texture filename for screen, PNG format" },
{ WINOPTION_LUT_ENABLE, "0", OPTION_BOOLEAN, "Enables 3D LUT to be applied to screen after post-processing" },
{ WINOPTION_UI_LUT_TEXTURE, "", OPTION_STRING, "3D LUT texture filename of UI, PNG format" },
{ WINOPTION_UI_LUT_TEXTURE, "lut-default.png", OPTION_STRING, "3D LUT texture filename of UI, PNG format" },
{ WINOPTION_UI_LUT_ENABLE, "0", OPTION_BOOLEAN, "enable 3D LUT to be applied to UI and artwork after post-processing" },
// full screen options