Commit Graph
9850 Commits
Author SHA1 Message Date
Henrik Rydgård 0324c7a912 Windows buildfix 2026-08-05 00:15:56 +02:00
Henrik Rydgård de7989ae56 Add TextureReplacer unit test; make replacer testable standalone
Add unittest/TestTextureReplacer which creates a fictive texture pack
(textures.ini with readable invented hashes plus real PNG files), loads
it via the replacer, and verifies lookups, filtering, hashranges, mip
levels, and missing/ignored entries.

To make the replacer runnable outside the emulator:
- The constructor now accepts a null DrawContext (formats just default
  to unsupported).
- FindReplacement/FindFiltering use the replaceEnabled_ member instead
  of the global config.
- Added TextureReplacer::LoadPackForTesting() to load an ini from a
  path directly.
2026-08-03 18:55:33 +02:00
Henrik Rydgård 0049b19fbf Fix OOB in texture replacer mip mixing and non-DXT texture decode
Vuln 17: ReplacedTexture::LoadLevelData let a KTX2/DDS file at a higher
mip level resize the shared data_ vector to its own (attacker-controlled)
mip count, so data_[mipLevel + i] indexed out of bounds and the KTX2
branch resized a different element than it wrote to. Disallow mixing
image formats across mip levels, cap the container mip count, and resize
the same element that is used as the transcode destination.

Vuln 18: DecodeTextureLevel only validated the start address for
non-DXT textures, so guest-controlled w/h/bufw could drive reads past
mapped RAM. Validate the needed range like the DXT path does and clamp
the height; ReadIndexedTex now takes the clamped w/h.
2026-08-01 13:16:22 +02:00
Henrik Rydgård 5e6a051952 Fix path traversal in texture pack filenames; use HasPathTraversal in savestate migration
Texture pack filenames/aliases from textures.ini were used to build read
and write paths with no '..' check, letting a malicious pack read or
write files outside the pack directory.

- LoadIniValues rejects entries with a parent dir component via
  HasParentDirComponent.
- ReplacedTexture::Prepare skips such filenames as defense in depth.
- PSPLoaders savestate migration now uses the shared HasPathTraversal
  helper instead of inline separator checks.
