mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-28 16:35:45 +00:00
shader: Move LaneId to the warp emission file and fix AMD
This commit is contained in:
parent
1030b612a3
commit
9280cd649a
|
@ -66,7 +66,6 @@ void EmitSetOFlag(EmitContext& ctx);
|
||||||
Id EmitWorkgroupId(EmitContext& ctx);
|
Id EmitWorkgroupId(EmitContext& ctx);
|
||||||
Id EmitLocalInvocationId(EmitContext& ctx);
|
Id EmitLocalInvocationId(EmitContext& ctx);
|
||||||
Id EmitLoadLocal(EmitContext& ctx, Id word_offset);
|
Id EmitLoadLocal(EmitContext& ctx, Id word_offset);
|
||||||
Id EmitLaneId(EmitContext& ctx);
|
|
||||||
void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value);
|
void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value);
|
||||||
Id EmitUndefU1(EmitContext& ctx);
|
Id EmitUndefU1(EmitContext& ctx);
|
||||||
Id EmitUndefU8(EmitContext& ctx);
|
Id EmitUndefU8(EmitContext& ctx);
|
||||||
|
@ -403,6 +402,7 @@ Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, I
|
||||||
Id derivates, Id offset, Id lod_clamp);
|
Id derivates, Id offset, Id lod_clamp);
|
||||||
Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords);
|
Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords);
|
||||||
void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color);
|
void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color);
|
||||||
|
Id EmitLaneId(EmitContext& ctx);
|
||||||
Id EmitVoteAll(EmitContext& ctx, Id pred);
|
Id EmitVoteAll(EmitContext& ctx, Id pred);
|
||||||
Id EmitVoteAny(EmitContext& ctx, Id pred);
|
Id EmitVoteAny(EmitContext& ctx, Id pred);
|
||||||
Id EmitVoteEqual(EmitContext& ctx, Id pred);
|
Id EmitVoteEqual(EmitContext& ctx, Id pred);
|
||||||
|
|
|
@ -274,10 +274,6 @@ Id EmitLocalInvocationId(EmitContext& ctx) {
|
||||||
return ctx.OpLoad(ctx.U32[3], ctx.local_invocation_id);
|
return ctx.OpLoad(ctx.U32[3], ctx.local_invocation_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Id EmitLaneId(EmitContext& ctx) {
|
|
||||||
return ctx.OpLoad(ctx.U32[1], ctx.subgroup_local_invocation_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
Id EmitLoadLocal(EmitContext& ctx, Id word_offset) {
|
Id EmitLoadLocal(EmitContext& ctx, Id word_offset) {
|
||||||
const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)};
|
const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)};
|
||||||
return ctx.OpLoad(ctx.U32[1], pointer);
|
return ctx.OpLoad(ctx.U32[1], pointer);
|
||||||
|
|
|
@ -49,6 +49,14 @@ Id SelectValue(EmitContext& ctx, Id in_range, Id value, Id src_thread_id) {
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
Id EmitLaneId(EmitContext& ctx) {
|
||||||
|
const Id id{ctx.OpLoad(ctx.U32[1], ctx.subgroup_local_invocation_id)};
|
||||||
|
if (!ctx.profile.warp_size_potentially_larger_than_guest) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
return ctx.OpBitwiseAnd(ctx.U32[1], id, ctx.Constant(ctx.U32[1], 31U));
|
||||||
|
}
|
||||||
|
|
||||||
Id EmitVoteAll(EmitContext& ctx, Id pred) {
|
Id EmitVoteAll(EmitContext& ctx, Id pred) {
|
||||||
if (!ctx.profile.warp_size_potentially_larger_than_guest) {
|
if (!ctx.profile.warp_size_potentially_larger_than_guest) {
|
||||||
return ctx.OpSubgroupAllKHR(ctx.U1, pred);
|
return ctx.OpSubgroupAllKHR(ctx.U1, pred);
|
||||||
|
|
|
@ -58,7 +58,6 @@ OPCODE(SetCFlag, Void, U1,
|
||||||
OPCODE(SetOFlag, Void, U1, )
|
OPCODE(SetOFlag, Void, U1, )
|
||||||
OPCODE(WorkgroupId, U32x3, )
|
OPCODE(WorkgroupId, U32x3, )
|
||||||
OPCODE(LocalInvocationId, U32x3, )
|
OPCODE(LocalInvocationId, U32x3, )
|
||||||
OPCODE(LaneId, U32, )
|
|
||||||
|
|
||||||
// Undefined
|
// Undefined
|
||||||
OPCODE(UndefU1, U1, )
|
OPCODE(UndefU1, U1, )
|
||||||
|
@ -419,6 +418,7 @@ OPCODE(ImageRead, U32x4, U32,
|
||||||
OPCODE(ImageWrite, Void, U32, Opaque, U32x4, )
|
OPCODE(ImageWrite, Void, U32, Opaque, U32x4, )
|
||||||
|
|
||||||
// Warp operations
|
// Warp operations
|
||||||
|
OPCODE(LaneId, U32, )
|
||||||
OPCODE(VoteAll, U1, U1, )
|
OPCODE(VoteAll, U1, U1, )
|
||||||
OPCODE(VoteAny, U1, U1, )
|
OPCODE(VoteAny, U1, U1, )
|
||||||
OPCODE(VoteEqual, U1, U1, )
|
OPCODE(VoteEqual, U1, U1, )
|
||||||
|
|
|
@ -343,11 +343,11 @@ void VisitUsages(Info& info, IR::Inst& inst) {
|
||||||
case IR::Opcode::LocalInvocationId:
|
case IR::Opcode::LocalInvocationId:
|
||||||
info.uses_local_invocation_id = true;
|
info.uses_local_invocation_id = true;
|
||||||
break;
|
break;
|
||||||
|
case IR::Opcode::LaneId:
|
||||||
case IR::Opcode::ShuffleIndex:
|
case IR::Opcode::ShuffleIndex:
|
||||||
case IR::Opcode::ShuffleUp:
|
case IR::Opcode::ShuffleUp:
|
||||||
case IR::Opcode::ShuffleDown:
|
case IR::Opcode::ShuffleDown:
|
||||||
case IR::Opcode::ShuffleButterfly:
|
case IR::Opcode::ShuffleButterfly:
|
||||||
case IR::Opcode::LaneId:
|
|
||||||
info.uses_subgroup_invocation_id = true;
|
info.uses_subgroup_invocation_id = true;
|
||||||
break;
|
break;
|
||||||
case IR::Opcode::GetCbufU8:
|
case IR::Opcode::GetCbufU8:
|
||||||
|
|
Loading…
Reference in a new issue