Commit graph

81 commits

Author SHA1 Message Date
Magnus Norddahl
dc39a006dc Fix palette tonemap precision and compile error on Intel 2016-09-04 02:37:59 +02:00
Christoph Oelckers
589936f570 - draw the colormap blend after postprocessing, not before it.
- added colormap shader to postprocessing.

This replaces the in-place application of fullscreen colormaps if renderbuffers are active. This way the fully composed scene gets inverted, not each element on its own which is highly problematic for additively blended things.
2016-09-01 17:14:51 +02:00
Christoph Oelckers
3389a5a74e - removed most of the specific options for legacy hardware and consolidated them in one variable (does not work yet.) 2016-09-01 11:52:52 +02:00
alexey.lysiuk
2f893af857 Fixed palette tonemap mode for OpenGL 2.x 2016-08-24 11:44:33 +03:00
Magnus Norddahl
25645d901e Add Palette LUT tonemap mode 2016-08-23 09:18:18 +02:00
Christoph Oelckers
250be72939 - added handling for drawing with uniform vertices. It draws something but in the wrong place. Right now I have no idea what's happening... 2016-08-22 15:31:23 +02:00
Christoph Oelckers
7ba5acfb35 - added quad drawer interface so that this part can be done without altering a vertex buffer.
So far it's only the framework, the new code is not active yet.
2016-08-22 14:00:25 +02:00
Magnus Norddahl
0e2d9affb2 Make sure tonemap shader never takes the sqrt of a negative number
Fix bug where the old hardcoded exposure bias was still being used in the uncharted2 tonemap
2016-08-16 00:22:00 +02:00
Magnus Norddahl
a8d1197ea7 Make sure we never pass a negative value to pow, and optimize gamma uniform 2016-08-16 00:01:18 +02:00
Magnus Norddahl
210fce1193 Fix bloom shader missing its target 2016-08-14 09:05:50 +02:00
Christoph Oelckers
675822004d - use static buffer data and a uniform to handle the texture positioning of the present shader.
That's again one less write access to the buffer. The uniform method was chosen because this way a buffer update can be completely avoided, and setting a single uniform is a lot cheaper and simpler to handle.
2016-08-08 16:06:02 +02:00
Magnus Norddahl
346badf25f Moved state to FGLPostProcessState and merged vertex shaders 2016-08-06 11:51:08 +02:00
Magnus Norddahl
6fc7596d52 Fix aspect ratio and texture clipping in lens shader 2016-08-04 15:47:15 +02:00
Magnus Norddahl
6b9529d70f Added lens distortion shader 2016-08-02 17:32:21 +02:00
Magnus Norddahl
7709db4bb0 Fix broken viewport/backbuffer location for WriteSavePic 2016-07-31 16:23:21 +02:00
alexey.lysiuk
7de242930a Removed obsolete gamma correct shader used on macOS only 2016-07-30 15:30:35 +03:00
Magnus Norddahl
5849c83028 Added bloom and tonemap to menus
Added gl_renderbuffers CVAR that disables render buffers
Added patch shader support to FShaderProgram
Added OpenGL 2 fallback support to render buffers
2016-07-29 21:31:20 +02:00
Magnus Norddahl
0efee85bd8 Added tonemapping and sector based exposure control 2016-07-29 00:36:43 +02:00
Magnus Norddahl
69f52cc898 Added bloom shaders 2016-07-27 21:50:30 +02:00
Magnus Norddahl
aeb7df09de Added hardware gamma option and improved window handling on Windows 2016-07-27 11:15:19 +02:00
Magnus Norddahl
669238db66 Fix Apple GLSL compile errors 2016-07-23 17:27:19 +02:00
Magnus Norddahl
c08fc8f5a8 Fix depth calculations for R_DoomLightingEquation and make it an exact match of what zdoom does 2016-07-23 17:27:19 +02:00
Christoph Oelckers
3334b28a02 - don't let the light go completely black with software-emulated lighting. 2016-05-04 14:30:10 +02:00
Christoph Oelckers
9f91fa8f43 - make the warp2 shader's formula match the software renderer's.
This fixes some jerkiness with vertical scrollers due to a bad sine period and makes the overall appearance of the effect what it was originally supposed to be. The old warp2 shader was not created by replicating the formula but by trial and error until it looked close enough.

A version of the old warp2 shader with a fixed sine period is still available as a custom hardware shader.
2016-05-04 13:47:40 +02:00
alexey.lysiuk
f9022f3054 Fixed compilation of gamma correction shader with particular OpenGL setup 2016-05-02 16:13:54 +03:00
alexey.lysiuk
333560086d Calculate color values for gamma correction directly in shader
Gamma table texture is no longer needed
2016-05-02 11:24:42 +03:00
alexey.lysiuk
44b019413c Implemented gamma correction in OS X native backend using shader effect 2016-05-02 10:04:09 +03:00
Christoph Oelckers
70bf649364 - added clip planes for line portals and mirrors. This should eliminate the remaining problems with some visible geometry in front of the portal, it is also necessary to handle sprite splitting across line portals properly. 2016-04-29 12:26:57 +02:00
Christoph Oelckers
21283b18f4 - preparations for using clip planes on line portals. 2016-04-29 01:48:06 +02:00
Christoph Oelckers
86f38475b0 - shaders for last commit. 2016-04-27 02:10:42 +02:00
Christoph Oelckers
f066457a48 - add shader patching to allow running the engine with GLSL 1.2.
- made some initial preparations for the shader-less fallback path.
2016-04-26 15:26:52 +02:00
Christoph Oelckers
fc38728309 - made some changes to the shaders to allow downpatching them to GLSL 1.2:
* disable the dynamic light code if no buffers are available
 * added a duplicate of the getTexel function which cannot be patched without creating syntax problems.
 * fixe int<->float conversion warning, which on some compilers may be an error.
