summaryrefslogtreecommitdiff
path: root/src/shader_recompiler
AgeCommit message (Collapse)Author
2025-05-12socket: Implement missing errno values and improve network error handlingZephyron
Add support for missing errno values needed by TOTK: - Add BUSY (16) for "Device or resource busy" errors - Add NOTSOCK (88) for "Socket operation on non-socket" errors Improvements: - Update TranslateNativeError on both Windows and Unix to handle new error codes - Change socket error logging for NOTSOCK from WARNING to DEBUG level - Fix formatting in Unix errno translation code - Update shader storage buffer tracking range to accommodate TOTK buffers - Add hex format to storage buffer logging for easier comparison with bias range - Change storage buffer tracking log level from WARNING to DEBUG These changes help prevent error messages in games that use network features not fully implemented in the emulator yet. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12nvn(fix): Optimize shader performance by enhancing NVN bias settingsZephyron
Improve GPU storage buffer detection and memory access patterns: - Expand NVN bias address range (0x100-0x800 vs 0x110-0x610) - Increase alignment from 16 to 32 bytes for optimal memory access - Raise default alignment from 8 to 16 bytes for non-biased addresses - Refactor bias handling code for better readability - Add detailed performance-related comments These changes help identify more storage buffers within shaders and ensure memory accesses are better aligned, which improves overall shader compilation and execution performance. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12shader_recompiler: Implement vertex count lookup for Geometry stageZephyron
Add proper handling of input topologies in the Geometry stage for all three shader backends (GLASM, GLSL, SPIRV). This implementation uses a lookup table approach to determine vertex counts based on input topology type (Points, Lines, LinesAdjacency, Triangles, TrianglesAdjacency) and shifts the vertex count by 16 bits as required by the invocation info format. Additional changes: - Fixed TessellationControl and TessellationEval stages to properly break after emitting code - Added proper header include for runtime_info.h in GLASM backend - Improved code documentation with clear commenting patterns This change ensures accurate geometry shader behavior across all backends, improving compatibility with games that rely on proper vertex count reporting. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12build: upgrade fmt and SDL2Zephyron
Update fmt library to version 11.0.2 and make necessary adjustments: - Replace fmt/format.h includes with fmt/ranges.h - Add const qualifiers to formatter::format functions - Update CMake to require fmt version 11 Additional dependency updates: - Update SDL2 bundled version from 2.28.2 to 2.32.0 - Update catch2 to version 3.7.1 - Update vcpkg baseline to ca846b21276c9a3171074ac8d2b4f6516894a7d0
2025-05-11shader: Implement EmitInvocationInfo across all backendsZephyron
- Add proper invocation info handling for tessellation and fragment stages - Return patch vertices info shifted by 16 bits for tessellation stages - Return sample mask shifted by 16 bits for fragment stage - Return standard format (0x00ff0000) for compute and other stages - Implement consistently across SPIRV, GLSL, and GLASM backends - Remove stubbed warning message
2025-05-11shader_recompiler: Add stubs for CSM/FCSM flow test conditionsZephyron
Add stub implementations for previously unhandled flow test conditions in the shader recompiler's IR emitter. These conditions were previously throwing "Not Implemented" exceptions when encountered. The following flow test cases are now stubbed: - FCSM_TR (Fragment Shader Coarse/Fine Mode Test and Reject) - CSM_TA (Coarse/Fine Mode Test Accept) - CSM_TR (Coarse/Fine Mode Test and Reject) - CSM_MX (Coarse/Fine Mode Maximum) - FCSM_TA (Fragment Shader Coarse/Fine Mode Test Accept) - FCSM_MX (Fragment Shader Coarse/Fine Mode Maximum) Currently these stubs: 1. Return false (ir.Imm1(false)) as a placeholder value 2. Log a warning message indicating the stub 3. Allow shaders using these conditions to compile rather than fail This is a step toward proper implementation of coarse/fine mode shader operations. The stubs prevent crashes while making it clear which code paths need full implementation. Technical notes: - Removed the previous FCSM_TR implementation that used flag operations - Added consistent warning messages for tracking stub usage - Kept within the existing GetFlowTest switch statement structure
2025-05-11shader_recompiler: Fix ISBERD instruction implementationZephyron
- Simplify ISBERD instruction to handle register-to-register moves - Remove incorrect CompositeConstruct usage - Replace with direct register value passing - Fix compilation errors in internal stage buffer handling
2025-05-11shader_recompiler: Use FPRecip in FSWZADD implementationZephyron
Simplifies the negative reciprocal calculation in FSWZADD by using the dedicated FPRecip operation instead of manually constructing a division. This change: - Replaces FPDiv(Imm32(f32(1.0f)), src_b) with FPRecip(src_b) - Results in more efficient code for calculating 1.0/x - Fixes build errors from undefined IR emitter methods
2025-05-11shader_recompiler: Fix method names in FSWZADD implementationZephyron
Fixes incorrect method names in the floating point swizzled add implementation: - FNeg -> FPNeg - FDiv -> FPDiv - FImm32(1.0f) -> Imm32(ir.f32(1.0f)) These changes align with the correct IR emitter interface naming conventions, where floating-point operations use the 'FP' prefix and immediate values are properly constructed using f32().
2025-05-11shader_recompiler: Implement ISBERD instructionZephyron
Implements the Internal Stage Buffer Entry Read (ISBERD) instruction in the Maxwell shader recompiler. This replaces the previous stubbed implementation with actual buffer reading functionality. The implementation: - Validates unsupported features (skew, o, mode, shift) - Performs buffer read using IR::InternalStageBufferRead - Stores the read value to the destination register This removes the "(STUBBED) called" warning messages that were previously being logged during shader compilation.
2025-05-11shader_recompiler: Implement ISBERD instruction modes and shiftsZephyron
Implements the ISBERD (Internal Stage Buffer Entry Read) instruction's mode and shift options that were previously throwing NotImplemented exceptions. This includes: - Patch mode for reading patch data - Prim mode for reading primitive data - Attr mode for reading attribute data - U16 shift for 16-bit unsigned values - B32 shift for 32-bit values The implementation follows Maxwell's ISA specification for handling different buffer read modes and data shifts.
2024-12-20shader/recompiler: Revert NVN storage buffer bias rangeEmulationEnjoyer
- Return to original NVN bias values which better cover the full range of storage buffer accesses: - offset_begin: 0x110 -> 0x100 - offset_end: 0x610 -> 0x700 The wider range ensures we catch all valid storage buffer accesses while maintaining the same alignment requirements. ref: https://git.citron-emu.org/Citron/Citron/commit/2564e721df8b11e81df66c3fd5b04ae760e9550b
2024-12-20feat(shader): implement geometry shader invocation infoEmulationEnjoyer
- Update EmitInvocationInfo in SPIRV backend to handle geometry shader stage ref: https://git.citron-emu.org/Citron/Citron/commit/1266fad68128b3779dcd9bbb6c5f77ec1055e2e6#diff-4cbf73a98ed4ad649a4a6f38b569bc31fcf68cf7
2024-12-20mark format functions as constSamuliak
2024-12-20Use fmt 11.0.0Mike Lothian
2024-12-20Disabled problematic MSVC warning-to-errorsspectranator
2024-12-20Fixed non-external SPIRV-Tools linkagedarktux
2024-12-20Optionally optimize generated SPIRV with spirv-opt (#10)darktux
Reviewed-on: http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/darktux/torzu/pulls/10 Co-authored-by: darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion> Co-committed-by: darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion>
2024-12-20Add SR_WScaleFactorXY/SR_WScaleFactorZ stubs for Prince of Persia (#5)darktux
Pulled in and cleaned up from Sudachi Reviewed-on: http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/darktux/torzu/pulls/5 Co-authored-by: darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion> Co-committed-by: darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion>
2024-12-20Added support for Princess Peach: Showtime!Jarrod Norwell
2024-02-22Merge pull request #13075 from liamwhite/mali-having-a-bad-timeNarr the Reg
shader_recompiler: throw on missing geometry streams in geometry shaders
2024-02-19shader_recompiler: throw on missing geometry streams in geometry shadersLiam
2024-02-15shader_recompiler: fix non-const offset for arrayed image typesLiam
2024-02-15Revert "shader_recompiler: use only ConstOffset for OpImageFetch"Liam
This reverts commit f296a9ce9a1a144d322d54d4628dba6f8a800cb7.
2024-02-05shader_recompiler: use only ConstOffset for OpImageFetchLiam
2024-01-18Merge pull request #12644 from liamwhite/vkspec-image-offsetliamwhite
shader_recompiler: fix Offset operand usage for non-OpImage*Gather
2024-01-16Merge remote-tracking branch 'origin/master' into typos3Viktor Szépe
2024-01-15Fix more typosViktor Szépe
2024-01-11shader_recompiler: emulate 8-bit and 16-bit storage writes with cas loopLiam
2024-01-11shader_recompiler: fix Offset operand usage for non-OpImage*GatherLiam
2024-01-07Fix "Propietary" typo elsewhereViktor Szépe
2024-01-04Merge pull request #12437 from ameerj/gl-amd-fixesliamwhite
OpenGL: Fixes and workaround updates for AMD
2023-12-26shader_recompiler: use default value for clip distances arrayLiam
2023-12-26shader_recompiler: respect clip distance limits in indexed storeLiam
2023-12-22Merge pull request #12435 from liamwhite/type-checkFernando S
shader_recompiler: ensure derivatives for textureGrad are f32
2023-12-21spirv_emit_context: Fix BaseInstance for OGL spirvAmeer J
2023-12-21shader_recompiler: ensure derivatives for textureGrad are f32Liam
2023-12-21shader_recompiler: use float image operations on load/store when requiredLiam
2023-12-20emit_glsl_image: Use inlined texelFetch offsetsAmeer J
2023-12-18shader_recompiler: use minimal clip distance arrayLiam
2023-12-18shader_recompiler: ignore clip distances beyond driver support levelLiam
2023-12-03Merge pull request #12196 from ameerj/glsl-cbuf-sizesliamwhite
GLSL: Use known cbuf sizes when possible
2023-11-26GLSL: Prefer known used cbuf sizesAmeer J
2023-11-26Merge branch 'master' into ssbo-alignAmeer J
2023-11-19renderer_vulkan: ignore viewport stores on non-supporting driversLiam
2023-11-19Merge pull request #12066 from ameerj/nvidia-nsanityliamwhite
shader_recompiler: add byteswap pattern workaround for Nvidia
2023-11-18shader_recompiler: Fix spelling of "derivate" (#12067)Ameer J
2023-11-17shader_recompiler: add byteswap pattern workaround for NvidiaAmeer J
2023-10-31shader_recompiler: Align SSBO offsets in GlobalMemory functionsAmeer J
2023-10-31shader_recompiler: Align SSBO offsets to meet host requirementsAmeer J
Co-Authored-By: Billy Laws <blaws05@gmail.com>