Commit Graph

5 Commits

Author SHA1 Message Date
DarthSidious666 d48a8a2552 d3d8: extended texture formats, FVF float3/4 texcoords, smoke tests
Add the extended swizzled/LIN formats (float, 16/32-bit pairs, 10-bit, depth, DXN/DXT3A/DXT5A/CTX1) with distinct compact values, wire them through DXGI mapping, bpp, row-pitch and swizzle classification, and implement software channel-swap conversions (BGRA->RGBA for A16B16G16R16/A32B32G32R32, A/R field swap for A2R10G10B10/X2R10G10B10).

Support float3/float4 vertex texcoords via D3DFVF_TEXCOORDSIZE* in both the fixed-function FVF path (d3d8_shaders.c) and the native-VS input-layout path (d3d8_vsh.c); add d3d8_GetCurrentFVF.

Add tests/d3d8_smoke: an offline harness that compiles the real d3d8_resources.c + d3d8_swizzle.h with device-accessor stubs, exercising to_dxgi/bpp/predicates, swizzle round-trip, and the channel-swap conversions. Fixes an L6V5U5 sign-extension bug (5-bit V/U now cleanly sign-extends into R8G8_SNORM at upload).
2026-08-29 11:10:46 +01:00
sp00nz 396d8fe69b Add multi-texture FFP pipeline, hardware lighting, fog, DrawPrimitiveUP ring buffer
Complete rewrite of the D3D8 fixed-function shader pipeline:
- 4-stage multi-texture with all D3DTOP operations and D3DTA arguments
- Hardware T&L lighting (8 lights: directional/point/spot, Blinn-Phong)
- Vertex fog (linear/exp/exp2) with PS fog color blending
- Triangle fan and quad list to triangle list conversion
- 4MB ring buffer for DrawPrimitiveUP (no per-call buffer alloc)
- Multi-stage sampler binding (all 4 stages)
- NV2A stub headers for standalone toolkit builds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 01:23:15 -07:00
sp00nz 7eb4b2acf0 Add NV2A vertex shader microcode→HLSL translator, update README
d3d8_vsh.h/c (1,868 lines):
- 128-bit instruction parser: extracts MAC/ILU opcodes, 3 source
  operands with register type, index, swizzle, negate, relative
  addressing; MAC and ILU destinations with write masks
- HLSL code generator: translates all 14 MAC ops (MOV, MUL, ADD,
  MAD, DP3, DP4, DPH, DST, MIN, MAX, SLT, SGE, ARL) and 8 ILU
  ops (MOV, RCP, RCC, RSQ, EXP, LOG, LIT) to equivalent HLSL
- 192 float4 constant registers in dynamic constant buffer
- 64-entry compiled shader cache (FNV-1a hash, LRU eviction)
- Input layout management: analyzes which v0-v15 registers the
  shader reads, creates matching D3D11 input element descriptions
- CreateVertexShader stores microcode for deferred compilation
- SetVertexShaderConstant routes to VSH constant buffer

Device integration:
- Draw calls: d3d8_vsh_prepare_draw() used when programmable VS
  active, falls back to FVF fixed-function path otherwise
- Init/shutdown wired into device lifecycle

README.md updated:
- "Recent Changes" section highlighting all new features
- Runtime library table reflects register combiners, vertex shaders,
  texture unswizzle, PGRAPH translator, EEPROM/SMBus
- Per-module LOC counts updated (D3D: 3,372→7,018, kernel: 7,935→8,298)
- Project descriptions updated with latest progress
- Gap analysis linked in technical docs section
- New sections explaining combiner and vertex shader translation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 01:18:51 -07:00
sp00nz a27fbe29f0 Update gap analysis: register combiners now implemented
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 01:05:35 -07:00
sp00nz 4e4ed2d595 Upstream NV2A PGRAPH translator, add texture unswizzle, EEPROM/AV support
NV2A GPU:
- Upstream nv2a_pgraph_d3d11.c/h from burnout3: translates NV2A Kelvin
  push buffer method calls to D3D11 rendering commands
- Upstream nv2a_pb_replay.c: push buffer capture and replay system
- Route NV2A method calls through PGRAPH translator in nv2a_core.c
- Update CMakeLists.txt to build new NV2A files

D3D8 textures:
- Add d3d8_swizzle.h: Xbox texture unswizzle (Z-order/Morton code)
  for converting swizzled Xbox textures to linear D3D11 layout
- Integrate unswizzle into tex_UnlockRect upload path
- Add texture format mappings: A4R4G4B4, LIN_A4R4G4B4, A8L8, P8

Kernel:
- Add EEPROM support (ExQueryNonVolatileSetting) with NA/NTSC defaults
- Add SMBus/SMC (HalReadSMBusValue/HalWriteSMBusValue) returning
  production values: version "P01", component AV pack, 40C temp
- Enhance AvSendTVEncoderOption: returns HDTV AV pack, 480p capable
- Register new ordinals in kernel_thunks.c

APU:
- Add global audio mute flag (g_audio_muted) for development testing

Documentation:
- Add docs/technical/gap-analysis.md: comprehensive comparison of xemu
  vs xboxrecomp with prioritized feature gaps for Blood Wake/Wreckless

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:47:13 -07:00