mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
fix(agc): preserve strict shader linkage failures
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "prx/libSceAgc/Shader/include/ShaderConstants.hpp"
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
extern "C" int APS5_VABI sceAgcCreatePrimState(ShaderRegister*, ShaderRegister*, const Shader*, const Shader*, std::uint32_t);
|
||||
extern "C" int APS5_VABI sceAgcCreateInterpolantMapping(ShaderRegister*, const Shader*, const Shader*);
|
||||
@@ -23,12 +22,8 @@ extern "C" int APS5_VABI sceAgcLinkShaders(ShaderRegister* context, ShaderRegist
|
||||
// and 32 interpolant registers. Publish only after both helpers succeed.
|
||||
std::array<ShaderRegister, 34> contextValues{};
|
||||
std::array<ShaderRegister, 3> primitiveValues{};
|
||||
try {
|
||||
sceAgcCreatePrimState(contextValues.data(), primitiveValues.data(), nullptr, vertex, primitiveType);
|
||||
sceAgcCreateInterpolantMapping(contextValues.data() + 2, vertex, pixel);
|
||||
} catch (const std::runtime_error&) {
|
||||
return GRAPHICS5_ERROR_INVALID_SHADER_PROGRAM;
|
||||
}
|
||||
sceAgcCreatePrimState(contextValues.data(), primitiveValues.data(), nullptr, vertex, primitiveType);
|
||||
sceAgcCreateInterpolantMapping(contextValues.data() + 2, vertex, pixel);
|
||||
std::copy(contextValues.begin(), contextValues.end(), context);
|
||||
std::copy(primitiveValues.begin(), primitiveValues.end(), primitive);
|
||||
return 0;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
extern "C" int APS5_VABI sceAgcLinkShaders(ShaderRegister*, ShaderRegister*, const void*, const Shader*, const Shader*, std::uint32_t);
|
||||
extern "C" void* APS5_VABI sceAgcGetRegisterDefaults();
|
||||
extern "C" void* APS5_VABI sceAgcGetRegisterDefaults2(std::uint32_t);
|
||||
@@ -58,7 +59,10 @@ int main() {
|
||||
Require(std::memcmp(primitive.data(), savedPrimitive.data(), sizeof(primitive)) == 0);
|
||||
pixel.num_input_semantics = 0;
|
||||
special.ge_cntl.offset = 0;
|
||||
Require(sceAgcLinkShaders(context.data(), primitive.data(), nullptr, &vertex, &pixel, 4) == GRAPHICS5_ERROR_INVALID_SHADER_PROGRAM);
|
||||
bool rejected = false;
|
||||
try { sceAgcLinkShaders(context.data(), primitive.data(), nullptr, &vertex, &pixel, 4); }
|
||||
catch (const std::runtime_error&) { rejected = true; }
|
||||
Require(rejected);
|
||||
Require(std::memcmp(context.data(), savedContext.data(), sizeof(context)) == 0);
|
||||
special.ge_cntl.offset = GE_CNTL;
|
||||
Require(sceAgcLinkShaders(context.data(), primitive.data(), nullptr, &vertex, nullptr, 2) == 0);
|
||||
|
||||
@@ -510,3 +510,24 @@ wait modes, and rendering a game frame remain unverified.
|
||||
|
||||
The unchanged game now resolves both rendering-wait imports and stops at
|
||||
`Z4QosVuAsA0` (`pthread_once`). Guest entry-point execution has not yet occurred.
|
||||
|
||||
## Follow-up: once initialization and architecture audit
|
||||
|
||||
Implemented pthread_once with the guest 16-byte control layout, a SysV callback,
|
||||
serialized initialization, and publication of initialized data to waiting callers.
|
||||
Independent controls can initialize recursively; an initializer that unwinds with
|
||||
a C++ exception resets its control for retry. Guest thread cancellation and fork
|
||||
recovery are not implemented. Tests use host threads calling the guest ABI and do
|
||||
not establish that guest pthread_create works.
|
||||
|
||||
All twenty-eight CTest cases pass. The unchanged converted game now stops at
|
||||
`NesIgTmfF0Q` (`bsearch`) with exit `0xc0000139`, before guest entry.
|
||||
|
||||
The README architecture remains the target: native executable relinking and
|
||||
in-process replacement system libraries. There is no replacement game engine or
|
||||
game source in these additions. Windows compatibility tests do not establish
|
||||
Linux compatibility or a successful game launch. Shader register layout and the
|
||||
internal rendering-wait encoding still require actual game execution validation.
|
||||
The shader-link wrapper now propagates unsupported-state runtime exceptions from
|
||||
its helpers, preserving the README's strict failure policy; its regression test
|
||||
checks the exception and that output registers are not partially published.
|
||||
|
||||
Reference in New Issue
Block a user