View Issue Details

IDProjectCategoryView StatusLast Update
0006349The Dark ModGraphicspublic07.01.2025 21:48
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilitysometimes
Status feedbackResolutionopen 
Product VersionTDM 2.11 
Target VersionTDM 2.14 
Summary0006349: Cleaning the scissors mess
DescriptionThis started as a bug for low renderscale (0006214).

I think it's time to refactor the whole scissor thing to make it better:
1) Try to make idScreenRect non-inclusive on right side, aka [L..R) --- not sure that would be easy, but such representation is much better.
2) When idScreenRect is computed, it is rounded down then expanded by 1 pixels in all directions. Instead of expanding, just round properly (maybe with tolerance, but no need to expand on lower side).
3) Make a single function to convert from vidsize rectangle to currentFBO rectangle, instead of two functions GL_ScissorVidSize, GL_ViewportVidSize and third function CalcScissorParam in DepthStage. Make sure it is conservative.
4) Do the same for "Relative" case, and make sure it is conservative too.
5) Make sure r_glScissor is respected everywhere, put moving it into scissor wrappers and getting rid of direct scissor API calls.
6) Wrap scissor state into some kind of auto-restore helper to avoid state leaks (this includes both on/off and the rectangle itself).
TagsNo tags attached.

Relationships

related to 0006214 resolvedstgatilov Scissoring issue on low renderscale 

Activities

stgatilov

stgatilov

08.01.2024 10:01

administrator   ~0016346

I guess viewport should be wrapper too.
Subviews (like remote render) have custom viewport, and it is easy to break it.
stgatilov

stgatilov

05.03.2024 08:40

administrator   ~0016562

Regarding point 5, this is resolved in:
  r10659. Fixed "r_useScissor 0" case.

Now r_useScissor only applies to the case when scissor is used for optimization and depends on view.
Scissors which are required for correctness are applied regardless of this cvar value, like limiting render region during shadow map fill.
nbohr1more

nbohr1more

07.01.2025 21:24

developer   ~0016937

Anything left to do?
stgatilov

stgatilov

07.01.2025 21:46

administrator   ~0016938

Yes, I never finished anything here.

The plan was to switch from idScreenRect which uses integers in virtual resolution to something new with [0.0 .. 1.0] range.
I even started doing it recently.
But it is pretty big task, which has to be done in one go.

I'll move it forward.

Issue History

Date Modified Username Field Change
06.12.2023 20:01 stgatilov New Issue
06.12.2023 20:01 stgatilov Status new => assigned
06.12.2023 20:01 stgatilov Assigned To => stgatilov
06.12.2023 20:01 stgatilov Issue generated from: 0006214
06.12.2023 20:01 stgatilov Relationship added related to 0006214
08.01.2024 10:01 stgatilov Note Added: 0016346
05.03.2024 08:40 stgatilov Note Added: 0016562
07.01.2025 21:24 nbohr1more Note Added: 0016937
07.01.2025 21:24 nbohr1more Status assigned => feedback
07.01.2025 21:46 stgatilov Note Added: 0016938
07.01.2025 21:48 stgatilov Target Version TDM 2.13 => TDM 2.14