Commit graph

1995 commits

Author SHA1 Message Date
Christoph Oelckers
5a4e5a8038 - moved the remaining parts of the main vertex buffer to hwrenderer. 2018-10-27 14:42:24 +02:00
Christoph Oelckers
dad3c50ebd - renamed classes before continuing. 2018-10-27 14:27:43 +02:00
Christoph Oelckers
72bc7693bd - refactored main vertex buffer (but didn't merge with hwrender class yet. 2018-10-27 14:24:47 +02:00
Christoph Oelckers
332ab220ad - hooked low level buffers into render state.
It still needs to support the old interface so the code isn't really clean
2018-10-27 10:55:35 +02:00
Christoph Oelckers
3db26a3a1b - added an abstract index buffer implementation as well. 2018-10-27 10:26:51 +02:00
Christoph Oelckers
bb09f5488f - added an abstract base vertex buffer class. 2018-10-27 09:07:26 +02:00
Christoph Oelckers
fa85717155 - a bit of code reordering. 2018-10-25 22:50:45 +02:00
Christoph Oelckers
4f4bcd2d7d - moved DrawSorted back to HWDrawList. 2018-10-25 22:45:55 +02:00
Christoph Oelckers
c98474d1c7 - portal refactoring complete. 2018-10-25 22:30:03 +02:00
Christoph Oelckers
bc97e585ba - removed some leftover GL2 code. 2018-10-25 01:02:16 +02:00
Christoph Oelckers
cead0194bd - safety commit. To finalize we need a better vertex buffer interface. 2018-10-25 00:49:39 +02:00
Christoph Oelckers
3940f17980 - portals are now completely on the hwrenderer side.
The only thing that still needs to be on the backend side is the one function that manages the rendering.
2018-10-25 00:25:55 +02:00
Christoph Oelckers
e6b5eba469 - moved GLScenePortal to the hardware independent code. 2018-10-24 07:57:32 +02:00
Christoph Oelckers
c76c4b77ec - merged GLPortal into HWPortal after all direct OpenGL dependencies have been removed. 2018-10-24 07:49:06 +02:00
Christoph Oelckers
d757efde96 - renamed IPortal to HWPortal 2018-10-24 07:35:22 +02:00
Christoph Oelckers
3e4dcbe2b4 - groundwork for separating the portal data from the renderer.
With GLPortal being responsible for all the setup a lot of code was tied to the backend.
Now FDrawInfo will manage the setup and only call pure data generation functions in the actual portal object.
2018-10-24 00:19:07 +02:00
Christoph Oelckers
93dac4e4d8 - some reorganization of portal code. 2018-10-23 22:32:00 +02:00
Christoph Oelckers
93599e483f - moved weapon drawing to hwrenderer. 2018-10-22 23:40:44 +02:00
Christoph Oelckers
08e1b49988 - removed include 2018-10-21 20:21:16 +02:00
Christoph Oelckers
3775c4756e - moved sprite drawer to hwrenderer as well. 2018-10-21 17:50:01 +02:00
Christoph Oelckers
346a9ce149 - fixed initialization. 2018-10-21 14:45:03 +02:00
Christoph Oelckers
0af65a8fa0 - removed the direct setters for the blend mode state.
This will now always have to go through the render state.
2018-10-21 14:26:14 +02:00
Christoph Oelckers
a3aaa5cc8b - removed old RenderStyle management. 2018-10-21 14:18:08 +02:00
Christoph Oelckers
8ffeb7812f - made wall draw code API independent. 2018-10-21 13:53:50 +02:00
Christoph Oelckers
7897f26abf - started reworking the wall drawer. 2018-10-21 13:11:36 +02:00
Christoph Oelckers
acad8315d0 - move stencil recursion counter to render state. 2018-10-21 10:58:11 +02:00
Christoph Oelckers
a97d71a3c3 - draw decals in hardware independent code. 2018-10-21 10:51:26 +02:00
Christoph Oelckers
1768508c80 - first adjustments to decal code.
- moved texture mode constants to a global header and consolidated with the variants of the 2D drawer.
2018-10-21 08:14:48 +02:00
Christoph Oelckers
3b7a5da83e - moved AddFlat to gl_drawinfo.cpp and deleted gl_flats.cpp. 2018-10-21 00:38:56 +02:00
Christoph Oelckers
d45f6b9bea - moved the flat drawer to hwrenderer. 2018-10-21 00:35:39 +02:00
Christoph Oelckers
e8f48e7535 - moved the color/fog setters to hwrenderer. 2018-10-20 23:33:07 +02:00
Christoph Oelckers
fac7c7a31c - abstraction of render style in render state. 2018-10-20 23:14:57 +02:00
Christoph Oelckers
9ef5e00cdf - some cleanup and preparation on RenderState interface. 2018-10-20 21:36:50 +02:00
Christoph Oelckers
3c3be0d349 - started with an abstract render interface, most importantly handle the stencil for plane flooding through the render state object instead of changing GL state directly. 2018-10-20 21:08:24 +02:00
Christoph Oelckers
510aa600dd - moved hw_renderstate.h to hwrenderer folder and renamed one GL constant it was using. 2018-10-20 18:37:12 +02:00
Christoph Oelckers
a4f7fd2e46 - started splitting the render state struct.
Reusable parts should be in hwrenderer later.
2018-10-20 13:34:29 +02:00
Christoph Oelckers
4603d01ba1 - removed some unused content from FGLRenderState. 2018-10-20 13:11:03 +02:00
Christoph Oelckers
9a03ba3cc5 - renamed FRenderState to FGLRenderState. 2018-10-20 13:05:36 +02:00
Christoph Oelckers
5f838d52b9 - some cleanup on the OpenGL interface and its flags.
Most importantly, the separate command line options for switching on the legacy buffer handling have been removed.
There's really no need for them anymore, because unlike in earlier versions many of the implementation differences no longer exist - with the exception of where the light and vertex buffer contents are generated.
For testing this, -glversion 3 is sufficient.
2018-10-20 12:55:25 +02:00
Christoph Oelckers
9253118bdc - removed the quad drawer class
This isn't needed anymore.
2018-10-20 11:59:12 +02:00
Christoph Oelckers
74ba142eae - allow vertex creation for sprites in the setup pass.
Currently only used by legacy hardware.
2018-10-20 11:53:20 +02:00
Christoph Oelckers
00c8c6e3b2 - generate vertices for skybox sectors in the processing pass.
Aside from the sprites this was the only other remaining use of FQuadDrawer.
2018-10-20 11:22:55 +02:00
Christoph Oelckers
e5ff500c5a - rewrote render hacks to prepare their vertex data in the processing pass.
This eliminates 3 of the 5 remaining occurences of FQuadDrawer and gets a large section of code out of the GL backend into the common hardware rendering code.

# Conflicts:
#	src/gl/scene/gl_scene.cpp
2018-10-20 10:56:12 +02:00
Christoph Oelckers
c5d1b884dd - fixed incorrect block size calculation. 2018-10-20 10:50:22 +02:00
Christoph Oelckers
6f81310fa7 Reinstate light buffer resizing, using the same method as for the model matrix buffer 2018-10-20 10:50:02 +02:00
Christoph Oelckers
ad80efd6be Prepared light buffer for multithreaded use
This necessitated removing the reallocator because that cannot be done in a multithreaded context in OpenGL. The buffer should be large enough anyway, it it all gets used, slowdowns would be unavoidable.

There was also some simplification of the buffer alignment math for uniform buffers
2018-10-20 10:49:06 +02:00
Christoph Oelckers
84a55667d9 - removed more old code from flat renderer.
VBOHeightCheck was from early development when interpolation was not reflected by the vertex buffer.

# Conflicts:
#	src/gl/scene/gl_flats.cpp
2018-10-20 10:39:28 +02:00
Christoph Oelckers
07649fd31a - removed some leftover code for handling dynamic lights in the render pass.
# Conflicts:
#	src/gl/scene/gl_flats.cpp
2018-10-20 10:36:39 +02:00
Christoph Oelckers
acb9505606 - fixed cherry-picked commit so that modern OpenGL can still do the light setup in the render pass. 2018-10-20 10:33:26 +02:00
Christoph Oelckers
a9c8546ba3 - changed dynamic light setup so that it is completely in the processing pass, not the render pass.
# Conflicts:
#	src/gl/scene/gl_flats.cpp
#	src/hwrenderer/scene/hw_flats.cpp
2018-10-20 09:46:53 +02:00
Christoph Oelckers
c8852b8fea - enabled the linear shadowmap filter.
Although this doesn't look as good as the PCF version it is a lot less calculation intensive and therefore more suitable for weaker hardware.
It also tends to bleed through walls a lot less.
2018-09-29 13:23:40 +02:00
Christoph Oelckers
bc1e659c7b Revert "- reworked fog uniforms to move the global fog mode setting to the viewpoint buffer."
This reverts commit 8b26b6dd1e.

This was causing problems with light mode 2 because some edge cases were no longer handled properly.
2018-09-16 22:38:20 +02:00
Christoph Oelckers
e13d1e4d0d - do not render lights from uninitialized data. 2018-09-16 13:52:02 +02:00
Christoph Oelckers
2d53ad6f10 - fixed misplaced parenthesis. 2018-09-09 19:18:22 +02:00
Christoph Oelckers
1eb1d8d280 - fixed math imprecisions in horizon vertex generation.
Floats are not precise enough to be used as a loop counter.
2018-09-09 08:57:50 +02:00
Christoph Oelckers
1c3d4b46c6 - fixed the use of Doom-Legacy-style 3D floor lighting in light mode 8.
Legacy used some strange blending formula to calculate its colormaps for colored 3D floor lighting, this is not available in the software lighting mode, so for these the engine has to temporarily revert to light mode 2 to render them correctly.
2018-09-08 13:08:04 +02:00
Christoph Oelckers
3dcaa509ef Merge branch 'master' of https://github.com/coelckers/gzdoom 2018-09-08 12:10:34 +02:00
Christoph Oelckers
dd971805af - fixed: The viewpoint buffer was mapped write only but read from. On old hardware it wasn't even mapped.
Changed to cache the needed value in a CPU-side array so that the buffer access is not needed.
2018-09-08 10:16:31 +02:00
Christoph Oelckers
8b26b6dd1e - reworked fog uniforms to move the global fog mode setting to the viewpoint buffer. 2018-09-06 19:14:30 +02:00
Christoph Oelckers
22e8c57a59 - reset the viewpoint buffer only once per scene, not per viewpoint.
This doesn't work for camera textures because they are a separate viewpoint.
2018-09-02 20:05:36 +02:00
Christoph Oelckers
5e39890118 - use a uniform buffer for per-scene data like rotation matrices. 2018-09-02 18:40:36 +02:00
Christoph Oelckers
b570f28597 - restored block of code that got deleted by a bad merge of a cherry-picked commit. 2018-09-02 12:43:13 +02:00
Christoph Oelckers
bec588eaf4 - moved the two remaining functions from gl_wipe.cpp to gl_framebuffer.cpp and deleted the file.
The single most hideous thing in the GL renderer is finally gone. :)
2018-09-02 12:03:18 +02:00
Christoph Oelckers
9af01c4667 - Untested wipe refactor
# Conflicts:
#	src/gl/renderer/gl_renderer.cpp
#	src/gl/system/gl_wipe.cpp
#	src/hwrenderer/scene/hw_attributebuffer.cpp
2018-09-02 12:02:36 +02:00
Christoph Oelckers
ecf6e3f620 Sanitized the Being/End2D interface so that it can be used to keep the attribute buffer mapped while processing 2D commands.
For this to work the 2D mode has to be properly set and unset at the right places so that no double mapping occurs and no render operation can happen while in 2D mode.

