Advertisement
Guest User

CRT-Royale Custom Settings (NVidia)

a guest
Jul 14th, 2014
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.96 KB | None | 0 0
  1. #ifndef USER_SETTINGS_H
  2. #define USER_SETTINGS_H
  3.  
  4. ///////////////////////////// DRIVER CAPABILITIES ////////////////////////////
  5.  
  6. // The Cg compiler uses different "profiles" with different capabilities.
  7. // This shader requires a Cg compilation profile >= arbfp1, but a few options
  8. // require higher profiles like fp30 or fp40. The shader can't detect profile
  9. // or driver capabilities, so instead you must comment or uncomment the lines
  10. // below with "//" before "#define." Disable an option if you get compilation
  11. // errors resembling those listed. Generally speaking, all of these options
  12. // will run on nVidia cards, but only DRIVERS_ALLOW_TEX2DBIAS (if that) is
  13. // likely to run on ATI/AMD, due to the Cg compiler's profile limitations.
  14.  
  15. // Derivatives: Unsupported on fp20, ps_1_1, ps_1_2, ps_1_3, and arbfp1.
  16. // Among other things, derivatives help us fix anisotropic filtering artifacts
  17. // with curved manually tiled phosphor mask coords. Related errors:
  18. // error C3004: function "float2 ddx(float2);" not supported in this profile
  19. // error C3004: function "float2 ddy(float2);" not supported in this profile
  20. #define DRIVERS_ALLOW_DERIVATIVES
  21.  
  22. // Fine derivatives: Unsupported on older ATI cards.
  23. // Fine derivatives enable 2x2 fragment block communication, letting us perform
  24. // fast single-pass blur operations. If your card uses coarse derivatives and
  25. // these are enabled, blurs could look broken. Derivatives are a prerequisite.
  26. #ifdef DRIVERS_ALLOW_DERIVATIVES
  27. #define DRIVERS_ALLOW_FINE_DERIVATIVES
  28. #endif
  29.  
  30. // Dynamic looping: Requires an fp30 or newer profile.
  31. // This makes phosphor mask resampling faster in some cases. Related errors:
  32. // error C5013: profile does not support "for" statements and "for" could not
  33. // be unrolled
  34. #define DRIVERS_ALLOW_DYNAMIC_BRANCHES
  35.  
  36. // Without DRIVERS_ALLOW_DYNAMIC_BRANCHES, we need to use unrollable loops.
  37. // Using one static loop avoids overhead if the user is right, but if the user
  38. // is wrong (loops are allowed), breaking a loop into if-blocked pieces with a
  39. // binary search can potentially save some iterations. However, it may fail:
  40. // error C6001: Temporary register limit of 32 exceeded; 35 registers
  41. // needed to compile program
  42. #define ACCOMODATE_POSSIBLE_DYNAMIC_LOOPS
  43.  
  44. // tex2Dlod: Requires an fp40 or newer profile. This can be used to disable
  45. // anisotropic filtering, thereby fixing related artifacts. Related errors:
  46. // error C3004: function "float4 tex2Dlod(sampler2D, float4);" not supported in
  47. // this profile
  48. #define DRIVERS_ALLOW_TEX2DLOD
  49.  
  50. // tex2Dbias: Requires an fp30 or newer profile. This can be used to alleviate
  51. // artifacts from anisotropic filtering and mipmapping. Related errors:
  52. // error C3004: function "float4 tex2Dbias(sampler2D, float4);" not supported
  53. // in this profile
  54. #define DRIVERS_ALLOW_TEX2DBIAS
  55.  
  56.  
  57. //////////////////////////// USER CODEPATH OPTIONS ///////////////////////////
  58.  
  59. // To disable a #define option, turn its line into a comment with "//."
  60.  
  61. // RUNTIME VS. COMPILE-TIME OPTIONS (Major Performance Implications):
  62. // Enable runtime shader parameters in the Retroarch (etc.) GUI? They override
  63. // many of the options in this file and allow real-time tuning, but many of
  64. // them are slower. Disabling them and using this text file will boost FPS.
  65. //#define RUNTIME_SHADER_PARAMS_ENABLE
  66. // Specify the phosphor bloom sigma at runtime? This option is 10% slower, but
  67. // it's the only way to do a wide-enough full bloom with a runtime dot pitch.
  68. #define RUNTIME_PHOSPHOR_BLOOM_SIGMA
  69. // Specify antialiasing weight parameters at runtime? (Costs ~20% with cubics)
  70. #define RUNTIME_ANTIALIAS_WEIGHTS
  71. // Specify subpixel offsets at runtime? (WARNING: EXTREMELY EXPENSIVE!)
  72. //#define RUNTIME_ANTIALIAS_SUBPIXEL_OFFSETS
  73. // Make beam_horiz_filter and beam_horiz_linear_rgb_weight into runtime shader
  74. // parameters? This will require more math or dynamic branching.
  75. #define RUNTIME_SCANLINES_HORIZ_FILTER_COLORSPACE
  76. // Specify the tilt at runtime? This makes things about 3% slower.
  77. #define RUNTIME_GEOMETRY_TILT
  78. // Specify the geometry mode at runtime?
  79. #define RUNTIME_GEOMETRY_MODE
  80. // Specify the phosphor mask type (aperture grille, slot mask, shadow mask) and
  81. // mode (Lanczos-resize, hardware resize, or tile 1:1) at runtime, even without
  82. // dynamic branches? This is cheap if mask_resize_viewport_scale is small.
  83. #define FORCE_RUNTIME_PHOSPHOR_MASK_MODE_TYPE_SELECT
  84.  
  85. // PHOSPHOR MASK:
  86. // Manually resize the phosphor mask for best results (slower)? Disabling this
  87. // removes the option to do so, but it may be faster without dynamic branches.
  88. #define PHOSPHOR_MASK_MANUALLY_RESIZE
  89. // If we sinc-resize the mask, should we Lanczos-window it (slower but better)?
  90. #define PHOSPHOR_MASK_RESIZE_LANCZOS_WINDOW
  91. // Larger blurs are expensive, but we need them to blur larger triads. We can
  92. // detect the right blur if the triad size is static or our profile allows
  93. // dynamic branches, but otherwise we use the largest blur the user indicates
  94. // they might need:
  95. #define PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_3_PIXELS
  96. //#define PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_6_PIXELS
  97. //#define PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_9_PIXELS
  98. //#define PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_12_PIXELS
  99. // Here's a helpful chart:
  100. // MaxTriadSize BlurSize MinTriadCountsByResolution
  101. // 3.0 9.0 480/640/960/1920 triads at 1080p/1440p/2160p/4320p, 4:3 aspect
  102. // 6.0 17.0 240/320/480/960 triads at 1080p/1440p/2160p/4320p, 4:3 aspect
  103. // 9.0 25.0 160/213/320/640 triads at 1080p/1440p/2160p/4320p, 4:3 aspect
  104. // 12.0 31.0 120/160/240/480 triads at 1080p/1440p/2160p/4320p, 4:3 aspect
  105. // 18.0 43.0 80/107/160/320 triads at 1080p/1440p/2160p/4320p, 4:3 aspect
  106.  
  107.  
  108. /////////////////////////////// USER PARAMETERS //////////////////////////////
  109.  
  110. // Note: Many of these static parameters are overridden by runtime shader
  111. // parameters when those are enabled. However, many others are static codepath
  112. // options that were cleaner or more convert to code as static constants.
  113.  
  114. // GAMMA:
  115. static const float crt_gamma_static = 2.5; // range [1, 5]
  116. static const float lcd_gamma_static = 2.2; // range [1, 5]
  117.  
  118. // LEVELS MANAGEMENT:
  119. // Control the final multiplicative image contrast:
  120. static const float levels_contrast_static = 1.0; // range [0, 4)
  121. // Underestimate brightness: Bright areas bloom more, but we can base the
  122. // bloom brightpass on a lower brightness to sharpen phosphors. Low values
  123. // clip more, but >= 0.8 leaves colors mostly undistorted.
  124. static const float levels_underestimate_static = 0.8; // range [0, 1]
  125. // We auto-dim to avoid clipping between passes and restore brightness
  126. // later. Control the dim factor here: Lower values clip less but crush
  127. // blacks more (static only for now).
  128. static const float levels_autodim_temp = 0.5; // range (0, 1]
  129.  
  130. // HALATION/DIFFUSION/BLOOM:
  131. // Halation weight: How much energy should be lost to electrons bounding
  132. // around under the CRT glass and exciting random phosphors?
  133. static const float halation_weight_static = 0.0; // range [0, 1]
  134. // Refractive diffusion weight: How much light should spread/diffuse from
  135. // refracting through the CRT glass?
  136. static const float diffusion_weight_static = 0.0; // range [0, 1] default [0.75]
  137. // Bloom dimmer colors more than necessary for a softer phosphor bloom?
  138. static const float bloom_excess_static = 0.25; // range [0, 1] default [0.0]
  139. // The BLOOM_APPROX pass approximates a phosphor blur early on with a small
  140. // blurred resize of the input (convergence offsets are applied as well).
  141. // There are three filter options (static option only for now):
  142. // 0.) Bilinear resize: A fast, close approximation to a 4x4 resize
  143. // if min_allowed_viewport_triads and the BLOOM_APPROX resolution are sane
  144. // and beam_max_sigma is low.
  145. // 1.) 3x3 resize blur: Medium speed, soft/smeared from bilinear blurring,
  146. // always uses a static sigma regardless of beam_max_sigma or
  147. // mask_num_triads_desired.
  148. // 2.) True 4x4 Gaussian resize: Slowest, technically correct.
  149. // These options are more pronounced for the fast, unbloomed shader version.
  150. static const float bloom_approx_filter = 2.0;
  151.  
  152. // ELECTRON BEAM SCANLINE DISTRIBUTION:
  153. // How many scanlines should contribute light to each pixel? Using more
  154. // scanlines is slower (especially for a generalized Gaussian) but less
  155. // distorted with larger beam sigmas (especially for a pure Gaussian). The
  156. // max_beam_sigma at which the closest unused weight is guaranteed <
  157. // 1.0/255.0 (for a 3x antialiased pure Gaussian) is:
  158. // 2 scanlines: max_beam_sigma = 0.2089; distortions begin ~0.34; 141.7 FPS pure, 131.9 FPS generalized
  159. // 3 scanlines, max_beam_sigma = 0.3879; distortions begin ~0.52; 137.5 FPS pure; 123.8 FPS generalized
  160. // 4 scanlines, max_beam_sigma = 0.5723; distortions begin ~0.70; 134.7 FPS pure; 117.2 FPS generalized
  161. // 5 scanlines, max_beam_sigma = 0.7591; distortions begin ~0.89; 131.6 FPS pure; 112.1 FPS generalized
  162. // 6 scanlines, max_beam_sigma = 0.9483; distortions begin ~1.08; 127.9 FPS pure; 105.6 FPS generalized
  163. static const float beam_num_scanlines = 3.0; // range [2, 6]
  164. // A generalized Gaussian beam varies shape with color too, now just width.
  165. // It's slower but more flexible (static option only for now).
  166. static const bool beam_generalized_gaussian = true;
  167. // What kind of scanline antialiasing do you want?
  168. // 0: Sample weights at 1x; 1: Sample weights at 3x; 2: Compute an integral
  169. // Integrals are slow (especially for generalized Gaussians) and rarely any
  170. // better than 3x antialiasing (static option only for now).
  171. static const float beam_antialias_level = 1.0; // range [0, 2]
  172. // Min/max standard deviations for scanline beams: Higher values widen and
  173. // soften scanlines. Depending on other options, low min sigmas can alias.
  174. static const float beam_min_sigma_static = 0.02; // range (0, 1]
  175. static const float beam_max_sigma_static = 0.3; // range (0, 1]
  176. // Beam width varies as a function of color: A power function (0) is more
  177. // configurable, but a spherical function (1) gives the widest beam
  178. // variability without aliasing (static option only for now).
  179. static const float beam_spot_shape_function = 0.0;
  180. // Spot shape power: Powers <= 1 give smoother spot shapes but lower
  181. // sharpness. Powers >= 1.0 are awful unless mix/max sigmas are close.
  182. static const float beam_spot_power_static = 1.0/3.0; // range (0, 16]
  183. // Generalized Gaussian max shape parameters: Higher values give flatter
  184. // scanline plateaus and steeper dropoffs, simultaneously widening and
  185. // sharpening scanlines at the cost of aliasing. 2.0 is pure Gaussian, and
  186. // values > ~40.0 cause artifacts with integrals.
  187. static const float beam_min_shape_static = 2.0; // range [2, 32]
  188. static const float beam_max_shape_static = 4.0; // range [2, 32]
  189. // Generalized Gaussian shape power: Affects how quickly the distribution
  190. // changes shape from Gaussian to steep/plateaued as color increases from 0
  191. // to 1.0. Higher powers appear softer for most colors, and lower powers
  192. // appear sharper for most colors.
  193. static const float beam_shape_power_static = 1.0/4.0; // range (0, 16]
  194. // What filter should be used to sample scanlines horizontally?
  195. // 0: Quilez (fast), 1: Gaussian (configurable), 2: Lanczos2 (sharp)
  196. static const float beam_horiz_filter_static = 0.0;
  197. // Standard deviation for horizontal Gaussian resampling:
  198. static const float beam_horiz_sigma_static = 0.35; // range (0, 2/3]
  199. // Do horizontal scanline sampling in linear RGB (correct light mixing),
  200. // gamma-encoded RGB (darker, hard spot shape, may better match bandwidth-
  201. // limiting circuitry in some CRT's), or a weighted avg.?
  202. static const float beam_horiz_linear_rgb_weight_static = 1.0; // range [0, 1]
  203. // Simulate scanline misconvergence? This needs 3x horizontal texture
  204. // samples and 3x texture samples of BLOOM_APPROX and HALATION_BLUR in
  205. // later passes (static option only for now).
  206. static const bool beam_misconvergence = true;
  207. // Convergence offsets in x/y directions for R/G/B scanline beams in units
  208. // of scanlines. Positive offsets go right/down; ranges [-2, 2]
  209. static const float2 convergence_offsets_r_static = float2(0.1, 0.2);
  210. static const float2 convergence_offsets_g_static = float2(0.3, 0.4);
  211. static const float2 convergence_offsets_b_static = float2(0.5, 0.6);
  212. // Detect interlacing (static option only for now)?
  213. static const bool interlace_detect = true;
  214. // Assume 1080-line sources are interlaced?
  215. static const bool interlace_1080i_static = false;
  216. // For interlaced sources, assume TFF (top-field first) or BFF order?
  217. // (Whether this matters depends on the nature of the interlaced input.)
  218. static const bool interlace_bff_static = false;
  219.  
  220. // ANTIALIASING:
  221. // What AA level do you want for curvature/overscan/subpixels? Options:
  222. // 0x (none), 1x (sample subpixels), 4x, 5x, 6x, 7x, 8x, 12x, 16x, 20x, 24x
  223. // (Static option only for now)
  224. static const float aa_level = 12.0; // range [0, 24]
  225. // What antialiasing filter do you want (static option only)? Options:
  226. // 0: Box (separable), 1: Box (cylindrical),
  227. // 2: Tent (separable), 3: Tent (cylindrical),
  228. // 4: Gaussian (separable), 5: Gaussian (cylindrical),
  229. // 6: Cubic* (separable), 7: Cubic* (cylindrical, poor)
  230. // 8: Lanczos Sinc (separable), 9: Lanczos Jinc (cylindrical, poor)
  231. // * = Especially slow with RUNTIME_ANTIALIAS_WEIGHTS
  232. static const float aa_filter = 6.0; // range [0, 9]
  233. // Flip the sample grid on odd/even frames (static option only for now)?
  234. static const bool aa_temporal = false;
  235. // Use RGB subpixel offsets for antialiasing? The pixel is at green, and
  236. // the blue offset is the negative r offset; range [0, 0.5]
  237. static const float2 aa_subpixel_r_offset_static = float2(-1.0/3.0, 0.0);//float2(0.0);
  238. // Cubics: See http://www.imagemagick.org/Usage/filter/#mitchell
  239. // 1.) "Keys cubics" with B = 1 - 2C are considered the highest quality.
  240. // 2.) C = 0.5 (default) is Catmull-Rom; higher C's apply sharpening.
  241. // 3.) C = 1.0/3.0 is the Mitchell-Netravali filter.
  242. // 4.) C = 0.0 is a soft spline filter.
  243. static const float aa_cubic_c_static = 0.5; // range [0, 4]
  244. // Standard deviation for Gaussian antialiasing: Try 0.5/aa_pixel_diameter.
  245. static const float aa_gauss_sigma_static = 0.5; // range [0.0625, 1.0]
  246.  
  247. // PHOSPHOR MASK:
  248. // Mask type: 0 = aperture grille, 1 = slot mask, 2 = EDP shadow mask
  249. static const float mask_type_static = 0.0; // range [0, 2] default [1.0]
  250. // We can sample the mask three ways. Pick 2/3 from: Pretty/Fast/Flexible.
  251. // 0.) Sinc-resize to the desired dot pitch manually (pretty/slow/flexible).
  252. // This requires PHOSPHOR_MASK_MANUALLY_RESIZE to be #defined.
  253. // 1.) Hardware-resize to the desired dot pitch (ugly/fast/flexible). This
  254. // is halfway decent with LUT mipmapping but atrocious without it.
  255. // 2.) Tile it without resizing at a 1:1 texel:pixel ratio for flat coords
  256. // (pretty/fast/inflexible). Each input LUT has a fixed dot pitch.
  257. // This mode reuses the same masks, so triads will be enormous unless
  258. // you change the mask LUT filenames in your .cgp file.
  259. static const float mask_sample_mode_static = 0.0; // range [0, 2]
  260. // Prefer setting the triad size (0.0) or number on the screen (1.0)?
  261. // If RUNTIME_PHOSPHOR_BLOOM_SIGMA isn't #defined, the specified triad size
  262. // will always be used to calculate the full bloom sigma statically.
  263. static const float mask_specify_num_triads_static = 0.0; // range [0, 1]
  264. // Specify the phosphor triad size, in pixels. Each tile (usually with 8
  265. // triads) will be rounded to the nearest integer tile size and clamped to
  266. // obey minimum size constraints (imposed to reduce downsize taps) and
  267. // maximum size constraints (imposed to have a sane MASK_RESIZE FBO size).
  268. // To increase the size limit, double the viewport-relative scales for the
  269. // two MASK_RESIZE passes in crt-royale.cgp and user-cgp-contants.h.
  270. // range [1, mask_texture_small_size/mask_triads_per_tile]
  271. static const float mask_triad_size_desired_static = 24.0 / 8.0;
  272. // If mask_specify_num_triads is 1.0/true, we'll go by this instead (the
  273. // final size will be rounded and constrained as above); default 480.0
  274. static const float mask_num_triads_desired_static = 480.0;
  275. // How many lobes should the sinc/Lanczos resizer use? More lobes require
  276. // more samples and avoid moire a bit better, but some is unavoidable
  277. // depending on the destination size (static option for now).
  278. static const float mask_sinc_lobes = 3.0; // range [2, 4]
  279. // The mask is resized using a variable number of taps in each dimension,
  280. // but some Cg profiles always fetch a constant number of taps no matter
  281. // what (no dynamic branching). We can limit the maximum number of taps if
  282. // we statically limit the minimum phosphor triad size. Larger values are
  283. // faster, but the limit IS enforced (static option only, forever);
  284. // range [1, mask_texture_small_size/mask_triads_per_tile]
  285. // TODO: Make this 1.0 and compensate with smarter sampling!
  286. static const float mask_min_allowed_triad_size = 2.0;
  287.  
  288. // GEOMETRY:
  289. // Geometry mode:
  290. // 0: Off (default), 1: Spherical mapping (like cgwg's),
  291. // 2: Alt. spherical mapping (more bulbous), 3: Cylindrical/Trinitron
  292. static const float geom_mode_static = 0.0; // range [0, 3]
  293. // Radius of curvature: Measured in units of your viewport's diagonal size.
  294. static const float geom_radius_static = 2.0; // range [1/(2*pi), 1024]
  295. // View dist is the distance from the player to their physical screen, in
  296. // units of the viewport's diagonal size. It controls the field of view.
  297. static const float geom_view_dist_static = 2.0; // range [0.5, 1024]
  298. // Tilt angle in radians (clockwise around up and right vectors):
  299. static const float2 geom_tilt_angle_static = float2(0.0, 0.0); // range [-pi, pi]
  300. // Aspect ratio: When the true viewport size is unknown, this value is used
  301. // to help convert between the phosphor triad size and count, along with
  302. // the mask_resize_viewport_scale constant from user-cgp-constants.h. Set
  303. // this equal to Retroarch's display aspect ratio (DAR) for best results;
  304. // range [1, geom_max_aspect_ratio from user-cgp-constants.h];
  305. // default (256/224)*(54/47) = 1.313069909 (see below)
  306. static const float geom_aspect_ratio_static = 1.313069909;
  307. // Before getting into overscan, here's some general aspect ratio info:
  308. // - DAR = display aspect ratio = SAR * PAR; as in your Retroarch setting
  309. // - SAR = storage aspect ratio = DAR / PAR; square pixel emulator frame AR
  310. // - PAR = pixel aspect ratio = DAR / SAR; holds regardless of cropping
  311. // Geometry processing has to "undo" the screen-space 2D DAR to calculate
  312. // 3D view vectors, then reapplies the aspect ratio to the simulated CRT in
  313. // uv-space. To ensure the source SAR is intended for a ~4:3 DAR, either:
  314. // a.) Enable Retroarch's "Crop Overscan"
  315. // b.) Readd horizontal padding: Set overscan to e.g. N*(1.0, 240.0/224.0)
  316. // Real consoles use horizontal black padding in the signal, but emulators
  317. // often crop this without cropping the vertical padding; a 256x224 [S]NES
  318. // frame (8:7 SAR) is intended for a ~4:3 DAR, but a 256x240 frame is not.
  319. // The correct [S]NES PAR is 54:47, found by blargg and NewRisingSun:
  320. // http://board.zsnes.com/phpBB3/viewtopic.php?f=22&t=11928&start=50
  321. // http://forums.nesdev.com/viewtopic.php?p=24815#p24815
  322. // For flat output, it's okay to set DAR = [existing] SAR * [correct] PAR
  323. // without doing a. or b., but horizontal image borders will be tighter
  324. // than vertical ones, messing up curvature and overscan. Fixing the
  325. // padding first corrects this.
  326. // Overscan: Amount to "zoom in" before cropping. You can zoom uniformly
  327. // or adjust x/y independently to e.g. readd horizontal padding, as noted
  328. // above: Values < 1.0 zoom out; range (0, inf)
  329. static const float2 geom_overscan_static = float2(1.0, 1.0);// * 1.005 * (1.0, 240/224.0)
  330. // Compute a proper pixel-space to texture-space matrix even without ddx()/
  331. // ddy()? This is ~8.5% slower but improves antialiasing/subpixel filtering
  332. // with strong curvature (static option only for now).
  333. static const bool geom_force_correct_tangent_matrix = true;
  334.  
  335. // BORDERS:
  336. // Rounded border size in texture uv coords:
  337. static const float border_size_static = 0.0001; // range [0, 0.5] default [0.015]
  338. // Border darkness: Moderate values darken the border smoothly, and high
  339. // values make the image very dark just inside the border:
  340. static const float border_darkness_static = 2.0; // range [0, inf)
  341. // Border compression: High numbers compress border transitions, narrowing
  342. // the dark border area.
  343. static const float border_compress_static = 2.5; // range [1, inf)
  344.  
  345.  
  346. #endif // USER_SETTINGS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement