shader: Implement PIXLD.MY_INDEX
This commit is contained in:
parent
f3473c5143
commit
95815a3883
14 changed files with 71 additions and 5 deletions
|
@ -375,6 +375,10 @@ U32 IREmitter::InvocationId() {
|
|||
return Inst<U32>(Opcode::InvocationId);
|
||||
}
|
||||
|
||||
U32 IREmitter::SampleId() {
|
||||
return Inst<U32>(Opcode::SampleId);
|
||||
}
|
||||
|
||||
U1 IREmitter::IsHelperInvocation() {
|
||||
return Inst<U1>(Opcode::IsHelperInvocation);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
[[nodiscard]] U32 LocalInvocationIdZ();
|
||||
|
||||
[[nodiscard]] U32 InvocationId();
|
||||
[[nodiscard]] U32 SampleId();
|
||||
[[nodiscard]] U1 IsHelperInvocation();
|
||||
|
||||
[[nodiscard]] U32 LaneId();
|
||||
|
|
|
@ -63,6 +63,7 @@ OPCODE(SetOFlag, Void, U1,
|
|||
OPCODE(WorkgroupId, U32x3, )
|
||||
OPCODE(LocalInvocationId, U32x3, )
|
||||
OPCODE(InvocationId, U32, )
|
||||
OPCODE(SampleId, U32, )
|
||||
OPCODE(IsHelperInvocation, U1, )
|
||||
|
||||
// Undefined
|
||||
|
|
|
@ -181,10 +181,6 @@ void TranslatorVisitor::PEXIT(u64) {
|
|||
ThrowNotImplemented(Opcode::PEXIT);
|
||||
}
|
||||
|
||||
void TranslatorVisitor::PIXLD(u64) {
|
||||
ThrowNotImplemented(Opcode::PIXLD);
|
||||
}
|
||||
|
||||
void TranslatorVisitor::PLONGJMP(u64) {
|
||||
ThrowNotImplemented(Opcode::PLONGJMP);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2021 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
|
||||
|
||||
namespace Shader::Maxwell {
|
||||
namespace {
|
||||
enum class Mode : u64 {
|
||||
Default,
|
||||
CovMask,
|
||||
Covered,
|
||||
Offset,
|
||||
CentroidOffset,
|
||||
MyIndex,
|
||||
};
|
||||
} // Anonymous namespace
|
||||
|
||||
void TranslatorVisitor::PIXLD(u64 insn) {
|
||||
union {
|
||||
u64 raw;
|
||||
BitField<31, 3, Mode> mode;
|
||||
BitField<0, 8, IR::Reg> dest_reg;
|
||||
BitField<8, 8, IR::Reg> addr_reg;
|
||||
BitField<20, 8, s64> addr_offset;
|
||||
BitField<45, 3, IR::Pred> dest_pred;
|
||||
} const pixld{insn};
|
||||
|
||||
if (pixld.dest_pred != IR::Pred::PT) {
|
||||
throw NotImplementedException("Destination predicate");
|
||||
}
|
||||
if (pixld.addr_reg != IR::Reg::RZ || pixld.addr_offset != 0) {
|
||||
throw NotImplementedException("Non-zero source register");
|
||||
}
|
||||
switch (pixld.mode) {
|
||||
case Mode::MyIndex:
|
||||
X(pixld.dest_reg, ir.SampleId());
|
||||
break;
|
||||
default:
|
||||
throw NotImplementedException("Mode {}", pixld.mode.Value());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Shader::Maxwell
|
Loading…
Add table
Add a link
Reference in a new issue