Commit Graph

295 Commits

Author SHA1 Message Date
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
Christoph Oelckers ffcb6cb70a - added second vertex coordinate attribute for model interpolation. 2014-06-29 11:00:21 +02:00
Christoph Oelckers 39775cc904 - mystery of desaturation shader solved: The old code passed '1-desaturation' to the shader, the new code 'desaturation', so for the 'mix' function to work its arguments must be swapped. 2014-05-21 15:25:25 +02:00
Christoph Oelckers 54425ee2ef - fixed: Desaturation factor was applied incorrectly.
- Also fixed some very strange thing in the shader's desaturate function. For unknown reasons using the 'mix' function there did not work.
- fixed: The fog boundary special shader could not be used.
2014-05-21 13:40:46 +02:00
Christoph Oelckers cf45f2d718 - added missing shader files. 2014-05-12 22:24:26 +02:00
Christoph Oelckers 4d005bdfa0 shader rework
All those special shaders have been merged together.
Mostly working but the non-shader lighting seems a bit broken.
2014-05-12 14:45:41 +02:00
Christoph Oelckers b9a6fe80a4 Do not use the shader to handle STYLEF_RedIsAlpha.
Turns out that the name doesn't accurately describe what it does.
It is correct for images that come with their own palette or are true color.
But for images using the game palette it doesn't use the red channel to determine translucency but the palette index! Ugh...

This means it cannot be done with a simple operation in the shader because it won't get a proper source image. The only solution is to create a separate texture.
2014-05-11 23:56:53 +02:00
Christoph Oelckers 7793bbbcc9 Further cleanup of lighting code.
- remove thing color from lighting calculations.
- implement alpha textures and inverse sprites for infrared as texture modes. This still requires some handling for the alpha texture mode for non-shader rendering because there is no way in the fixed pipeline to do it. The inverted texture effect can be done with a texture combiner.
- fixed: ThingColor for sprites was set in the wrong place. It must be in the Process function, not in the lighting calculation.
- added functions for isolated calculation of sprites' dynlight color.
2014-05-11 17:56:38 +02:00
Christoph Oelckers 52056a05bd - changed handling of DynLight in shader to serve as a global dynamic light color for all lighting modes. 2014-05-11 16:49:17 +02:00
Christoph Oelckers 53f4cd0108 - added objectcolor uniform. This will be used to hold the thingcolor for shader based rendering. 2014-05-11 16:06:25 +02:00
Christoph Oelckers 09f4071436 Ok, it had to be done: Removed shader support for pre GLSL 1.3/GL 3.0 hardware. The compromises needed to accomodate these are just too bad and would block any attempt at streamlining the code. 2014-05-11 13:27:51 +02:00
Christoph Oelckers b09405a8bd - changed rendering of glowing walls so that it doesn't require an additional vertex attribute, just pass the floor and ceiling planes as uniforms. 2014-05-10 17:09:43 +02:00
Christoph Oelckers fd767233aa - fixed typo: glColor must be gl_Color in shader. 2013-12-08 10:01:03 +01:00
Christoph Oelckers d46315c44b - some finetuning of subtractive effect. 2013-12-05 15:39:46 +01:00
Christoph Oelckers 95163e378e - added a fog layer when drawing sprites with render style reverse subtract. 2013-12-05 15:06:10 +01:00
Christoph Oelckers e00847f64b - GZDoom solution file
- missing GL resources for gzdoom.pk3.
2013-06-23 11:13:01 +02:00
Randy Heit 59b6c5ef5c - Removed a couple warnings about implicit vector truncation reported by fxc. (Apparently, it
also decided to compile some other shaders slightly differently, too.)
- Fixed: The InGameColormap had been designed without taking alpha into consideration.
  As the least likely parameter to be used, desaturation has been moved into a constant
  register to make room for the alpha parameter to live in the vertex's color value.

SVN r3208 (trunk)
2011-05-15 22:30:20 +00:00
Randy Heit da31d9f8a3 - Since I am currently without a primary video card and stuck with this
Mobility Radeon 9000 (on a PCI card, no less!), I have decided to give the
  PS14 support some loving: D3D windowed gamma now works on these cards using
  a texture lookup for the gamma table. Sadly, this halves my framerate, so
  setting gamma to 1 will skip the gamma correction, as it was before, for
  full speed. (On my 8800 GT, the gamma correction was free.)


SVN r1898 (trunk)
2009-10-08 04:03:32 +00:00
Randy Heit 84a018f05a - Added support for defining the full color range of a special colormap.
SVN r1865 (trunk)
2009-09-22 02:54:19 +00:00
Randy Heit b8eb530a0d - Fixed: Wall drawing handled fixed light levels improperly (but did not
completely ignore them, either).
- Separated light level fixing out of player_t's fixedcolormap parameter.
  Using a fixed light level (e.g. PowerTorch) will no longer wipe out
  colored lighting.
- Moved the blending rectangle drawing into a separate discrete stage, since
  doing it while copying the 3D view window to the display now blends
  underneath the weapon instead of on top of it.
- Consolidated the special colormaps into a single 2D table.
- Tweaked the special colormaps slightly to make the true color results more
  closely match the paletted approximations.
- fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the
  executable and into zdoom.pk3. Shaders are still precompiled so I don't need
  to pull in a dependancy on D3DX.
- Added a few more shaders to accomodate drawing weapons with all the in-game
  lighting models. These are accessed with the new DrawTexture tags
  DTA_SpecialColormap and DTA_ColormapStyle.
- Player weapon sprites are now drawn using Direct3D and receive all the
  benefits thereof.


SVN r1858 (trunk)
2009-09-20 03:50:05 +00:00