Commit graph

323 commits

Author SHA1 Message Date
myT
249bcb2d07 caching the current active texture slot in GL3
it reduces the total number of API calls by a good amount
2020-10-08 04:45:33 +02:00
myT
2aaf17b061 fixed the GL3 debug uniform location check
it would incorrectly trigger with r_alphaToCoverage 1 and r_msaa 0
2020-10-08 04:19:20 +02:00
myT
633c5bd13c tweaked the draw surface sort key for better performance
it minimizes depth fade <-> generic pipeline transitions
2020-10-08 04:08:38 +02:00
myT
78cf275a62 fixed depth fade with MSAA in the GL3 backend 2020-10-08 03:55:40 +02:00
myT
427172edcf fixed D3D11 device resets being sometimes treated as fatal errors
after getting DXGI_ERROR_DEVICE_REMOVED or D3DDDIERR_DEVICEREMOVED,
GetDeviceRemovedReason can return DXGI_ERROR_DEVICE_RESET
this particular case should trigger a video restart instead of a fatal error
2020-07-07 09:07:53 +02:00
myT
49028a3f36 simplified the new D3D11 partial clear code to not needlessly change primitive topology 2020-07-07 04:44:31 +02:00
myT
a5c820644a CVar slots that have been freed can now be allocated again 2020-07-07 04:25:21 +02:00
myT
7412c4b373 added r_alphaToCoverageMipBoost and did some other changes to A2C
- r_alphaToCoverageMipBoost scales the alpha value based on the current texture LoD
  this prevents the "fading with distance" effect
- mip 0 dimensions are tested to decide whether contrast boosting around 0.5 is enabled
  this is to deal with high r_picmip configs
- improved algorithm for excellent sharpness and minimized temporal artefacts
- GLSL 4.00 is required for the GL3 backend to use A2C (for textureQueryLod)
2020-07-07 03:49:52 +02:00
myT
180a0187b7 fixed the R_AddWorldSurface optimization so it won't remove the sky 2020-06-20 03:04:00 +02:00
myT
70ba2e7939 fixed and improved GL3 shader uniforms caching 2020-06-20 02:28:55 +02:00
myT
6fcabd83b7 fixed D3D11 partial render target clears
viewport/scissor settings do NOT apply to:
- ClearDepthStencilView
- ClearRenderTargetView

hence this fix
2020-06-18 04:19:34 +02:00
myT
05d92ab6f0 1.52 release 2020-06-01 21:08:56 +02:00
myT
54ee6436fe updated copyright years 2020-06-01 20:28:44 +02:00
myT
178a61b953 fixed r_mode 1 issues with the D3D11 backend (screenshots and scissor rects)
the issues were:
- screenshots were black because of mismatched dimensions in the CopyResource call
- display was showing garbage because the scissor rect was too large
2020-05-11 20:07:29 +02:00
myT
f484ee94a7 fixed alpha to coverage for the greater than 0 alpha test 2020-05-09 17:11:47 +02:00
myT
d6f77a9b35 fixed crashes due to render command list overflows
also increased the buffer's size (e.g. to draw all chars in the console in 4K)

one of the crashes happens in R_SortDrawSurfs:
-> render command list is too full
-> RE_EndFrame returns early because it can't allocate RC_SWAP_BUFFERS
-> R_ClearFrame in RE_EndFrame doesn't get called
-> the next frame starts with r_firstSceneDrawSurf etc. not being reset to 0
-> r_firstSceneDrawSurf becomes really close to the maximum draw surface limit
-> the draw surface list is iterated incorrectly (no wrapping handled)
-> we fetch a draw surface we shouldn't
-> its sort key gets decoded and we get an invalid sorted shader index
-> we fetch a NULL shader at that index location
-> we attempt to read shader->sort
-> we crash reading address 76
-> 76 bytes is exactly the offset of the sort member into the shader_t struct
2020-05-08 03:38:26 +02:00
myT
1cf28d87fe r_speeds is no longer cheat-protected 2020-04-28 17:20:02 +02:00
myT
1994475982 renamed r_noiseScale to r_ditherStrength for consistency 2020-04-28 17:04:43 +02:00
myT
718b966414 depth fade fixes and improvements
- renamed r_softSprites to r_depthFade
  the term's more descriptive and it helps that UE4 uses it
- fixed the GL3 fragment shader halving the depth bias
- fixed the D3D11 pixel shader only fetching depth sample 0
  not fixed for GL3 yet, see the code comments for that
