Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ void Translator::V_INTERP_MOV_F32(const Decoder::Instruction& inst) {

void Translator::EXP(const Decoder::Instruction& inst) {
uint32_t index = 0;
if (ExportTargetKindFromTarget(inst.exp.target, index) == IR::ExportTargetKind::Unknown) {
const auto kind = ExportTargetKindFromTarget(inst.exp.target, index);
if (kind == IR::ExportTargetKind::Unknown) {
EXIT("unsupported EXP target 0x%02x at pc 0x%08x", inst.exp.target, inst.pc);
}
if (program.stage == ShaderType::Compute && inst.exp.en != 0u &&
kind != IR::ExportTargetKind::Null) {
EXIT("EXP target 0x%02x is not valid in a compute shader at pc 0x%08x",
inst.exp.target, inst.pc);
}
std::array<IR::Value, 4> components {IR::Value(0u), IR::Value(0u), IR::Value(0u),
IR::Value(0u)};
for (uint32_t source = 0; source < std::min(inst.src_count, 4u); source++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ void Translator::IMAGE_GET_RESINFO(const Decoder::Instruction& inst) {
}

void Translator::IMAGE_GET_LOD(const Decoder::Instruction& inst) {
if (program.stage != ShaderType::Pixel && program.stage != ShaderType::Compute) {
EXIT("image_get_lod requires a pixel or compute shader at pc 0x%08x", inst.pc);
}
const auto memory = MemoryInfoFromDecoded(inst);
const auto resource = GetImageResource(memory);
const auto sampler = GetSamplerResource(memory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const std::vector<Case> Cases = {
{"empty-program-end", 0x00, 0x00, {0xbf810000u}},
{"lds-atomic-in-a-pixel-shader", 0x04, 0x00, {0xd8000000u, 0x00000100u, 0xbf810000u}},
{"lds-umin-in-a-vertex-shader", 0x03, 0x00, {0xd8070000u, 0x00000100u, 0xbf810000u}},
{"image-get-lod-in-a-pixel-shader", 0x04, 0x00,
{0xf1800108u, 0x00400400u, 0xf8000801u, 0x00000004u, 0xbf810000u}},
{"null-export-in-a-compute-shader", 0x00, 0x00,
{0xf8000891u, 0x03020100u, 0xbf810000u}},
{"disabled-parameter-export-in-a-compute-shader", 0x00, 0x00,
{0xf8000a00u, 0x03020100u, 0xbf810000u}},
};

struct Refusal {
Expand All @@ -43,13 +49,19 @@ const std::vector<Refusal> Refusals = {
{"position-export-from-a-pixel-shader", 0x04, 0x00, {0xf80008cfu, 0x03020100u, 0xbf810000u},
"position export outside a vertex processing stage"},
{"position-export-from-a-compute-shader", 0x00, 0x00, {0xf80008cfu, 0x03020100u, 0xbf810000u},
"position export outside a vertex processing stage"},
"not valid in a compute shader"},
{"parameter-export-from-a-compute-shader", 0x00, 0x00,
{0xf8000a01u, 0x03020100u, 0xbf810000u},
"not valid in a compute shader"},
{"depth-compare-sample-on-a-3d-image", 0x04, 0x00, {0xf0a00110u, 0x00400400u, 0xf8000801u, 0x00000004u, 0xbf810000u},
"depth comparison with a 3D image"},
{"depth-compare-sample-on-a-multisampled-image", 0x04, 0x00, {0xf0a00130u, 0x00400400u, 0xf8000801u, 0x00000004u, 0xbf810000u},
"samples a multisampled image"},
{"sample-on-a-multisampled-image", 0x04, 0x00, {0xf0800130u, 0x00400400u, 0xf8000801u, 0x00000004u, 0xbf810000u},
"samples a multisampled image"},
{"image-get-lod-in-a-vertex-shader", 0x03, 0x00,
{0xf1800308u, 0x00820000u, 0xf80008cfu, 0x03020100u, 0xbf810000u},
"image_get_lod requires a pixel or compute shader"},
};

struct ModeWrite {
Expand Down
6 changes: 6 additions & 0 deletions docs/dev/debt/changes/fix-kyty-spirv-execution-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# kyty

## add Functional

- [IMAGE_GET_LOD](../../../core/kyty/graphics/shader/recompiler/frontend/translate/Memory.cpp) is refused outside pixel and compute shaders because its current lowering emits `OpImageQueryLod`, which is invalid in vertex, local and tessellation execution models. Mesh also lacks the derivative-group execution mode that `OpImageQueryLod` requires. Closes when these stages have a validated alternative lowering or, for mesh, a valid derivative mode and coverage.
- [EXP](../../../core/kyty/graphics/shader/recompiler/frontend/translate/Attribute.cpp) with enabled components and a non-null target is refused in compute shaders. A parameter export otherwise creates an `Output` storage variable, which Vulkan forbids in `GLCompute`; other live export targets lack a compute output contract. Null and disabled exports retain their no-output behavior. Closes when a valid compute-stage meaning is established and its lowering passes SPIR-V validation.
Loading