try to get some more params working with royale

This commit is contained in:
hunterk 2017-05-03 16:34:58 -05:00
parent 1b0c8ebd43
commit 8590410b30
6 changed files with 20 additions and 22 deletions

View file

@ -39,7 +39,7 @@ const float gba_gamma = 3.5; // Irrelevant but necessary to define.
// Bind option names to shader parameter uniforms or static constants. // Bind option names to shader parameter uniforms or static constants.
#ifdef PARAMETER_UNIFORM #ifdef PARAMETER_UNIFORM
uniform float crt_gamma; /* uniform float crt_gamma;
uniform float lcd_gamma; uniform float lcd_gamma;
uniform float levels_contrast; uniform float levels_contrast;
uniform float halation_weight; uniform float halation_weight;
@ -97,7 +97,7 @@ const float gba_gamma = 3.5; // Irrelevant but necessary to define.
uniform float border_darkness; uniform float border_darkness;
uniform float border_compress; uniform float border_compress;
uniform float interlace_bff; uniform float interlace_bff;
uniform float interlace_1080i; uniform float interlace_1080i; */
#else #else
// Use constants from user-settings.h, and limit ranges appropriately: // Use constants from user-settings.h, and limit ranges appropriately:
const float crt_gamma = max(0.0, crt_gamma_static); const float crt_gamma = max(0.0, crt_gamma_static);
@ -126,7 +126,7 @@ const float gba_gamma = 3.5; // Irrelevant but necessary to define.
const float mask_type = clamp(mask_type_static, 0.0, 2.0); const float mask_type = clamp(mask_type_static, 0.0, 2.0);
const float mask_sample_mode_desired = clamp(mask_sample_mode_static, 0.0, 2.0); const float mask_sample_mode_desired = clamp(mask_sample_mode_static, 0.0, 2.0);
const float mask_specify_num_triads = clamp(mask_specify_num_triads_static, 0.0, 1.0); const float mask_specify_num_triads = clamp(mask_specify_num_triads_static, 0.0, 1.0);
const float mask_triad_size_desired = clamp(mask_triad_size_desired_static, 1.0, 18.0); // const float mask_triad_size_desired = clamp(mask_triad_size_desired_static, 1.0, 18.0);
const float mask_num_triads_desired = clamp(mask_num_triads_desired_static, 342.0, 1920.0); const float mask_num_triads_desired = clamp(mask_num_triads_desired_static, 342.0, 1920.0);
const float aa_subpixel_r_offset_x_runtime = clamp(aa_subpixel_r_offset_static.x, -0.5, 0.5); const float aa_subpixel_r_offset_x_runtime = clamp(aa_subpixel_r_offset_static.x, -0.5, 0.5);
const float aa_subpixel_r_offset_y_runtime = clamp(aa_subpixel_r_offset_static.y, -0.5, 0.5); const float aa_subpixel_r_offset_y_runtime = clamp(aa_subpixel_r_offset_static.y, -0.5, 0.5);

View file

