47 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 a9c782bfcf SoftGPU: Recompute the raster state after a JIT cache clear
A code space clear frees the functions the current state points to, but
the state was kept as long as the GE registers didn't change. Track the
clear generations and recompute, also when a compile during the state
computation clears the caches.

Also skip the binner flush for compiles on builds without the software
JIT, where Compile() does nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-29 09:35:17 -06:00
Herman Semenov b57dab2812 [GPU] Make static and const methods if possible 2024-04-05 17:04:31 +03:00
Henrik Rydgård 10f93875c6 Fix the semantics of DenseHashMap to be consistent even when inserting nulls 2023-09-11 12:07:18 +02:00
Unknown W. Brackets cd3fc26190 samplerjit: Prevent thread local stale cache read.
If the generation count happens to match, would still get a stale pointer
and crash.  Let's just make the generation count static so it always
increases.
2023-02-22 21:15:03 -08:00
Unknown W. Brackets d9522a7ac5 softgpu: Avoid clear hazard for last cached funcs. 2022-12-06 21:23:56 -08:00
Unknown W. Brackets eda3ce556e softgpu: Avoid atomic structs.
Apparently we don't link libatomic and rather than fighting that, I'll
just use thread local values.
2022-12-06 20:35:07 -08:00
Unknown W. Brackets 400f6abf9a softgpu: Optimize lookup of last jit func.
This is common (for example, maybe a pixel state is updated but sampler is
not), and reduces time spent in ComputeRasterizerState() quite a bit in
Darkstalkers, where jits are available (i.e. Intel currently.)
2022-12-06 19:16:19 -08:00
Unknown W. Brackets 87fb9eef37 softgpu: Remove std::function usage.
Wanted to avoid coupling these, but don't like the std::function
construct/destructs showing in profiles...
2022-12-06 19:15:57 -08:00
Unknown W. Brackets 778a0487cb softjit: Switch to DenseHashMap. 2022-12-02 20:59:13 -08:00
Unknown W. Brackets 4d06400548 softgpu: Fix compile hazard while running.
This prevents any clearing of cache while other threads may be using
previously cached funcs, and avoids wx exclusive hazards.
2022-11-20 12:04:02 -08:00
Unknown W. Brackets ce51942508 softgpu: Correct WX-exclusive platform hazards.
Should mainly affect BSD at this point.
2022-11-20 10:55:35 -08:00
Unknown W. Brackets 6e6535c263 softjit: Skip reading dst pixel where blended out.
Sometimes used by blends used purely to multiply the source color by
something, usually prep for bloom.
2022-09-24 02:00:03 -07:00
Unknown W. Brackets e72309745e softjit: Implement accurate fog color blending. 2022-09-11 08:50:07 -07:00
Unknown W. Brackets 15d5fa48f7 softgpu: Check depth test early on simple stencil.
If we don't need to write stencil on sfail/zfail, we can do the depthtest
early, which allows us to more often skip texture sampling.

