WebGL renders triangles that exceed the PS1 polygon size limit
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 54/100
Research direction
Start by tracing how DrawOTag submits polygon packets and how the WebGL backend clips or rejects their vertices; use the attached standalone C reproduction to confirm the current behavior. Check every polygon packet type, quad component, boundary value, and texture-state side effect against the signed 11-bit coordinate limits in PSX-SPX. Done means oversized polygons are rejected while valid polygons still clip normally.
Written by the indexing model from the issue text.
Description
An oversized polygon is clipped to the viewport and rendered, whereas the PS1 should reject it. In a game this can appear as stretched geometry near the camera.
Tested on PsyZ 35c673e, Emscripten 6.0.13 / WebGL2, Chromium 157 (SwiftShader), macOS arm64.
Reproduction
Download the standalone C example (save as repro.c). No game source, executable or assets required.
It submits a red POLY_F3 with vertices (-700, 40), (400, 40), (80, 200): the horizontal span is 1100 pixels. A separate small green triangle is a valid control. Both are submitted through DrawOTag.
Expected: only the green control is visible.
Actual: the red triangle covers a large portion of the framebuffer.
These are actual 320×240 VRAM readbacks, enlarged 2× with nearest-neighbour scaling. The right-hand image uses our packet-level rejection wrapper; the underlying PsyZ backend is otherwise unchanged. It is a local comparison, not a hardware reference capture.
Building the standalone example
Save the attached file as repro.c, and place this CMakeLists.txt beside it:
cmake_minimum_required(VERSION 3.21)
project(drawprim_repro C CXX)
set(CMAKE_C_STANDARD 11)
add_compile_options(-pthread)
add_link_options(-pthread)
set(SDL_PTHREADS ON CACHE BOOL "" FORCE)
add_subdirectory("${PSYZ_ROOT}/psyz" psyz EXCLUDE_FROM_ALL)
add_executable(repro repro.c)
target_link_libraries(repro PRIVATE psyz)
target_link_options(repro PRIVATE -sASSERTIONS=1 -sPTHREAD_POOL_SIZE=2)
psyz_web_configure_target(repro OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/site")
Use a PsyZ checkout at the revision above, with its SDL submodule initialized:
emcmake cmake -S . -B build -DPSYZ_ROOT=/path/to/psyz -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8
Serve build/site locally with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp, as required by Emscripten pthreads. Open index.html. The example appends a canvas containing the VRAM readback below the normal page content; scroll down if necessary. It also logs GPU readback ready.
Compatibility considerations
The restriction applies to signed 11-bit vertex coordinates: a horizontal span of 1024 or a vertical span of 512 is already too large. Ordinary clipping of valid polygons should remain intact. See vertex restrictions in PSX-SPX.
This example tests one flat triangle. A general fix should also cover textured/Gouraud packets, boundary values, both component triangles of a quad, and texture-state side effects.
- Dominant language
- C
- Stars
- 107
- Forks
- 26
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Xeeynamo/psyz
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
Similar issues
-
documentation good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JulianKemmerer/PipelineC#409 ·
-
Linux build fails without libspeechd-dev, which INSTALL.md doesn't list and CMake reports as foundOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
GXF: heap buffer overflow in parse_ad_cdp() — unbounded cc_count in CDP cc data sectionPossibly taken @pranayr710 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CCExtractor/ccextractor#2498 ·
Maintainers usually reply within 1 day