shader_ir/other: Implement S2R InvocationId
This commit is contained in:
parent
ecbfa416f0
commit
0b5b93053d
|
@ -1915,6 +1915,10 @@ private:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Expression InvocationId(Operation operation) {
|
||||||
|
return {"gl_InvocationID", Type::Int};
|
||||||
|
}
|
||||||
|
|
||||||
Expression YNegate(Operation operation) {
|
Expression YNegate(Operation operation) {
|
||||||
return {"y_direction", Type::Float};
|
return {"y_direction", Type::Float};
|
||||||
}
|
}
|
||||||
|
@ -2153,6 +2157,7 @@ private:
|
||||||
&GLSLDecompiler::EmitVertex,
|
&GLSLDecompiler::EmitVertex,
|
||||||
&GLSLDecompiler::EndPrimitive,
|
&GLSLDecompiler::EndPrimitive,
|
||||||
|
|
||||||
|
&GLSLDecompiler::InvocationId,
|
||||||
&GLSLDecompiler::YNegate,
|
&GLSLDecompiler::YNegate,
|
||||||
&GLSLDecompiler::LocalInvocationId<0>,
|
&GLSLDecompiler::LocalInvocationId<0>,
|
||||||
&GLSLDecompiler::LocalInvocationId<1>,
|
&GLSLDecompiler::LocalInvocationId<1>,
|
||||||
|
|
|
@ -2357,6 +2357,7 @@ private:
|
||||||
&SPIRVDecompiler::EmitVertex,
|
&SPIRVDecompiler::EmitVertex,
|
||||||
&SPIRVDecompiler::EndPrimitive,
|
&SPIRVDecompiler::EndPrimitive,
|
||||||
|
|
||||||
|
&SPIRVDecompiler::InvocationId,
|
||||||
&SPIRVDecompiler::YNegate,
|
&SPIRVDecompiler::YNegate,
|
||||||
&SPIRVDecompiler::LocalInvocationId<0>,
|
&SPIRVDecompiler::LocalInvocationId<0>,
|
||||||
&SPIRVDecompiler::LocalInvocationId<1>,
|
&SPIRVDecompiler::LocalInvocationId<1>,
|
||||||
|
|
|
@ -69,6 +69,8 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) {
|
||||||
case OpCode::Id::MOV_SYS: {
|
case OpCode::Id::MOV_SYS: {
|
||||||
const Node value = [this, instr] {
|
const Node value = [this, instr] {
|
||||||
switch (instr.sys20) {
|
switch (instr.sys20) {
|
||||||
|
case SystemVariable::InvocationId:
|
||||||
|
return Operation(OperationCode::InvocationId);
|
||||||
case SystemVariable::Ydirection:
|
case SystemVariable::Ydirection:
|
||||||
return Operation(OperationCode::YNegate);
|
return Operation(OperationCode::YNegate);
|
||||||
case SystemVariable::InvocationInfo:
|
case SystemVariable::InvocationInfo:
|
||||||
|
|
|
@ -172,6 +172,7 @@ enum class OperationCode {
|
||||||
EmitVertex, /// () -> void
|
EmitVertex, /// () -> void
|
||||||
EndPrimitive, /// () -> void
|
EndPrimitive, /// () -> void
|
||||||
|
|
||||||
|
InvocationId, /// () -> int
|
||||||
YNegate, /// () -> float
|
YNegate, /// () -> float
|
||||||
LocalInvocationIdX, /// () -> uint
|
LocalInvocationIdX, /// () -> uint
|
||||||
LocalInvocationIdY, /// () -> uint
|
LocalInvocationIdY, /// () -> uint
|
||||||
|
|
Loading…
Reference in a new issue