Skip to content

kyty: Grand Theft Auto V draws its whole picture at about a quarter size in the top-left of the display buffer, black elsewhere #298

Backlog

Description

@Ryongen

What happens

Every frame of Grand Theft Auto V shows the complete picture shrunk to roughly a quarter of the window (about half the width and half the height) in the top-left corner, with the rest black.

Title, test or build step

Grand Theft Auto V, PPSA38500 01.002.001

AnyPS5 commit

AnyKyty 7de61e3451 with #295 and #296 (now merged).

System

Windows 10 22H2 (19045), RTX 2070 SUPER, NVIDIA 617.42, WinLibs GCC 15.2.0 + LLVM 21.1.8

Host report

AnyPS5 host report (format 1)
commit: 7de61e3451c5
[system]
os: Windows 10.0.19045
cpu: AMD Ryzen 7 5800X3D 8-Core Processor
cpu_threads: 16
memory_mib: 32669
cpu_gate: passed
[sdl]
linked: 2.33.0
compiled: 2.33.0
[gpu]
device: NVIDIA GeForce RTX 2070 SUPER
type: discrete
vulkan_api: 1.4.351
driver: NVIDIA
driver_version: 617.42.0.0
subgroup_size: 32
device_local_mib: 7989

Steps to reproduce

Convert with relinker --windows, run with APS5_NO_WGI=1. The picture is in the corner from the first frames until the run stops (about 30 s, at #294).

Log

[dbg-attr] register set=0 start=0 num=2 1920x1080 pitch=0 tiling=0 option=0x0
[mouse] video driver windows: guest 1920x1080 presented at 1109x624, delta scale 1.7313 x 1.7308

(The first line is a temporary log added to sceVideoOutRegisterBuffers2 and sceVideoOutSubmitChangeBufferAttribute2; it is not in the tree.)

What was checked

  • VideoOut: the title registers one set of two linear 1920x1080 buffers and never calls sceVideoOutSubmitChangeBufferAttribute2, so there is no attribute change to a smaller size that the presenter could be ignoring. The window scales the 1920x1080 buffer correctly.
  • PSSR: scePsmlMfsr2Init is refused as on a base console (the modelled console has no PSSR), so the title takes its own path rather than the system upscaler.
  • So the last pass that writes the display buffer only covers about its top-left quarter: either a draw whose viewport or scissor comes out at half size, or a dispatch sized from a half-resolution value, possibly the title's own dynamic-resolution upscale that does not run or reads the wrong scale.
  • Not yet checked: the viewport, scissor and dispatch dimensions of the passes that write the display buffer address. AnyKyty has no frame capture; a pointer to the quickest way to read those (a [kyty-*] log or a setting) would help.

Activity

  1. added
    bug
    area: rendering
    medium
    on Nov 25, 2026
  2. simnJS commented on Nov 25, 2026

    @simnJS
    Owner

    @Ryongen thanks, very clear report. We're checking right now whether this title shows the same quarter-size picture under Linux at 1920x1080 on our side, which tells us whether it's a Kyty translation issue or something specific to Windows or to the 01.002.001 build. We'll come back here with the result and the quickest way to dump the viewport, scissor and dispatch sizes of the passes that write the display buffer.

  3. simnJS commented on Nov 25, 2026

    @simnJS
    Owner

    Thanks for the very clear report and for ruling out VideoOut and PSSR first.

    We can't reproduce it, but our run doesn't take your code path. We ran current AnyKyty (441382ef20, which includes #295 and #296)
    on Linux (RTX 4080 SUPER) with a 1920x1080 display and the output status forced to 1080p (APS5_OUTPUT_RESOLUTION=1920x1080).
    From the logos to gameplay, every frame fills the window. But our copy of this title is the launch version, and with a 1080p
    output it still registers 3840x2160 display buffers ([mouse] … guest 3840x2160 presented at 1152x648); it has never registered
    a 1920x1080 buffer in any of our runs. Yours registers 1920x1080 buffers, so your newer version takes a 1080p display path that the
    launch version doesn't have. Your version also calls into the PSSR library, which the launch version doesn't import at all, so the
    update reworked the resolution and upscaling chain. Our guess is that the difference comes from the title version, not from Windows.

    Quickest check: run once with APS5_OUTPUT_RESOLUTION=3840x2160. It only changes what sceVideoOutGetOutputStatus reports
    (2160p class instead of 1080p); the title still chooses its own buffer and render sizes. If the title then registers 3840x2160
    buffers and the picture fills the window, the bug is confined to its 1080p output path, and you have a workaround in the meantime.

    Reading viewports, scissors and dispatch sizes. AnyKyty has no frame capture (the RenderDoc hook from KytyPS5 isn't built into
    AnyKyty, and we haven't tried injecting RenderDoc from outside), but the Kyty core can log every draw and every direct dispatch:

    set KYTY_GRAPHICS_DEBUG_DUMP=1
    set KYTY_PRINTF_DIRECTION=File
    set KYTY_PRINTF_OUTPUT_FILE=C:\temp\kyty.txt

    (PowerShell: $env:KYTY_GRAPHICS_DEBUG_DUMP="1", and so on.)

    • Each draw (indirect draws included) prints a RenderTraget: block with base.addr and attrib2.width / attrib2.height
      (size minus one), then a ScreenViewport: block with vp[0].xscale, vp[0].xoffset, vp[0].yscale, vp[0].yoffset, the
      viewport scissor, the screen, window and generic scissors, and window_offset_x/y. A viewport that covers the whole target has
      xscale = xoffset = width / 2, yscale = -height / 2, yoffset = height / 2.
    • Each direct dispatch prints GraphicsRenderDispatchDirect: frame=N … groups=XxYxZ … local=AxBxC …, followed by one
      CS texture[i]: … usage=read-write … addr=0x… extent=WxH line per image it writes. Indirect dispatches are not logged.
    • Addresses are guest virtual addresses in bytes, the same values you pass to sceVideoOutRegisterBuffers2, so print the buffer
      addresses in your temporary log and look for them.
    • It's very verbose and slow, and it also turns the shader store off: in our test it wrote about 360 MB in 40 s (about 36,000 draws
      into the three display buffers, up to the title screen). Let it run 10-20 s past the first frames, then stop the game.

    For reference, at 3840x2160 every draw into our display buffers has xscale=1920 xoffset=1920 yscale=-1080 yoffset=1080 and
    scissors 0..3840 x 0..2160. For the last pass that writes your 1920x1080 display buffer, there are three possible outcomes:

    1. xscale/yscale around 480/-270, or a scissor that stops at about 960x540: the title itself asked for a half-size region.
      Then the next question is which value it computed that from.
    2. A full-size viewport and scissor (xscale=960): the pass samples a texture that already holds the shrunk picture. Go back one
      pass to whatever wrote that texture (a render target or a CS texture with usage=read-write).
    3. A dispatch that writes the buffer with groups × local covering only about 960x540: its size comes from a half-resolution value.

    This filter (Python 3) prints, for every draw or direct dispatch that writes a given address, its size, viewport and scissors, or
    its group counts: python writers.py kyty.txt 0x<display buffer address> > writers.txt

    import re, sys
    log, target = sys.argv[1], int(sys.argv[2], 16)
    keys = ("vp[0].xscale", "vp[0].xoffset", "vp[0].yscale", "vp[0].yoffset", "vp[0].viewport_scissor_right",
            "vp[0].viewport_scissor_bottom", "screen_scissor_right", "screen_scissor_bottom",
            "generic_scissor_right", "generic_scissor_bottom", "window_offset_x", "window_offset_y")
    kv = re.compile(r"^\t\s*([\w\[\]\.]+)\s*=\s*(\S+)")
    rt, vp, section, dispatch = {}, {}, None, None
    for line in open(log, errors="replace"):
        if line.startswith(("RenderTraget:", "DepthRenderTraget:", "ScreenViewport:", "ClipControl:")):
            if line.startswith("ClipControl:") and int(rt.get("base.addr", "0"), 16) == target:
                size = f"{int(rt['attrib2.width'], 16) + 1}x{int(rt['attrib2.height'], 16) + 1}"
                print("draw", size, " ".join(f"{k}={vp.get(k)}" for k in keys))
            if line.startswith("RenderTraget:"):
                rt, vp = {}, {}
            section = line.split(":")[0]
            continue
        if line.startswith("GraphicsRenderDispatchDirect: frame="):
            dispatch = line.strip()
        elif line.startswith("  CS texture[") and "read-write" in line and f"addr=0x{target:010x}" in line:
            print("dispatch", dispatch, "|", line.strip())
        m = kv.match(line)
        if m and section == "RenderTraget":
            rt[m.group(1)] = m.group(2)
        elif m and section == "ScreenViewport":
            vp[m.group(1)] = m.group(2)

    If you can post the result of the 3840x2160 run, and writers.txt (or the relevant part of kyty.txt) for a couple of frames at
    1080p with the two buffer addresses, we'll take it from there.

  4. added
    needs: game
    on Nov 25, 2026
  5. Ryongen commented on Nov 25, 2026

    @Ryongen
    ContributorAuthor

    Thanks, that narrowed it a lot. Both runs on 441382ef20, Windows, RTX 2070 SUPER.

    APS5_OUTPUT_RESOLUTION=3840x2160: the title registers 3840x2160 buffers (guest 3840x2160 presented at 1109x624) and the picture fills the window, so the bug is confined to the 1080p path and that setting is a workaround. It then stops at the compute shader from #294 (0x95b4ea51e43c1825, pc 0x5514).

    1080p with KYTY_GRAPHICS_DEBUG_DUMP=1 (80 MB, about 14,400 draws and 4,600 direct dispatches before the #294 stop). The display buffers are 0x1055c20000 and 0x10564a0000 (1920x1080, linear). Your filter gives only draws into them, all identical:

    823 draw 1920x1080 vp[0].xscale=960.000000 vp[0].xoffset=960.000000 vp[0].yscale=-540.000000 vp[0].yoffset=540.000000 vp[0].viewport_scissor_right=1920 vp[0].viewport_scissor_bottom=1080 screen_scissor_right=1920 screen_scissor_bottom=1080 generic_scissor_right=16383 generic_scissor_bottom=16383 window_offset_x=0 window_offset_y=0
    824 draw 1920x1080 (same, second buffer)
    

    So it's your case 2: a full-size pass that samples a texture that already holds the shrunk picture. No direct dispatch writes the display buffers.

    Going back, every frame has the same chain of render targets (run-length per target, in order):

    3 x RT 0xfbf61c0000 1920x1080
    1 x RT 0xb404000000 3840x2160   full viewport: xscale=1920 xoffset=1920 yscale=-1080 yoffset=1080, scissors 3840x2160
    1 x RT 0xfbf61c0000 1920x1080
    1 x RT 0x1055c20000 1920x1080   display buffer (or 0x10564a0000)
    1 x CS 0x106a280000 33x33x33
    

    So with a 1080p output the title still renders into a 3840x2160 target, then goes back down to 1080p. A shrunk, complete picture with black around it would come out of this if the 1920x1080 to 3840x2160 draw reads its 1920x1080 source as if it were 3840x2160 (by pixel position, or with a T# that says 3840x2160 over the 1080p data). The picture would then sit 1:1 in the top-left quarter of the 4K target, with black elsewhere, and the full-texture downsample to 0xfbf61c0000 would leave it at a quarter of the frame. The dump doesn't list the textures a draw reads (only CS texture[i] lines), so I can't confirm which T# that 4K draw uses. Is there a setting that logs the pixel shader's T#s per draw?

  6. Ryongen commented on Nov 25, 2026

    @Ryongen
    ContributorAuthor

    One step further, with a temporary log in RenderExecutor::ResolveTexture (T# address, extent, pitch, tiling, per shader) at the default 1080p output:

    shader=0x9610322441735e79 addr=0xfbf61c0000 extent=1920x1080 pitch=1920 tile=27 fmt=56   (the draw into the 3840x2160 target 0xb404000000)
    shader=0x67e171285a5122c0 addr=0xb404000000 extent=3840x2160 pitch=3840 tile=27 fmt=130  (the draw back into 0xfbf61c0000)
    

    Both T#s describe their surfaces correctly, so it is not a T# that claims the wrong size. The 1080p to 4K pass is a plain textured quad:

    V_INTERP_P1/P2_F32 v2, v3 <- attribute 1 (UV)      v8, v7, v6, v0 <- attribute 0 (colour)
    image_sample_a v2, v2, s0, s8                        S# built inline in s8..s11
    V_MUL_F32 ... (sample * colour), exp target 0
    

    So the UV comes straight from the vertex shader and the shrink has to be in the quad's geometry: the title draws the 1920x1080 picture as a 1920x1080-pixel rectangle inside a 3840x2160 target with a full viewport. In other words it lays the frame out for a 1080p screen but composes into a 4K target, which looks like two size answers that disagree (the 1080p class from sceVideoOutGetOutputStatus, and something that still says 4K). I haven't dumped that quad's vertex shader or its constants yet; if you know which query this version uses for its composition target size, that is probably the one to check.

  7. simnJS commented on Nov 25, 2026

    @simnJS
    Owner

    @Ryongen excellent analysis, thanks. We're now going through every query that reports a screen or output size to the title, to find the one that still answers 4K when the output is 1080p, and we'll add the per-draw T# log you asked for (graphics stages, not only CS texture[i]) to the same dump. Back here soon.

  8. simnJS commented on Nov 25, 2026

    @simnJS
    Owner

    Thanks, that narrows it a lot, and your ResolveTexture log already rules out a T# that lies about its size.

    Which size queries exist, and what they answer at 1080p. These are all the calls in 441382ef20 that give a title a display size or a display capability. "At 1080p" means a 1080p desktop or APS5_OUTPUT_RESOLUTION=1920x1080; both give the same answers.

    Call NID Answer at 1080p on 441382ef20 Console
    sceVideoOutGetOutputStatus, sceVideoOutGetOutputStatusWithVrr utPrVdxio-8, gWT7X8H0bYs resolution 1 (1080p class) 1 with the output set to 1080p (measured)
    sceVideoOutGetResolutionStatus 6kPnj51T62Y the size of the last buffer registered or flipped on that port, 1920x1080 before any the display's size: 3840x2160 on a 4K TV, also on a freshly opened port with no buffer (measured)
    sceVideoOutIsOutputSupported, sceVideoOutConfigureOutput Nv8c-Kb+DUM, w0hLuNarQxY mode 1: 1; mode 15: depends on the refresh rate; any mode AnyPS5 doesn't know: 0x8029001E, the answer a console gave on a 4K TV, whatever the display not measured on a 1080p display
    sceVideoOutAllowOutputResolutionWqhdDetection w7Ipp9Xl7hg 0; 1440p is never reported
    sceVideoOutGetCurrentOutputMode_ W0iQAbGaTBg 0x80290018, nothing written same
    sceVideoOutGetDeviceInfoEx_, sceVideoOutConfigureOutputMode_ k6JLQGuPEYA, N1bEoJ4SRw4 stop the game (not implemented), so your run doesn't call them
    sceSystemServiceGetDisplaySafeAreaInfo 1n37q1Bvc5Y ratio 1.0, no size
    sceAgcGetIsTrinityMode, sceKernelIsTrinityMode BfBDZGbti7A, tU5e3f9gSiU base console
    scePsmlMfsr2Init o+NM86gEwFE unsupported console; no PSSR call returns a size

    sceSystemServiceParamGetInt and sceAppContentAppParamGetInt have no display parameter, the AvControl monitor-info calls answer "not initialized" and write nothing, and the mouse virtual screen and IME panel sizes only echo what the title set.

    So only two answers can say 4K while the output status says 1080p:

    1. sceVideoOutGetResolutionStatus, if the title registered or flipped a 3840x2160 buffer on that port before asking (for example a 4K buffer set registered at start-up). It also disagreed the other way: on a 4K display it said 1920x1080 until a buffer was registered, while the output status said 2160p.
    2. sceVideoOutIsOutputSupported / sceVideoOutConfigureOutput for an output mode AnyPS5 doesn't know, which always gets the 4K TV's answer.

    Our copy is the launch version: of all these calls it imports only sceVideoOutGetOutputStatus, and it registers 3840x2160 buffers whatever the class. So we can't see which one your version reads. You can check which ones it imports: NIDs are plain text in the decrypted eboot.bin, so findstr /c:"6kPnj51T62Y#" eboot.bin prints something only if that call is imported (repeat with Nv8c-Kb+DUM# and w0hLuNarQxY#).

    Fix for the first one. AnyKyty 2133762e89 makes sceVideoOutGetResolutionStatus report the output, as a console does: 1920x1080 when the output status says 1080p, 3840x2160 when it says 2160p, whatever buffers the title registers. It only changes your 1080p run if your version imports 6kPnj51T62Y and had a 3840x2160 buffer on that port when it asked.

    Test for the second one, no rebuild needed. Run the 1080p case once more with ANYPS5_VIDEO_OUT_MAX_WIDTH=1920 and ANYPS5_VIDEO_OUT_MAX_HEIGHT=1080. With both set below 4K, an output mode AnyPS5 doesn't know is answered as unsupported (0) instead of 0x8029001E. If the picture then fills the window, your version chooses its composition size from an output-mode probe, and that answer is what we have to get right on a 1080p display.

    T#s per draw. AnyKyty 8bf7cc52cf adds them to KYTY_GRAPHICS_DEBUG_DUMP. After each draw's RenderTraget:, ScreenViewport: and Parameters: blocks, every texture that each stage of the draw binds gets one line:

      PS texture[i]: hash=0x<shader hash> source=<n> usage=read-only addr=0x<T# base> type=<n> fmt=<n> extent=<W>x<H> pitch=<n> depth=<n> tile=<n>
    

    The prefix is VS, LS, HS, DS or MS for the stages before the pixel shader. hash is the stage's shader_hash, the same field the GraphicsRenderDispatchDirect lines print as hash=. addr, fmt, extent and tile come straight from the T#; pitch is derived from width, format and tile mode, the same way the texture cache derives it. A texture read through a descriptor heap or a descriptor table prints heap or table instead of its fields, since the draw has no single T# for it. These lines come after the blocks your filter reads, so the filter still works: the texture lines of a draw are the ones between its ClipControl: block and the next draw.

    Since both T#s of the 1080p-to-4K pass are right, the shrink has to come from the quad's positions, so the next thing to look at is the constants its vertex shader reads. Comparing the same quad at 1080p and at APS5_OUTPUT_RESOLUTION=3840x2160 should show which value goes from 3840x2160 to 1920x1080.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: renderingbugmediumneeds: game

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions