Repository navigation
Conversation
jotitadev
left a comment
There was a problem hiding this comment.
Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head 2f779a57e merged onto main 44df21632. The description says it was not tested on Linux.
- The new library configures, builds and passes NID patching (
OK: .../libScePrecompiledShaders.prx);guest_precompiled_shaderspasses, including the glslang compile and link of both shaders. - No red run: the library is new, so the test cannot build without it.
Non-GPU suite (ctest -E "^agc"): same result as main; only file_writer_binary and file_writer_text fail, and they fail on main too on this machine (Ubuntu 26.04 coreutils).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Thanks for the Linux run, @jotitadev. Good to know glslang compiles and links both shaders there too. AI-assisted: yes (Claude Code). 🤖 Generated with Claude Code |
javierUDP
left a comment
There was a problem hiding this comment.
Static review of this PR and of #6519, both read against the OpenOrbis piglet sample rather than executed: the full build does not configure on macOS, so I could not compile or run either one. I found nothing to change in either. Recording what I checked so the next reader does not repeat it.
The entry names match the sample. strings on samples/piglet/.../piglet.elf from samples-elf-llvm-18.zip (v0.5.3) contains exactly texmap/v_2.vert and texmap/f_2.frag, the two entries this PR exports, and no other shader path.
The symbol kind matches how the sample imports it. relinker --registry on that sample resolves scePrecompiledShaderEntries as R_X86_64_GLOB_DAT, so the importer expects data, which is what scePrecompiledShaderEntries_nid_postfix[] provides; scePigletSetConfigurationVSH comes through as R_X86_64_JUMP_SLOT, a function, matching #6521.
The source marker is produced and consumed consistently. SourceMagic is written by both entries here and checked in #6521 at Context.cpp:342, which refuses a binary without it and strips it before handing the text to glslang, so the APS5GLSL\n prefix never reaches the compiler.
On #6519: SystemLibraryPath rejects a name with a path separator, which keeps /common/lib/../x.sprx out, and the test covers that case along with a missing module and a .prx suffix. sceKernelGetFsSandboxRandomWord returns a static constant, so the sandbox prefix cannot be built from a null pointer, and the same concatenation already appears in SandboxCertificates.cpp.
I did not review the GLES state machine in #6521 beyond what I commented there.
Written with AI assistance. The sample cross-checks above were run on my own machine; nothing was compiled or executed from these PRs.
…sample uses The OpenOrbis piglet sample loads libScePrecompiledShaders and looks up "texmap/v_2.vert" and "texmap/f_2.frag" in scePrecompiledShaderEntries, a table of 0x28-byte entries (name, size at 0x18, data at 0x20) that ends with a null name, and passes the data to glShaderBinary. The console table holds Sony's shader binaries, which AnyPS5 cannot ship. The library now exports the table with AnyPS5's own two shaders under those names, as GLSL ES 3.10 source behind an "APS5GLSL" line. They are written from the interface the sample uses: a_vertex with the position in xy and the texture coordinate in zw, the projection, model-view and texture-space matrices, the opacity applied to alpha and the sampler.
2f779a5 to
0b42ec3
Compare
|
Thanks @javierUDP for checking the entry names, the symbol kinds and the source marker against the sample. Doing that from the sample itself is the check this PR needed. The branch is rebased onto AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
What
The OpenOrbis piglet sample draws with the PS4 GLES library, libScePigletv2VSH, and takes its shaders from
libScePrecompiledShaders: it looks uptexmap/v_2.vertandtexmap/f_2.fragin the exported tablescePrecompiledShaderEntriesand passes their data toglShaderBinary. The table is an array of 0x28-byte entries (name at 0x0, size at 0x18, data at 0x20) that ends with a null name. AnyPS5 has nolibScePrecompiledShaders, and the console table holds Sony's compiled shaders, which AnyPS5 cannot ship.This adds the library with a table of AnyPS5's own two shaders under those names. Each is GLSL ES 3.10 source behind an
APS5GLSLline, a format of AnyPS5's own that the Piglet library in #6521 compiles with glslang; a PS4 binary given to thatglShaderBinarythrows. The shaders are written from the interface the sample uses:a_vertex, with the position inxyand the texture coordinate inzw;u_projectionMatrix,u_modelViewMatrixandu_textureSpaceMatrix;u_opacity, applied to alpha, as the sample'sGL_SRC_ALPHAblending expects;s_sampler.What the console shaders compute, the other names in the console table and the entry fields at 0x8 and 0x10 are unknown; they are recorded in the new
docs/dev/debt/libScePrecompiledShaders.md. Part of the PS4 homebrew work tracked in #3093.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmain03c4cb5e7:guest_precompiled_shaderstest walks the table to its null entry and checks the two names, that the reserved fields are 0, and that each size is the length of the source without its terminator. It compiles and links both shaders with glslang and checks the reflected interface: the threemat4matrices, thefloatopacity, thesampler2D, anda_vertexas the onlyvec4input. It also checks that the fragment shader produces SPIR-V.APS5GLSLline, the opacity not applied, the texture-space matrix not applied. Reading the position fromzwinstead ofxyis caught only byguest_pigletin feat(libScePigletv2VSH): implement the EGL and GLES 2 calls of the piglet sample #6521, which renders with these shaders.main03c4cb5e7with this, feat(libkernel): load system libraries from their console paths #6519, feat(libScePigletv2VSH): implement the EGL and GLES 2 calls of the piglet sample #6521, fix(relinker): search libc.prx for libkernel-only Windows executables #5990 to fix(relinker): stop module syscall scans at the PLT and skip the PS4 loader path #5994, feat(libSceFreeType): implement the six FreeType functions OpenOrbis samples use #6376, fix(relinker): accept section-relative guest module relocations #5138 and a change that answers the LinuxTIOCGWINSZwithENOTTY, as fix(libkernel): return ENOTTY for malformed ioctl requests #5569 did: it finds both shaders (Found shader texmap/v_2.vert ... of size 342,Found shader texmap/f_2.frag ... of size 263) and draws at 59.96 FPS. With neither this library nor Piglet's, it stops at start-up with 48FAIL: unresolved ELF importlines, the firstQ-JroQdKRfM(scePrecompiledShaderEntries) and one for each Piglet function.main03c4cb5e7: 1296 of 1300 pass.agc_driver_gpu_indirect_arguments_misaligned_writer_aheaddoes not compile with MinGW onmain(test(agc): align the indirect arguments block at run time #6452 fixes it), andprx_thread_local_destructorsfails as it did onmain92cdc7b62on this machine without my changes;agc_shader_disk_cache(timeout) andagc_driver_multisample_fill_host_onlyfailed underctest -j8and pass when run alone. Full ctest of the build with all my open pull requests: 1304 of 1306 pass; the two that do not are the first two above.tools/check_conventions.pypasses.Not tested on Linux or macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code