# Conflicts:
#	src/d_main.cpp
#	src/v_video.h
2018-09-02 11:59:01 +02:00
Christoph Oelckers
2d1043d1d3 - added profiling for postprocessing code. 2018-09-02 11:35:02 +02:00
Christoph Oelckers
5b7d3c91f9 - defaulted constructors and assignment operators of several trivial types. 2018-08-25 23:51:36 +02:00
Christopher Bruns
03fa1a12cb Avoid overriding vr eye-specific buffer binding during 2D rendering. 2018-08-20 00:59:52 +02:00
alexey.lysiuk
b6ff468aaf - creation of dither texture no longer affects active unit
Red checkerboard was rendered upon startup instead of
* the first saved game's thumbnail
* the first game frame
2018-08-12 10:55:24 +03:00
Christoph Oelckers
19a5a2fd2b - fixed dither math. 2018-08-11 09:27:35 +02:00
Rachael Alexanderson
ecdc485e05 - Allow specifying monitor bits-per-channel for dithering output. Not all displays are created equal, so this option is actually important for specifying the exact amount for your display. 2018-08-09 15:13:26 -04:00
Magnus Norddahl
d121fa21bf - add gl_dither for toggling dithered output on and off 2018-08-08 21:58:23 +02:00
Christoph Oelckers
863b9fff8a
Make dither texture data constant 2018-08-08 08:43:46 +02:00
Rachael Alexanderson
24e2c3a611 - replace dither texture with a hand pre-calculated table) 2018-08-07 20:47:17 -04:00
Magnus Norddahl
31addbc859 - use a texture for the dither matrix 2018-08-08 00:54:12 +02:00
Magnus Norddahl
48c83d36b5 - add post processing support to the software renderer and softpoly 2018-08-04 14:58:55 +02:00
Magnus Norddahl
5b8a016cad - add vid_hdr cvar that enables higher than 8bpc output for monitors that support it 2018-07-30 22:01:05 +02:00
Christoph Oelckers
7e69cd862e - restore the viewport after the SSAO pass.
This runs through the generic postprocessing code which restores the screen's viewport but since this is run in the middle of the scene it needs to restore the scene's viewport (i.e. the window controlled by screenblocks.)
2018-07-28 19:01:34 +02:00
Christoph Oelckers
9768698eda - do not use SSBOs for dynamic lights on Intel graphics hardware for performance reasons.
This was already disabled for GL 4.4 and lower but also needs to be done for Intel's GL 4.5 drivers.
Unlike before this is now exclusive to the light buffer, the shadowmap feature is not affected anymore, although that should be impossible to use anyway on all affected hardware due to lack of computing power.
2018-07-28 12:43:35 +02:00
Christoph Oelckers
3b53f31da3 - default to fullscreen display. 2018-07-28 10:05:50 +02:00
Christoph Oelckers
96bb8a779c - fixed incomplete reordering of code. 2018-07-23 21:17:57 +02:00
Christoph Oelckers
6076f0a69d - disable any texture clamping for textures with a user shader.
This cannot be reliably determined so the least restrictive setting must be used.
2018-07-23 17:53:35 +02:00
Christoph Oelckers
2382b9a238 - fixed: GLScenePortal did not forward IsSky to its backing object. 2018-07-22 21:18:00 +02:00
Christoph Oelckers
d84497c85a - don't let the video scale let the screen end up with a client size less than 320x200, which may cause undefined behavior and trigger asserts in debug builds. 2018-07-22 11:40:12 +02:00
Christoph Oelckers
6ca2b3fce1 - fixed display for smaller screeblocks value.
When refactoring the screen scaling one line too many was altered by accident.
2018-07-21 12:13:17 +02:00
Christoph Oelckers
57f65a9379 - fixed: The 2D drawer did not restore the blend mode after finishing. 2018-07-20 19:46:53 +02:00
Christoph Oelckers
4a7b1aada7 Merge remote-tracking branch 'remotes/origin/modern'
# Conflicts:
#	wadsrc/static/shaders/glsl/main.fp
2018-07-20 10:19:07 +02:00
Magnus Norddahl
a841602d70 - change the software renderer to render to a DSimpleCanvas like the old D3D9 target did. Then use the drawer threads to memcpy the result to the PBO 2018-07-20 05:48:15 +02:00
Magnus Norddahl
7da61ddfee - fix missing forward declaration when falling back to older user shaders 2018-07-19 02:34:45 +02:00
Magnus Norddahl
a0a7fd53e8 - change software renderer back to writing directly into the pixel buffer object, but change the creation and mapping so that hopefully all vendors put it in system memory 2018-07-18 17:47:09 +02:00
Magnus Norddahl
23c0f8f6ac - fix buffer usage warning caused by using the wrong flag for glMapBuffer after switching to doing a plain memcpy 2018-07-18 16:04:35 +02:00
Magnus Norddahl
e93d1e3ebc - change software renderer upload code to use GL_STREAM_DRAW and a memcpy from system memory 2018-07-18 06:46:30 +02:00
Magnus Norddahl
8a500a25f5 - rewrite the user shader support for materials - new syntax is to create a 'Material ProcessMaterial()' function 2018-07-15 23:01:40 +02:00
Christoph Oelckers
f62e2f9ba3 - fixed: The stencil cap may never write to the depth buffer.
Due to the way nested portals work this will block rendering of the nested cap entriely and cause some visual glitches when looking straight up or down in such a sector.
2018-07-15 19:16:12 +02:00
Christoph Oelckers
2c86c4e942 - fixed: When deleting a camera texture's depth buffer, the corresponding variable must also be cleared.
Thanks to OpenGL's messed up state system this didn't cause some clear failure but just reused the last bound buffer instead which may not have had a matching size.
2018-07-15 10:55:34 +02:00
Christoph Oelckers
d58d1e21d0 - removed the texture invalidation check from FHardwareTexture.
This is not needed anymore because only warp and camera textures still implement CheckModified and both are excluded here.
2018-07-15 00:28:16 +02:00
Christoph Oelckers
33ee0f3c27 Merge branch 'master' into modern
# Conflicts:
#	src/gl/renderer/gl_renderer.cpp
#	src/gl/renderer/gl_renderer.h
#	src/gl/renderer/gl_renderstate.h
#	src/gl/system/gl_framebuffer.cpp
#	src/gl/system/gl_framebuffer.h
2018-07-14 13:18:34 +02:00
Christoph Oelckers
7817e6a7b2 - moved the texture binding code back to the OpenGL specific parts.
turns out that this cannot be consolidated with Vulkan because the semantics are far too different here.
2018-07-14 13:05:49 +02:00
usernameak
e306d4ee04 Fix codestyle; add ability to name the textures 2018-07-14 12:01:54 +02:00
usernameak
fa51a54042 Made ability to define custom material shaders for ProcessMaterial function 2018-07-14 12:01:54 +02:00