Commit graph

144 commits

Author SHA1 Message Date
MooglyGuy
ba5ec29211
Swapped R and B channels in lut-default.png, and adjusted D3D9 LUT-application behaviour. (#11004) [Ryan Holtz]
* lut-default.png: Swapped red and blue channels (fixes GitHub #11001).
* render/d3d/d3dlsl.cpp: Changed screen LUT application to be applied during the color convolution pass on raster systems.
2023-03-20 03:59:44 +11:00
MooglyGuy
f05ea5b7b4
More D3D HLSL regression fixes: (#11002) [Ryan Holtz]
* hlsl/post.fx: Fixed double-drawing of screen data with D3D9 HLSL and screen scale/offset.
* render/d3d/d3dhlsl.cpp: Fixed screen-container search function (fixes GitHub #10872).
* render/d3d/d3dhlsl.cpp: Fixed downsample pass, fixes blocky vector bloom.
2023-03-20 02:22:34 +11:00
MooglyGuy
671434f7da
HLSL: bloom.fx: Return an alpha of 1 rather than texel alpha (fixes GitHub #10977). (#10983) [Ryan Holtz] 2023-03-12 09:21:00 +11:00
Vas Crabb
54cdb214e4 hlsl: Fixed regression in distortion shader. [Ryan Holtz] 2023-02-24 17:33:05 +11:00
Vas Crabb
eaa43879cd render/bgfx: Got rid of a lot of unnecessary object copying during setup. 2023-01-29 06:53:43 +11:00
MooglyGuy
5671484fc8
Major D3D and BGFX code refactoring and bug fixes: (#10858) [Ryan Holtz]
* render/bgfx: Improved clearing and blending. Added prescale support. Fixes MT07586, MT07587, MT08084.
* render/bgfx: Fixed blend and tint handling. (Fixes Github #1953).
* render/bgfx/blendreader.cpp: Support non-separated blend mode specification for BGFX effects.
* render/bgfx: Reworked how horizontally-padded screen textures are handled. Likely fixes MT08512 and MT08505.
* render/bgfx: Ensure that a texture's width margin is updated in all cases.
* render/d3d/d3dhlsl.cpp: Fixed tinting in HLSL post-processing mode.
* render/d3d/d3dhlsl.cpp: Avoid most redundant state-setting calls. Reduces D3D API calls by about 90% on fruit machine drivers.
* render/d3d/d3dhlsl.cpp: Assign SourceDims and QuadDims uniforms to only those effects that use them.
* machine/laserdsc.cpp: Always add video quad to screen container, adjust tint based on m_videoenable instead.
2023-01-29 03:59:25 +11:00
Westley M. Martinez
b5a54b761c HLSL Color Transforms and 3D LUT (#4043)
* Remove broken scanline uniform from post_pass

* Add 3D LUT to HLSL

* Allow individual LUTs for screen and UI

* WIP: Port 3D LUT to BGFX

* Finish porting LUT to BGFX

* Add individual phosphor color conversion for HLSL
	new file:   hlsl/chroma.fx
		Shader for converting xyY3 to sRGB
	modified:   hlsl/phosphor.fx
		Minor changes to emphasize idea that phosphors are color
agnostic
	modified:   hlsl/post.fx
		Conversion from signal RGB to xyY3
	modified:   src/osd/modules/render/d3d/d3dhlsl.cpp
	modified:   src/osd/modules/render/d3d/d3dhlsl.h
	modified:   src/osd/windows/winmain.cpp
	modified:   src/osd/windows/winmain.h

* Add phosphor examples and update presets

* Port phosphor color shaders to BGFX

* Fix missing newlines at EOF
2018-10-07 11:42:30 -04:00
W. M. Martinez
e04d852034 HLSL: Move scanline to occur before defocus
On branch scanline
Changes to be committed:
	modified:   hlsl/post.fx
		Remove scanline effect
	new file:   hlsl/scanline.fx
		Separate scanline effect into its own shader
	modified:   src/osd/modules/render/d3d/d3dhlsl.cpp
		Add scanline effect
	modified:   src/osd/modules/render/d3d/d3dhlsl.h
		Add scanline effect
2018-09-14 16:38:18 -07:00
R. Belmont
311a56b958 Revert "New phosphor persistence shaders for HLSL" 2017-01-05 12:30:07 -05:00
Westley M. Martinez
2b95c8e50b Change cached texture format to floating point.
hlsl/phosphor.fx: Remove hacks

	ini/presets/raster.ini, ini/presets/vector-mono.ini,
ini/presets/vector.ini: Tweak presets

	src/osd/modules/render/d3d/d3dcomm.h,
src/osd/modules/render/d3d/d3dhlsl.cpp,
src/osd/modules/render/drawd3d.cpp: Change cache texture format to
floating point for precise for phosphor and ghosting shaders.
2017-01-04 17:44:46 -08:00
Westley M. Martinez
91172125de Add LCD ghosting shader for Direct3D
hlsl/ghosting.fx: Add LCD ghosting shader

	hlsl/phosphor.fx: Remove LCD logic

	ini/presets/gameboy.ini, ini/presets/gba.ini,
ini/presets/lcd-matrix.ini, ini/presets/lcd.ini, ini/presets/raster.ini,
ini/presets/vector.ini: Update presets

	src/osd/modules/render/d3d/d3dhlsl.cpp,
src/osd/modules/render/d3d/d3dhlsl.h: Add LCD shader and sliders.  Allow
sliders to be adjusted for R, G, and B components.

	src/osd/windows/winmain.cpp, src/osd/windows/winmain.h: Add LCD
ghosting options.# Please enter the commit message for your changes. Lines starting
2017-01-02 15:42:33 -08:00
Westley M. Martinez
c7cc38199a Tweak phosphor parameter scaling, update presets. 2016-12-30 16:24:31 -08:00
Westley M. Martinez
7cda4860ec Scale and phosphor persistence sliders.
hlsl/phosphor.fx: Scale parameter into tau or gamma.

	src/osd/modules/render/d3d/d3dhlsl.cpp:
	src/osd/modules/render/d3d/d3dhlsl.h:
	src/osd/windows/winmain.cpp:
	src/osd/windows/winmain.h: Combine tau and beta sliders into one
slider labeled 'Time Constant'.
2016-12-30 15:40:30 -08:00
Westley M. Martinez
b2682b7c55 Add gamma correction for proper impulse response. 2016-12-30 13:18:41 -08:00
Westley M. Martinez
f1da2ecffa Remove phosphor burn-in. 2016-12-30 10:46:44 -08:00
Westley M. Martinez
43d7ab3663 Implement LCD persistence shader.
hlsl/phosphor.fx: Do LCD persistence effect using boolean LCD.
LCD persistence is monochrome and thus does not have separate components
like phosphor persistence.

	src/osd/modules/render/d3d/d3dhlsl.cpp: Add slider for LCD
games.

	src/osd/modules/render/d3d/d3dhlsl.h: (BP) Add options for LCD
games.

	src/osd/windows/winmain.cpp: (BP) Add options for LCD games.

	src/osd/windows/winmain.h: (BP) Add options for LCD games.
2016-12-29 14:57:31 -08:00
Westley M. Martinez
0b6f935443 Implement new phosphor shader.
hlsl/phosphor.fx: Make changes to the pixel shader.  New
uniforms: Mode, Tau, Beta, Gamma.  Remove Phosphor.  Mode selects the
mode for phosphor simulation: off (no decay), exponential, inverse
power.  Tau is the time constant for exp. decay.  Beta and Gamma are
constants for inv-pow.

	src/osd/modules/render/d3d/d3dhlsl.cpp: Provide uniforms and add
sliders for new options.

	src/osd/modules/render/d3d/d3dhlsl.h: (BP) Provide new options.

	src/osd/windows/winmain.cpp: (BP) Provide new options.

	src/osd/windows/winmain.h: (BP) Provide new options.
2016-12-29 14:57:28 -08:00
Westley M. Martinez
77fd0232e6 Fix phosphor shader to work properly for multi-screen games and
multi-window use.

	hlsl/phosphor.fx: Update semantics.

	src/osd/modules/render/d3d/d3dhlsl.cpp: Implement
shaders::delta_time member function.

	src/osd/modules/render/d3d/d3dhlsl.h: Add acc_t and delta_t
members for use by shaders::delta_time.  Member function returns the
amount of time since itself has been called, for use by time-dependent
shaders.
2016-12-12 22:09:59 -08:00
Westley M. Martinez
eba9550c42 Fix phosphor persistence shader behavior based on time.
hlsl/phosphor.fx: Add calculation time passed to be used by
shader.

	src/osd/modules/render/d3d/d3dhlsl.cpp: Make pixel shader
calculate the current pixel by factoring in the amount of time which has
passed since the last rendering.
2016-12-11 12:01:43 -08:00
Jezze
d9ae40b9fe Reduced defocus effect to one pass (HLSL/BGFX)
- removed second defocus pass
- limited defocus stength to a maximum of 2.0
2016-10-22 22:56:16 +02:00
Jezze
ef16086fea Disabled clearing of render targets in several passes (HLSL)
- which was quite a performance overhead and not necessary because the shaders fill every texel of a target without blending
2016-10-22 22:56:16 +02:00
Jezze
68036515ba Fixed aspect ratio of rounded corners (nw) 2016-09-29 15:19:44 +02:00
Jezze
ecf1e166fc Fixed several small issues in HLSL/BGFX
* fixed target texture dimension when -intoverscan is used (this fixes the appereance of scanline and shadow mask)
* added target_scale and screen_count uniforms
* rounded corners now remain aligned with screen bounds when -intoverscan is used (single screen only)
2016-09-28 15:30:43 +02:00
Jezze
7dc76d6501 - already fixed scanline issue also applied for swapped orientation (nw) 2016-08-13 20:30:56 +02:00
ImJezze
2f06a08ec4 Small shader corrections (nw) 2016-06-20 00:03:44 +02:00
ImJezze
758aaa496a Fixed scanlines if the screen output is less than twice the size of the host source 2016-06-06 19:40:36 +02:00
ImJezze
6ea15072a7 Procedural texture for vectors in HLSL
* added simple procedural texture for vectors with rounded line ends and beam smoothness
* added optional -vector_beam_smooth option
* removed -antialias option, antialiasing is now always applied, except for plain D3D
2016-06-05 23:50:44 +02:00
ImJezze
92c2bdf917 Normalized vector attenuation settings
- vector_length_ratio is now independent from screen size
- changed vector_length_ratio range from [0.0, 1000.0] to [0.0, 1.0]
- updated display name and description of vector_length_scale vector_length_ratio
2016-05-22 20:54:30 +02:00
ImJezze
bef70746af Fixed half texel offset of 'source' shadow mask tile mode 2016-05-05 22:46:56 +02:00
ImJezze
07d8b25571 Added "selection" parameter to chain input sampler
- if specified all textures (.png) within the same directoy of the given texture will be selectable via slider in the UI
- also added slider for "shadow mask tile mode" to HLSL chain
2016-04-24 20:36:42 +02:00
ImJezze
dba12a31ad Small fixes (nw)
- fixed not used u_humbar_hertz_rate parameter
- fixed half pixel shift of the shadow mask along the screen diagonal
2016-04-22 13:16:37 +02:00
ImJezze
b1c06acb61 Implemented handling for u_screen_scale and u_screen_offset (nw) 2016-04-21 07:52:29 +02:00
ImJezze
cd4dfca43e Refactored BGFX distortion pass (nw)
- also removed vector hack
2016-04-19 21:18:16 +02:00
ImJezze
8ed3a7d94a Refactored distortion pass
- separated curvature parameter into distortion, cubic_distortion and distort_corner
- distortion and cubic_distortion can be negative, to compensate each other
- distort_corner is intependent from the image distortion
2016-04-19 21:13:20 +02:00
ImJezze
32f0e6efac Removed hacks for vector screens from shaders (nw)
- added handling of texture coordinates for vector screens to core render
- added handling of orientation/rotation for vector screens to D3D renderer
2016-04-13 19:21:57 +02:00
therealmogminer@gmail.com
a4f615a14d Get NTSC working in both bgfx and d3d, nw 2016-03-29 01:56:37 +02:00
ImJezze
fe9dfdbf99 Refactored Bloom
- reduced raster bloom level to 8
- extended vector bloom level to 15
- changed vector bloom to be less blocky
- removed bloom_lvl9_weight and bloom_lvl10_weight options
2016-03-28 20:19:01 +02:00
ImJezze
c731b59cbe Added oversampling option
- and some cleanup
2016-03-25 16:40:32 +01:00
ImJezze
b507dbb5fc Scanline Variation
- added option for scanline variation
2016-03-15 22:15:25 +01:00
ImJezze
c2d4e3c018 Cleanup (nw)
- options are reset to loaded preset when game is closed
- changed default values of options to result in no effects activated
- init_slider_list() does not returns but sets g_slider_list directly
- removed unnecessary oriented_vector_texcoords
2016-03-13 17:11:08 +01:00
ImJezze
b1a392a45f Fixed mask orientation for vector screen 2016-03-12 19:17:57 +01:00
ImJezze
4c7e845498 Fixed rotated source tile mode
- and corrected aperture texture name
2016-03-12 18:59:36 +01:00
ImJezze
7add547602 Refactoring of render targes and vector texture coordinates
- implemented proper texture coordinates for vector quad primitive
- vector screen is now processed in texture coordinates
- revered workaround for raster screen, which is again processed in
texture coordinates
- known issue: cocktail mode for vector screen looks wrong
2016-03-12 16:03:28 +01:00
ImJezze
0e76ce80de Cleanup primary.fx
- split into primary.fx into 3 techniques for vector buffer, screen and
UI pass
- moved register_texture() for shaders outside of texture_info creation
- added render_primitive parameter to register_texture(); currently
unused
- removed other unused register_texture() definition
2016-02-28 18:59:10 +01:00
ImJezze
11395616dd Bloom refactoring
- calculation of bloom dimensions is now done only once, when render
target is created
- reduced blur width for non-vector screens
- implemented shadow u/v option for source tile mode
2016-02-25 20:58:49 +01:00
ImJezze
e57c90084c Quality and Performance improvements
- HLSL now uses NPOT sized target surfaces (breaks compatibility with
graphics cards based on R300/R400/NV30 and older)
- HLSL target surfaces now have the size of the screen canvas
- removed HLSL pre-scale factor
- HLSL now uses a sharp bilinear interpolation to pre-scale textures to
screen canvas size, based on [Themaister's] implementation
- improved overall performance (based on the previously required
pre-scale factor, you might notice a 5-50% speed-up depending on your
graphics card, more if you used a higher pre-scale factor)
- improved shadow mask quality (pixel-perfect) in screen-mode
- fixed half source texel offset of bloom level alignment
- removed ./hlsl/artwork_support folder
- all shaders after pre-scale are now based on screen coordinate
(workaground, till both raster and vector pass can work on texture
coordinates)
- disabled distortion shader for more than one screen and for artworks
in full mode, does not affect artworks in copped mode (workaground, till
both raster and vector pass can work on texture coordinates)
- moved compute_texture_size() from texture_info to texture_manager (nw)
2016-02-20 21:58:56 +01:00
ImJezze
d15d53c728 Fixed Bloom Level Alignment
- fixed target dimensions of bloom levels, which results in a much
better alignment especially for game with very low resolution (therefore
current bloom settings might look a little less intense than before)
- small cleanups (nw)
2016-02-07 13:40:24 +01:00
ImJezze
f5e3032d98 Improved Scanline Simulation
- changed the amount of scanline darkness, a setting of 1.0 now becomes
fully black (to get the same result as before half your current setting)
- scanline height now depends on the brightness of the underlying color
- the amount of the scanline brightness and overdrive now depends on the
scanline darkness
- renamed 'Scanline Screen Height' to 'Scanline Screen Scale' and
'Scanline Indiv. Height' to 'Scanline Height'
2016-02-07 13:32:34 +01:00
ImJezze
8d5848718c Fixed missing const (nw) 2016-01-26 22:24:47 +01:00
ImJezze
a5fb439705 Cleanup (nw) 2016-01-26 22:14:41 +01:00