Commit graph

65 commits

Author SHA1 Message Date
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
Christoph Oelckers
6046b11b4f - all shaders now compile in core profile. 2014-07-15 01:05:53 +02:00
Christoph Oelckers
eedc5a69be - replaced builtin position vertex attribute. 2014-07-15 01:02:48 +02:00
Christoph Oelckers
1b7f5a2e6a - replaced builtin texture coordinate vertex attribute. 2014-07-15 00:59:01 +02:00
Christoph Oelckers
5a322742c3 - remove use of builtin and deprecated color vertex attribute. 2014-07-15 00:37:13 +02:00
Christoph Oelckers
5193f6cfef - remove use of builtin deprecated varyings in shaders. 2014-07-15 00:19:41 +02:00
Christoph Oelckers
ed8a21fd86 - replaced deprecated alpha testing with shader code. 2014-07-14 21:14:43 +02:00
Christoph Oelckers
84a49e37ee - handle normals for spheremapped mirror surfaces using non-deprecated features.
- move all WGL references out of global header files so that global wgl header include is no longer necessary
2014-07-14 19:54:07 +02:00
Christoph Oelckers
ce3653f6e1 - remove all uses of builtin matrices. 2014-07-13 23:13:40 +02:00
Christoph Oelckers
dbb05c5f33 - remove use of builtin texture matrices.
- make matrix class single precision.
2014-07-13 20:41:20 +02:00
Christoph Oelckers
00fcf4bc06 - for some reason using world coordinates for clipping in the shader is somewhat imprecise so the clip plane heights have to be adjusted a bit for it. 2014-07-13 13:25:42 +02:00
Christoph Oelckers
60dc2e1122 - some shader fixes. 2014-07-13 13:01:35 +02:00
Christoph Oelckers
d868f60f6c - since the clip planes for plane mirrors did not work anymore I reimplemented them using shader based logic. It still needs to be seen if this affects performance on older hardware. 2014-07-13 12:14:12 +02:00
Christoph Oelckers
a936629cec - use default fragment shader for burn and stencil shader, with the time consuming parts disabled by a #define, to avoid code duplication. 2014-07-10 10:33:07 +02:00
Christoph Oelckers
f710518903 - use a uniform array to store vertex data to render dynamic stuff on GL 3.x hardware without the ARB_buffer_storage extension.
Due to the way the engine works it needs to render a lot of small primitives with frequent state changes.
But due to the performance of buffer uploads it is impossible to upload each primitive's vertices to a buffer separately because buffer uploads nearly always stall the GPU.
On the other hand, in order to reduce the amount of buffer uploads all the necessary state changes would have to be saved in an array until they can finally be used. This method also imposed an unacceptable overhead.
Fortunately, uploading uniform arrays is very fast and doesn't cause GPU stalls, so now the engine puts the vertex data per primitive into a uniform array and uses a static vertex buffer to index the array in the vertex shader.
This method offers the same performance as immediate mode but only uses core profile features.
2014-06-30 18:10:55 +02:00
Christoph Oelckers
1efc2938b7 - implement model vertex buffer and draw MD2 models using it instead of using the GLCommands from the model. 2014-06-29 23:24:16 +02:00
Christoph Oelckers
9d1dbf4eab - fixed: FBufferedUniform1f didn'T work because it used an int as its buffered value. 2014-06-29 14:08:44 +02:00