@ -246,9 +246,9 @@ float get_bloom_approx_sigma(const float output_size_x_runtime,
const float mask_num_triads_static = const float mask_num_triads_static =
max(min_allowed_viewport_triads.x, mask_num_triads_desired_static); max(min_allowed_viewport_triads.x, mask_num_triads_desired_static);
const float mask_num_triads_from_size = const float mask_num_triads_from_size =
estimated_viewport_size_x/mask_triad_size_desired; estimated_viewport_size_x/params.mask_triad_size_desired;
const float mask_num_triads_runtime = max(min_allowed_viewport_triads.x, const float mask_num_triads_runtime = max(min_allowed_viewport_triads.x,
mix(mask_num_triads_from_size, mask_num_triads_desired, mix(mask_num_triads_from_size, params.mask_num_triads_desired,
mask_specify_num_triads)); mask_specify_num_triads));
// Assume an extremely large viewport size for asymptotic results: // Assume an extremely large viewport size for asymptotic results:
const float max_viewport_size_x = 1080.0*1024.0*(4.0/3.0); const float max_viewport_size_x = 1080.0*1024.0*(4.0/3.0);
@ -303,7 +303,7 @@ float get_final_bloom_sigma(const float bloom_sigma_runtime)
// Notes: Call this from the fragment shader, NOT the vertex shader, // Notes: Call this from the fragment shader, NOT the vertex shader,
// so static sigmas can be constant-folded! // so static sigmas can be constant-folded!
const float bloom_sigma_optimistic = get_min_sigma_to_blur_triad( const float bloom_sigma_optimistic = get_min_sigma_to_blur_triad(
mask_triad_size_desired_static, bloom_diff_thresh); params.mask_triad_size_desired, bloom_diff_thresh);
#ifdef RUNTIME_PHOSPHOR_BLOOM_SIGMA #ifdef RUNTIME_PHOSPHOR_BLOOM_SIGMA
return bloom_sigma_runtime; return bloom_sigma_runtime;
#else #else

View file

@ -269,9 +269,9 @@ void main()
if(beam_misconvergence == true) if(beam_misconvergence == true)
{ {
const vec2 convergence_offsets_r = get_convergence_offsets_r_vector(); const vec2 convergence_offsets_r = vec2(params.convergence_offset_x_r, params.convergence_offset_y_r);//get_convergence_offsets_r_vector();
const vec2 convergence_offsets_g = get_convergence_offsets_g_vector(); const vec2 convergence_offsets_g = vec2(params.convergence_offset_x_g, params.convergence_offset_y_g);//get_convergence_offsets_g_vector();
const vec2 convergence_offsets_b = get_convergence_offsets_b_vector(); const vec2 convergence_offsets_b = vec2(params.convergence_offset_x_b, params.convergence_offset_y_b);//get_convergence_offsets_b_vector();
tex_uv_r = tex_uv - vec2(params.convergence_offset_x_r, params.convergence_offset_y_r) * uv_scanline_step; tex_uv_r = tex_uv - vec2(params.convergence_offset_x_r, params.convergence_offset_y_r) * uv_scanline_step;
tex_uv_g = tex_uv - vec2(params.convergence_offset_x_g, params.convergence_offset_y_g) * uv_scanline_step; tex_uv_g = tex_uv - vec2(params.convergence_offset_x_g, params.convergence_offset_y_g) * uv_scanline_step;
tex_uv_b = tex_uv - vec2(params.convergence_offset_x_b, params.convergence_offset_y_b) * uv_scanline_step; tex_uv_b = tex_uv - vec2(params.convergence_offset_x_b, params.convergence_offset_y_b) * uv_scanline_step;
@ -350,5 +350,5 @@ void main()
color = vec3(color_r.r, color_g.g, color_b.b); color = vec3(color_r.r, color_g.g, color_b.b);
} }
// Encode and output the blurred image: // Encode and output the blurred image:
FragColor = vec4(color, 1.0); FragColor = vec4(color, 1.0);//vec4(texture(ORIG_LINEARIZED, tex_uv));//
} }

View file

@ -12,7 +12,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
float interlace_bff; float interlace_bff;
} params; } params;
#pragma parameter interlace_bff "interlace_bff" 0.0 0.0 1.0 1.0 #pragma parameter interlace_bff "interlace_bff" 1.0 0.0 1.0 1.0
///////////////////////////// GPL LICENSE NOTICE ///////////////////////////// ///////////////////////////// GPL LICENSE NOTICE /////////////////////////////
@ -94,9 +94,7 @@ if(interlace_detect == true)
Source, tex_uv + v_step).rgb; Source, tex_uv + v_step).rgb;
const vec3 interpolated_line = 0.5 * (last_line + next_line); const vec3 interpolated_line = 0.5 * (last_line + next_line);
// If we're interlacing, determine which field curr_line is in: // If we're interlacing, determine which field curr_line is in:
float interlace_check = 0.0; const float modulus = float(interlaced) + 1.0;
if (interlaced == true) interlace_check = 1.0;
const float modulus = interlace_check + 1.0;
const float field_offset = const float field_offset =
mod(registers.FrameCount + float(params.interlace_bff), modulus); mod(registers.FrameCount + float(params.interlace_bff), modulus);
const float curr_line_texel = tex_uv.y * registers.SourceSize.y; const float curr_line_texel = tex_uv.y * registers.SourceSize.y;

View file

@ -31,7 +31,7 @@ layout(push_constant) uniform Push
////////////////////////////////// INCLUDES ////////////////////////////////// ////////////////////////////////// INCLUDES //////////////////////////////////
#include "../user-settings.h" //#include "../user-settings.h"
#include "derived-settings-and-constants.h" #include "derived-settings-and-constants.h"
#include "bind-shader-params.h" #include "bind-shader-params.h"
#include "scanline-functions.h" #include "scanline-functions.h"
@ -164,7 +164,7 @@ void main()
if(beam_misconvergence == true) if(beam_misconvergence == true)
{ {
const vec3 convergence_offsets_vert_rgb = const vec3 convergence_offsets_vert_rgb =
get_convergence_offsets_y_vector(); vec3(params.convergence_offset_y_r, params.convergence_offset_y_g, params.convergence_offset_y_b);//get_convergence_offsets_y_vector();
dist2 = vec3(dist) - convergence_offsets_vert_rgb; dist2 = vec3(dist) - convergence_offsets_vert_rgb;
} }
// Calculate {sigma, shape}_range outside of scanline_contrib so it's only // Calculate {sigma, shape}_range outside of scanline_contrib so it's only