This gives a good improvement in Chains of Olympus.
2022-09-10 21:24:19 -07:00
Unknown W. Brackets c2985bca31 softjit: Centralize some common funcs from sampler.
No need to duplicate this code.
2022-01-19 00:03:59 -08:00
Unknown W. Brackets ac2b96cec0 softjit: Switch to constant pool.
This is simpler without RIP access checks, and tends to be fast.
2022-01-17 19:50:37 -08:00
Unknown W. Brackets 092b03bd67 softgpu: Move fixed blend factor to draw pix state.
This is the last of the gstate.
2022-01-15 13:03:11 -08:00
Unknown W. Brackets f1ce2e7715 softgpu: Cache minz/maxz in draw pixel state. 2022-01-15 13:03:10 -08:00
Unknown W. Brackets 961cfcd75c softjit: Add describes here too.
Helpful to aggregate when there are multiple rasterizers.
2022-01-03 06:45:10 -08:00
Unknown W. Brackets 355bad666c softjit: Optimize common case bloom blending.
Bloom often uses fixed ONE + ONE, which is a lot less work for us.  And
bloom often runs over and over again on pixels, so saving work is good.
2022-01-02 08:47:04 -08:00
Unknown W. Brackets ce3e29a649 softjit: Fix a function arg template warning.
We're just ignoring it because it's a false positive in this case.
2021-12-11 10:45:27 -08:00
Unknown W. Brackets 96a7554053 sofjit: Move common types to reg cache header.
This makes it easier to use vectors elsewhere.
2021-11-28 08:03:15 -08:00
Unknown W. Brackets 3d5bced296 softjit: Rename reg cache so it can be reused.
Intentionally just the name changes in this commit.
2021-11-28 08:03:15 -08:00
Unknown W. Brackets 4703b6cb56 softjit: Cleanup, add other arch types to regcache. 2021-11-28 08:03:15 -08:00
Unknown W. Brackets c1882fa1c0 softjit: Disallow use of register after unlock. 2021-11-28 08:03:14 -08:00
Unknown W. Brackets 2f039abd13 softjit: Simplify regcache usage as purpose only.
Dealing with types was annoying, and this helps validate the right
register is released.
2021-11-28 08:03:14 -08:00
Unknown W. Brackets cc099c73f1 softjit: Decide stack offset on compile.
This makes it easier to compile different entries or push regs.
2021-11-28 08:03:14 -08:00
Unknown W. Brackets e1ed49a3e4 softjit: Ensure all regs are released. 2021-11-28 08:03:14 -08:00
Unknown W. Brackets d53e13b862 softjit: Manage args in the register cache. 2021-11-28 08:03:13 -08:00
Unknown W. Brackets 446eec0dff softjit: Keep color 16-bit when useful.
Reuse it expanded where we can, in case of dither+fog+blend, etc.
2021-11-26 09:30:48 -08:00
Unknown W. Brackets c62457bb33 softjit: Optimize common blend inverse alpha case. 2021-11-26 09:30:48 -08:00
Unknown W. Brackets 1fa4e6ba2c softjit: Add alpha blending factors. 2021-11-26 09:30:48 -08:00
Unknown W. Brackets bc8d5ad372 softjit: Cache zero vector to avoid recreating. 2021-11-26 09:30:48 -08:00
Unknown W. Brackets 7f167c3660 softjit: Implement min/max/absdiff blending.
Alpha not yet implemented.
2021-11-26 09:30:47 -08:00
Unknown W. Brackets 6644c4225c softjit: Apply logic ops. 2021-11-26 08:21:14 -08:00
Unknown W. Brackets a49a189962 softjit: Refactor color conv to dedicated funcs.
Will use this for masking too.
2021-11-26 08:21:14 -08:00
Unknown W. Brackets edb21b57bb softjit: Initial color write.
At this point, it's used in some areas in some games.
Alpha blending is the main unimplemented path, then logic/masking.
2021-11-26 08:21:13 -08:00
Unknown W. Brackets 0e63b357b3 softjit: Add dithering. 2021-11-26 08:21:13 -08:00
Unknown W. Brackets 5ee4bdbe05 softjit: Depth and stencil testing. 2021-11-26 08:21:13 -08:00
Unknown W. Brackets 2423285831 softjit: Add helpers to get framebuf offsets. 2021-11-26 08:21:12 -08:00
Unknown W. Brackets f8819308ff softjit: Add levels of register locking.
Locking also in helpers, so need to nest locks.
2021-11-26 08:21:12 -08:00
Unknown W. Brackets 1e00a3b842 softjit: Add color test. 2021-11-26 08:21:12 -08:00
Unknown W. Brackets d9f7b9cca2 softjit: Initial depthrange, fog.
Not really tested, just filling out parts.
2021-11-26 08:21:12 -08:00
Unknown W. Brackets 9fed7ea732 softjit: Add register cache for softjit. 2021-11-26 08:21:11 -08:00
Unknown W. Brackets 91787e63d9 softjit: Switch to the __vectorcall convention. 2021-11-26 08:21:11 -08:00
Unknown W. Brackets ae3299ea04 softjit: Add stubbed DrawPixel for x64. 2021-11-26 08:21:11 -08:00
Unknown W. Brackets 09dc38080a softgpu: Move draw pixel code to separate file.
This separates things better anyway.  No major perf impact.
2021-11-21 08:23:32 -08:00