Adds host-side conversion for color surface formats that Adreno GPUs
cannot render to natively (e.g. X1R5G5B5, X8R8G8B8, A8R8G8B8),
converting from the Xbox surface layout to the Vulkan host format
used as a fallback render target on Android.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
VK_FORMAT_R8G8B8_UNORM was used in a layout transition for the display
image, but it was created with VK_FORMAT_R8G8B8A8_UNORM. This mismatch
could cause validation errors or rendering artifacts on strict drivers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Only set texture_dirty when the register value actually changes,
avoiding spurious texture re-uploads on every draw call when the game
sets the same texture parameters repeatedly (common for UI rendering).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When paired MAC+ILU instructions write to oPos (output register 0)
while also having temp register output, use _temp_r12 as intermediate
to avoid reading stale oPos value as R12.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- gl/surface.c, vk/surface.c: Mark DIRTY_MEMORY_NV2A on download to
prevent stale buffer reads after surface write-back (PR 2800 fix)
- vk/draw.c: Fallback to empty pipeline cache on corrupt data (PR 2799)
- vk/glsl.c: Persist compiled SPIRV to disk cache (spirv_cache.bin) to
avoid re-compiling shaders on subsequent launches (PR 2799)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Track VkImageLayout on SurfaceBinding and transition correctly between
DEPTH_STENCIL_ATTACHMENT_OPTIMAL and DEPTH_STENCIL_READ_ONLY_OPTIMAL
when depth surfaces are used as textures.
- renderer.h: Add image_layout to SurfaceBinding; tex_surface_direct_layout[] to PGRAPHVkState
- image.c: Add DEPTH_STENCIL_READ_ONLY_OPTIMAL transition cases for TRANSFER_SRC/DST
- surface.c: Replace hardcoded layouts with image_layout tracking throughout
- draw.c: Barrier in begin_render_pass to restore zeta from READ_ONLY to ATTACHMENT
- shaders.c: Use tex_surface_direct_layout[] instead of hardcoded GENERAL
- texture.c: Add bind_zeta_surface_as_texture(); use image_layout in all s2t paths;
direct-bind depth surfaces without stencil in DEPTH_STENCIL_READ_ONLY_OPTIMAL
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Re-applies the fix from 372e3eacbb that was lost in the sloppy-stuff
mega-commit. When a color surface is used as a texture, the surface's
raw image_view may not have the correct component swizzle for the
texture format (e.g. X8R8G8B8 forces alpha=1 via swizzle, but the
surface view has the real alpha). This creates a per-texture view with
the correct swizzle from kelvin_color_format_vk_map. If the VkFormats
don't match at all (different internal layouts), fall back to a copy
via copy_surface_to_texture rather than binding directly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Re-applies the fix from 0f623fe906 that was lost in the sloppy-stuff
mega-commit. The RSIGNED/GSIGNED/BSIGNED/ASIGNED bits in TEXFILTER0
tell the hardware to interpret each sampled texture channel as a signed
value (-1..1). Without this, bump-mapped and environment-mapped surfaces
render with incorrect channel values, causing visual artifacts in games
that use G8B8/R6G5B5 bump map textures with the signed filter flags set.
Changes:
- texture.h: add PgraphTextureSignedChannel enum and
pgraph_get_texture_signed_component_mask_from_filter()
- psh.h: add tex_signed[4] to PshState
- psh.c: populate tex_signed from filter register, add
apply_signed_texture_remap(), update BUMPENVMAP/BUMPENVMAP_LUM
cases to check per-channel signed flags, apply remap after sampling
- gl/texture.c: remove NV2A_UNIMPLEMENTED stubs for SIGNED flags
(handled in shader now, same as VK path)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>