- added support for more blend states
- added the q3map_cnq3_depthFade general shader directive
2020-04-26 16:32:51 +02:00
myT
a59875200c fixed the D3D11 back-end sometimes colorizing mip level 0 with r_gpuMipGen 1 and r_colorMipLevels 0
it happened because the color channels for blendColor weren't initialized,
that memory could have at least one channel initialized as a NaN value and
throwing a NaN in the shader logic would break it
2020-04-16 05:24:11 +02:00
myT
a5e28eb08f added r_transpSort and we can now sort all surface types by depth
also fixed up RE_AddPolyToScene's overflow check
2020-04-16 05:01:48 +02:00
myT
0fcd462244 improved the map download initiation logic and updated the CNQ3 map server addresses 2020-04-06 03:46:14 +02:00
myT
7c56c41968 fixed a formatting issue in the build guide 2020-04-05 06:56:24 +02:00
myT
4e9d0ad709 fixed the soft sprite status console print always saying it's "ON" with GL3 and D3D11 2020-04-05 06:40:34 +02:00
myT
a5b6ee33da made more keys bindable on Linux/FreeBSD and /bind now accepts uppercase hex digits 2020-04-04 03:20:03 +02:00
myT
d5984db690 removed r_nobind and r_showImages, wrote help etc. for the renderer's other temp/cheat CVars 2020-04-02 05:06:00 +02:00
myT
546296e6ef fixed r_showsky and cleaned up the related GAL code 2020-04-02 04:50:12 +02:00
myT
24e6cd9277 GL3 can now print shader compile/link warnings even when successful with r_verbose 1 2020-04-02 04:40:12 +02:00
myT
e013893c1b fixed GL3 generic program link issue due to variable type qualifier mismatches (centroid vs not)
this problem proved fatal on some Intel drivers
2020-04-02 04:37:03 +02:00
myT
9e061c4aff increased the small zone's size 2020-03-30 03:55:21 +02:00
myT
89aca4069e now fixing up the CVar hash table in Cvar_Nuke 2020-03-30 03:09:25 +02:00
myT
ae30c5a311 r_mapBrightness can now be used with r_fullbright for lightmapped surfaces 2020-02-27 05:26:19 +01:00
myT
69d6cdf42b fixed r_detailTextures 0 messing up shaders 2020-02-27 05:22:06 +01:00
myT
f773d2a783 fixed dynamic light face culling using the untransformed (world-space) light position 2020-02-26 23:01:28 +01:00
myT
c8205f9e4e fixed the Windows build and updated the build docs
- no absolute paths in the pre-build commands for compiling HLSL shaders
- can set a custom fxc.exe path through the FXCPATH environment variable
2020-02-25 10:37:02 +01:00
myT
7b01f8b8d3 fixed a bunch of variable shadowing cases and removed unused variables 2020-02-24 01:52:29 +01:00
myT
36f363b47a D3D11 tweaks, added r_d3d11_presentMode, removed r_d3d11_maxQueuedFrames
the D3D11 tweaks:
- better error message formatting
- D3DDDIERR_DEVICEREMOVED from Present is a fatal error too
- synchronized offsets is always the automatic behavior for now
  it turns out that split mode isn't always the fastest for nVidia
2020-02-24 01:48:43 +01:00
myT
85583acc9c dynamic lights apply to even more surfaces and have a nicer fall-off
- ditched vertex colors (not wanted) and alpha tests (not needed) in the shaders
- using a Bezier fall-off to get much softer edges
- added no-depth-write transparent surfaces support by adjusting the depth test
- multiplying the diffuse texture's color by its alpha in non-opaque passes
- fixed triangle rejection based on cull type and normal direction
- reflecting normals in shaders to support two-sided surfaces
- rejecting surfaces with no diffuse stage or bad blend states as early as possible
- liquids get lit weaker than other surfaces
2020-02-21 08:26:12 +01:00
myT
8ef496d22b reverting to old code for .tga image decoding, but with tweaks and fixes
the problem is that stb_image can and will allocate much more than it needs to
e.g. for a 2048x2048 BGR image:
it allocates an unnecessary intermediate 12 MB buffer to decode the image
instead of decoding it directly into the final 16 MB RGBA buffer

the old CNQ3 code didn't decode greyscale properly because of a missing macro call
it also didn't range-check memory accesses at all
2020-02-18 04:42:28 +01:00
myT
8a1d1c539b Escape down in cgame triggers CG_EVENT_HANDLING again instead of CG_KEY_EVENT
with that, CPMA demo playback and /protect work as intended again
2020-02-09 04:25:31 +01:00
myT
ca9757082f r_colorMipLevels disables MSAA when centroid sampling would be used
this is because it would draw (parts of) geometric edges with different colors and that makes visual inspections annoying
also, final MSAA sample counts are always reported by GL3 and GL2 now
2020-02-05 03:43:19 +01:00
myT
c72c8d5ad7 fixed r_fastsky handling in the GL3 renderer back-end 2020-01-19 22:38:35 +01:00
myT
01ce4063b5 added r_lightmapGreyscale
thanks to Jakub 'kubaxvx' Matraszek for his contribution
2020-01-12 23:03:54 +01:00
myT
e91f6e1c08 re-added r_textureMode to keep GL_NEAREST compatibility 2020-01-12 23:03:41 +01:00
myT
f36392c128 fixed r_lightmap affecting non-opaque surfaces 2020-01-09 23:09:39 +01:00
myT
9366ee5130 fixed r_picmip incorrectly applying to external lightmap atlases 2020-01-07 22:54:48 +01:00
myT
7d526ba6fc added FreeBSD support 2020-01-06 01:04:16 +01:00
myT
b2445488a4 partial D3D11 init and shutdown for OBS' benefit
- OBS' game capture plug-in can't handle swap chains changing while capture is active
- loading a map and disconnecting will no longer break the capture
- vid_restart will still break the capture
2019-12-26 16:30:07 +01:00
myT
e16804a0cb fixed A2C by making sure we use the absolute values of the derivatives 2019-12-26 16:26:12 +01:00
myT
9cb02a32bf searching for valid sample counts for MSAA in GL2 and GL3 instead of failing 2019-12-26 16:24:22 +01:00