2026-08-01 13:16:22 +02:00
Henrik Rydgård 10a5d2f810 OpenGL: Improve checks for fragment shader float precision.
Fixes #22001 (although there may be other artifacts).
2026-07-30 10:03:15 +02:00
Henrik Rydgård 3eb056ad86 Move Common/GraphicsContext.h to Common/GPU/GraphicsContext.h 2026-07-26 13:58:17 +02:00
Henrik Rydgård a6e4d691ef Merge pull request #21973 from hrydgard/more-cmake-cleanup
Clean up the CMake files, matching the project structure of the MSVC build
2026-07-24 23:55:27 +02:00
Henrik Rydgård 2a79257551 Merge pull request #21667 from dsprogrammingprojects/Texture-Replacement-Double-Wildcard
Texture replacement addition for Address Only case
2026-07-24 21:40:02 +02:00
Henrik RydgårdandClaude Sonnet 5 abe6786ae1 Rename core to Core and extract it and GPU into their own CMakeLists.txt
Mirrors the earlier Common extraction. The old "core" target folded in
all of GPU/ (~200 files) plus a few ext/ files wholesale; Windows
already treats GPU as its own project (GPU.vcxproj), so GPU/CMakeLists.txt
splits that out too. GPU has a genuine two-way dependency with Core
(Core/System.cpp calls GPU_Init(), GPU/* calls back into Core for
Memory/Config/CoreTiming/etc), so GPU is a CMake OBJECT library: its
object files are always included wherever consumed instead of being
lazily pulled from an archive, avoiding the GNU ld single-pass
archive-ordering problem a two-way STATIC dependency would hit.

Also fixed a few library misattributions discovered while tracing what
each file actually uses:
- GlslangLibs (glslang/spirv-cross) moved from Core to Common, since
  it's Common/GPU/ShaderTranslation.cpp and VulkanContext.cpp that
  call into it directly. It only worked before because Core happened
  to always be linked after Common.
- ZSTD and OPENGL_LIBRARIES/X11_LIBRARIES moved from Core to GPU,
  matching where they're actually called (GPU/Debugger/Record.cpp and
  Playback.cpp for ZSTD, GPU/GLES for raw gl*() calls).
- GPU also needs Ext::Snappy directly (Playback.cpp calls
  snappy_uncompress) and the libretro-common include dir under
  LIBRETRO, both previously inherited for free by accident.

Also fixed USE_DISCORD's add_compile_definitions ordering: it was
being defined after ppsspp_ui's add_library call, so the UI target
never actually saw it on non-MSVC platforms.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSNaZnHCjmryS3ziVN9gZU
2026-07-24 20:16:07 +02:00
Henrik Rydgård 240a974e95 Remove direct dependency from Core to MacCameraHelper.mm 2026-07-24 12:06:15 +02:00
Henrik Rydgård 6442742f00 Fix issue with insufficient zeroing of VulkanPipelineKey 2026-07-24 12:06:15 +02:00
Henrik Rydgård 986eee7ef3 Remove the global variable "useEmuThread", add some VK error checking for compute shader compiles 2026-07-18 23:45:27 +02:00
Henrik Rydgård 1c918729d0 Merge pull request #21938 from hrydgard/screenshot-testing-improvements
Headless build: Preparations for framedump screenshot testing
2026-07-18 20:07:08 +02:00
Henrik Rydgård 3fd9b42f95 Fix playback of framedumps for headless 2026-07-18 19:09:46 +02:00
Henrik Rydgård 2931e9e5d2 TextureReplacer: We don't need to check for files that are missing from the alias list. 2026-07-18 18:00:54 +02:00
Henrik Rydgård 53c57bf95f Minor cleanups in replacer 2026-07-18 18:00:54 +02:00
Henrik Rydgård d7c8d6bd80 Clean up cachekey handling in texture replacer 2026-07-18 18:00:51 +02:00
Henrik Rydgård 0b39cde3a3 LookupWildCard: Remove a redundant argument and a constant template argument 2026-07-18 17:55:04 +02:00
Henrik Rydgård 90d922226f Correct maxSeenV handling 2026-07-18 12:31:01 +02:00
Henrik Rydgård 63331fd6d1 Remove DeleteTexture function, only made the code less clear 2026-07-18 12:08:50 +02:00
Henrik Rydgård ee1314f803 Add new TexCache logging channel 2026-07-18 11:57:56 +02:00
Henrik Rydgård f3a5b2dd18 Correct bugs in the secondary texture cache 2026-07-18 11:57:48 +02:00
Henrik Rydgård cff09041c9 Completely rework the flow in TextureCacheCommon::ApplyTexture 2026-07-18 11:57:48 +02:00
Henrik Rydgård b9b2b2b61e Reindent some code, do checks in a more logical order 2026-07-18 11:57:48 +02:00
Henrik Rydgård 1ffdc52111 Remove another "next" variable, cleanup 2026-07-18 11:57:48 +02:00
Henrik Rydgård 3b58242063 More cleanup 2026-07-16 20:54:58 +02:00
Henrik Rydgård ff89e4da4d Simplify 2026-07-16 20:38:27 +02:00
Henrik Rydgård 31c32c0ee0 Remove the "nextFramebufferTexture_" variable 2026-07-16 20:30:01 +02:00
Henrik Rydgård 40bce17f53 Some cleanup 2026-07-16 20:27:44 +02:00
Henrik Rydgård 130fad6876 Split out a function to finish up binding of framebuffers 2026-07-16 20:15:51 +02:00
Henrik Rydgård 0528646ea3 Invert the relationship between the two functions 2026-07-16 19:08:18 +02:00
Henrik Rydgård a4b4489d30 Move code around 2026-07-16 19:08:18 +02:00
Henrik Rydgård e81055db16 Remove the need to call SetTexture() externally. 2026-07-16 18:32:47 +02:00
Henrik Rydgård b4d1b3d469 Reshuffle so that SetTexture and ApplyTexture are always called together (will merge them later) 2026-07-16 18:23:58 +02:00
Henrik Rydgård 7c73ed71bf Remove the ability to "set safe size" from SoftwareTransformCommon, now redundant 2026-07-16 18:05:59 +02:00
Henrik Rydgård fef50f5348 Remove obsolete software transform vertex decoder hack that forced software skinning 2026-07-16 17:52:14 +02:00
Henrik Rydgård 92ec6a992b Remove "pixelMapped" from gstate_c. 2026-07-16 17:45:22 +02:00
Henrik Rydgård 6f4f0c41b4 Split ApplyTexture into ApplyTexture and ApplySampler 2026-07-16 17:45:22 +02:00
Henrik Rydgård 2e012b8966 Unify the "BindSampler" function between the backends 2026-07-16 17:45:22 +02:00
Henrik Rydgård 66014870d2 Remove unnecessary "DirtyLastShader" mechanism. 2026-07-16 15:47:59 +02:00
Henrik Rydgård 57e6bafb62 Remove largely ineffective and nearly not functional "low memory mode". Unlikely to save us. 2026-07-16 15:28:40 +02:00
Henrik Rydgård 672b549109 Make GetFramebufferSamplingParams a loose function. 2026-07-16 15:28:33 +02:00
Henrik Rydgård d2ae8af2bf Start splitting apart Texture vs Sampler binding code 2026-07-16 15:03:23 +02:00
Henrik Rydgård 615815e9ab Minor code cleanup 2026-07-16 15:03:23 +02:00
Henrik Rydgård 31b21d6bef Improve and clean up GPU stats 2026-07-16 15:03:20 +02:00
Henrik Rydgård ea95eb420d Clean up GetFramebufferSamplingParams 2026-07-16 15:03:20 +02:00
Henrik Rydgård c278fdf5a3 Rename some vars, move a function from header to cpp 2026-07-16 15:03:20 +02:00
Henrik Rydgård 013fc094de Remove NeedsZWHack old Mali workaround in vertex shaders. The new transform math seems to have fixed it some other way. 2026-07-15 12:14:33 +02:00
Henrik Rydgård c4889b3a2a Some more simplification of expressions in the vertex shader generator 2026-07-15 12:03:16 +02:00
Henrik Rydgård 8721e11694 Simplify expressions 2026-07-14 20:31:39 +02:00