mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 03:16:54 +02:00
shader: drop null checks on the stage input info pointers
This commit is contained in:
@@ -52,6 +52,7 @@ void CheckFatal(F &&function, std::string_view expected, const char *message) {
|
||||
struct Fixture {
|
||||
Program program;
|
||||
Block *block = nullptr;
|
||||
ShaderComputeInputInfo compute_info{};
|
||||
|
||||
explicit Fixture(ShaderType stage = ShaderType::Compute) {
|
||||
program.stage = stage;
|
||||
@@ -131,7 +132,9 @@ struct Fixture {
|
||||
Value(0u), Value(0u), Value(0u)});
|
||||
}
|
||||
|
||||
void PlanAndTrack(Libs::Graphics::ShaderStageInputInfo input = {}) {
|
||||
void PlanAndTrack() { PlanAndTrack({.compute = &compute_info}); }
|
||||
|
||||
void PlanAndTrack(Libs::Graphics::ShaderStageInputInfo input) {
|
||||
for (size_t index = 0; index < program.blocks.size(); ++index) {
|
||||
const auto condition = program.blocks[index]->condition;
|
||||
if (!condition.IsEmpty())
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
namespace {
|
||||
|
||||
using namespace Libs::Graphics::ShaderRecompiler::IR;
|
||||
using Libs::Graphics::ShaderComputeInputInfo;
|
||||
using Libs::Graphics::ShaderType;
|
||||
|
||||
void Check(bool condition, const char *message) {
|
||||
@@ -37,6 +38,7 @@ void CheckFatal(F &&function, std::string_view expected, const char *message) {
|
||||
|
||||
struct Fixture {
|
||||
Program program;
|
||||
ShaderComputeInputInfo compute{};
|
||||
|
||||
explicit Fixture(uint32_t block_count = 1) {
|
||||
program.stage = ShaderType::Compute;
|
||||
@@ -73,7 +75,7 @@ struct Fixture {
|
||||
return static_cast<uint32_t>(program.memory_info.size() - 1u);
|
||||
}
|
||||
|
||||
void Plan() { TrackResources(program, {}, {}); }
|
||||
void Plan() { TrackResources(program, {}, {}, {.compute = &compute}); }
|
||||
};
|
||||
|
||||
struct TestMemory {
|
||||
@@ -158,7 +160,7 @@ void TestScalarMemoryDomainMismatchFails() {
|
||||
Fixture raw;
|
||||
const auto raw_memory = raw.AddMemory(ResourceKind::ScalarBuffer);
|
||||
RawRead(raw, Address(raw, Value(0x1000u), Value(0u)), Value(0u), raw_memory);
|
||||
CheckFatal([&] { TrackResources(raw.program, {}, {}); },
|
||||
CheckFatal([&] { raw.Plan(); },
|
||||
"incompatible scalar memory metadata",
|
||||
"raw scalar load accepted descriptor-buffer metadata");
|
||||
|
||||
@@ -169,7 +171,7 @@ void TestScalarMemoryDomainMismatchFails() {
|
||||
{Value(0x1000u), Value(0u), Value(16u), Value(0u)});
|
||||
buffer.EmitMemory(ValueOpcode::ReadConstBuffer, {resource, Value(0u)},
|
||||
buffer_memory);
|
||||
CheckFatal([&] { TrackResources(buffer.program, {}, {}); },
|
||||
CheckFatal([&] { buffer.Plan(); },
|
||||
"incompatible scalar memory metadata",
|
||||
"descriptor scalar load accepted raw-address metadata");
|
||||
}
|
||||
|
||||
@@ -14343,7 +14343,7 @@ void BuildTypedPlan(const uint32_t *code, uint32_t words,
|
||||
ShaderRecompiler::IR::RemoveIdentities(ir);
|
||||
ShaderRecompiler::IR::EliminateDeadCode(ir.blocks);
|
||||
}
|
||||
ShaderRecompiler::IR::TrackResources(ir, decoded, cfg);
|
||||
ShaderRecompiler::IR::TrackResources(ir, decoded, cfg, options.input_info);
|
||||
ShaderRecompiler::IR::EliminateDeadCode(ir.blocks);
|
||||
}
|
||||
|
||||
@@ -16182,10 +16182,6 @@ void TestCompilerStageInputOwnership() {
|
||||
CheckSpirvBinaryValidates(compiled.spirv);
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_WINDOWS
|
||||
options.stage = ShaderType::Vertex;
|
||||
options.input_info.vertex = nullptr;
|
||||
ExpectFatal([&] { (void)TranslateProgram(shader, options); },
|
||||
"missing stage metadata bypassed translation validation");
|
||||
const uint32_t auxiliary_position[] = {
|
||||
EncodeExp0(0x0d, 0x1), EncodeExp1(0, 0, 0, 0), EncodeSopp(0x01)};
|
||||
for (const auto stage : {ShaderType::Pixel, ShaderType::Compute}) {
|
||||
|
||||
Reference in New Issue
Block a user