View file

@ -74,7 +74,7 @@
// Enable runtime shader parameters in the Retroarch (etc.) GUI? They override // Enable runtime shader parameters in the Retroarch (etc.) GUI? They override
// many of the options in this file and allow real-time tuning, but many of // many of the options in this file and allow real-time tuning, but many of
// them are slower. Disabling them and using this text file will boost FPS. // them are slower. Disabling them and using this text file will boost FPS.
//#define RUNTIME_SHADER_PARAMS_ENABLE #define RUNTIME_SHADER_PARAMS_ENABLE
// Specify the phosphor bloom sigma at runtime? This option is 10% slower, but // Specify the phosphor bloom sigma at runtime? This option is 10% slower, but
// it's the only way to do a wide-enough full bloom with a runtime dot pitch. // it's the only way to do a wide-enough full bloom with a runtime dot pitch.
#define RUNTIME_PHOSPHOR_BLOOM_SIGMA #define RUNTIME_PHOSPHOR_BLOOM_SIGMA
@ -172,7 +172,7 @@
// 4 scanlines, max_beam_sigma = 0.5723; distortions begin ~0.70; 134.7 FPS pure; 117.2 FPS generalized // 4 scanlines, max_beam_sigma = 0.5723; distortions begin ~0.70; 134.7 FPS pure; 117.2 FPS generalized
// 5 scanlines, max_beam_sigma = 0.7591; distortions begin ~0.89; 131.6 FPS pure; 112.1 FPS generalized // 5 scanlines, max_beam_sigma = 0.7591; distortions begin ~0.89; 131.6 FPS pure; 112.1 FPS generalized
// 6 scanlines, max_beam_sigma = 0.9483; distortions begin ~1.08; 127.9 FPS pure; 105.6 FPS generalized // 6 scanlines, max_beam_sigma = 0.9483; distortions begin ~1.08; 127.9 FPS pure; 105.6 FPS generalized
// const float beam_num_scanlines = 3.0; // range [2, 6] const float beam_num_scanlines = 3.0; // range [2, 6]
// A generalized Gaussian beam varies shape with color too, now just width. // A generalized Gaussian beam varies shape with color too, now just width.
// It's slower but more flexible (static option only for now). // It's slower but more flexible (static option only for now).
bool beam_generalized_gaussian = true; bool beam_generalized_gaussian = true;
@ -218,9 +218,9 @@
bool beam_misconvergence = true; bool beam_misconvergence = true;
// Convergence offsets in x/y directions for R/G/B scanline beams in units // Convergence offsets in x/y directions for R/G/B scanline beams in units
// of scanlines. Positive offsets go right/down; ranges [-2, 2] // of scanlines. Positive offsets go right/down; ranges [-2, 2]
const vec2 convergence_offsets_r_static = vec2(0.1, 0.2); const vec2 convergence_offsets_r_static = vec2(0.0, 0.0);
const vec2 convergence_offsets_g_static = vec2(0.3, 0.4); const vec2 convergence_offsets_g_static = vec2(0.0, 0.0);
const vec2 convergence_offsets_b_static = vec2(0.5, 0.6); const vec2 convergence_offsets_b_static = vec2(0.0, 0.0);
// Detect interlacing (static option only for now)? // Detect interlacing (static option only for now)?
bool interlace_detect = true; bool interlace_detect = true;
// Assume 1080-line sources are interlaced? // Assume 1080-line sources are interlaced?
@ -280,7 +280,7 @@
// To increase the size limit, double the viewport-relative scales for the // To increase the size limit, double the viewport-relative scales for the
// two MASK_RESIZE passes in crt-royale.cgp and user-cgp-contants.h. // two MASK_RESIZE passes in crt-royale.cgp and user-cgp-contants.h.
// range [1, mask_texture_small_size/mask_triads_per_tile] // range [1, mask_texture_small_size/mask_triads_per_tile]
const float mask_triad_size_desired_static = 24.0 / 8.0; // const float mask_triad_size_desired_static = 24.0 / 8.0;
// If mask_specify_num_triads is 1.0/true, we'll go by this instead (the // If mask_specify_num_triads is 1.0/true, we'll go by this instead (the
// final size will be rounded and constrained as above); default 480.0 // final size will be rounded and constrained as above); default 480.0
const float mask_num_triads_desired_static = 480.0; const float mask_num_triads_desired_static = 480.0;