2016-04-26 11:31:27 +02:00
Christoph Oelckers
fc57180d7e - added necessary state to implement 3D light splitting using hardware clipping planes. 2016-01-30 23:01:11 +01:00
Christoph Oelckers
238990c871 don't leave any gaps in the used clip planes. 2016-01-27 12:32:39 +01:00
Christoph Oelckers
47db3252f4 - it's really not necessary to waste two clip planes for reflective surfaces because only one can be active at any time. 2016-01-27 12:30:55 +01:00
Christoph Oelckers
b45c88fc4f - changed shaders. 2015-04-05 20:20:56 +02:00
Christoph Oelckers
020b02e073 - changed deprecated texture sampler access function names. 2014-11-28 12:28:45 +01:00
Christoph Oelckers
5638aab63c - fixed: Even though the name REDISALPHA implies otherwise, this render mode still needs to respect a texture's alpha channel to ensure that things get rendered properly. Otherwise the SmoothEdges function cannot be used which is necessary to ensure that filtered textures look correct. 2014-10-26 21:17:29 +01:00
Christoph Oelckers
fd3128a164 - fixed: When changing enhanced nightvision mode the shaders need to have their fixed colormap state reset to ensure that the new settings get used.
- fixed: The shader code for handling special fixed colormaps did not use the color vertex attribute which was most evident with the 'shadow' render style on the spectre.
2014-10-05 09:40:36 +02:00
Christoph Oelckers
4682736585 - fixed: non-tiled mid textures on a fog boundary require some special clamping to be performed in the shader. 2014-09-21 11:08:17 +02:00
Christoph Oelckers
835dbe5bd0 - removed the 'layout' qualifier from the uniform buffer declaration. It's not really needed because the layout of a single vec4 array cannot possibly change, and Intel drivers are complaining for unknown reasons. 2014-09-20 09:10:01 +02:00
Christoph Oelckers
acf6c259d8 - changed the handling of alpha textures. The only special case they need is with palette-less textures and this can be handled far more easily and robustly with a predefined translation instead of passing another parameter through all the layers of the texture management code. This also fixes problems with paletted PNGs that get used as an alpha texture because the old method clobbered the image's palette. 2014-09-09 13:21:36 +02:00
Christoph Oelckers
d5633701b4 - swapped order of textures in burn shader to avoid some problems with the texture samplers.
- fixed: texture sampler state for the burn texture was never set.
2014-09-09 10:17:44 +02:00
Christoph Oelckers
b96dd6c421 - fixed: The missing fourth component of the texture coordinate must be filled with 1.0, not 0.0 before applying the texture matrix. Not doing so will cancel out the translation part of the matrix. 2014-09-02 10:31:48 +02:00
Christoph Oelckers
a8e9c1832f - decided to restrict the 2.0 beta to OpenGL 4.x with GL_ARB_buffer_storage extension and removed all code for supporting older versions.
Sadly, anything else makes no sense.
All the recently made changes live or die, depending on this extension's presence.
Without it, there are major performance issues with the buffer uploads. All of the traditional buffer upload methods are without exception horrendously slow, especially in the context of a Doom engine where frequent small updates are required.
It could be solved with a complete restructuring of the engine, of course, but that's hardly worth the effort, considering it's only for legacy hardware whose market share will inevitably shrink considerably over the next years.
And even then, under the best circumstances I'd still get the same performance as the old immediate mode renderer in GZDoom 1.x and still couldn't implement the additions I'd like to make.

So, since I need to keep GZDoom 1.x around anyway for older GL 2.x hardware, it may as well serve for 3.x hardware, too. It's certainly less work than constantly trying to find workarounds for the older hardware's limitations that cost more time than working on future-proofing the engine.

This new, trimmed down 4.x renderer runs on a core profile configuration and uses persistently mapped buffers for nearly everything that is getting transferred to the GPU. (The global uniforms are still being used as such but they'll be phased out after the first beta release.
2014-08-01 22:42:39 +02:00
Christoph Oelckers
7967082e60 - use the light buffer to handle dynamic lighting. 2014-08-01 20:59:39 +02:00
Christoph Oelckers
ef8f66c9a1 - removed the code for hardware alpha testing again because it didn't work anymore with how things are set up now.
- we need to check all GL versions when trying to get a context because some drivers only give us the version we request, leaving out newer features that are not exposed via extension.
- added some status info about uniform blocks.
2014-07-30 23:13:16 +02:00
Christoph Oelckers
754c96a540 - added default precision settings to shader include because some old ATI drivers complain if they aren't there - even though the spec doesn't require them... 2014-07-27 16:09:47 +02:00
Christoph Oelckers
eb9d2d9917 - reactivate compatibility profile so that immediate mode drawing can be used on older hardware not supporting persistently mapped buffers.
- reactivate alpha testing per fixed function pipeline
- use the 'modern' way to define clip planes (GL_CLIP_DISTANCE). This is far more portable than the old glClipPlane method and a lot more robust than checking this in the fragment shader.
2014-07-17 02:37:18 +02:00
Christoph Oelckers
fc0cf4f998 - GZDoom now runs on an OpenGL core profile. :)
It's probably still necessary to replace GLEW with another loader library. GLEW is pretty much broken on core OpenGL without some hacky workarounds...
2014-07-15 02:26:23 +02:00