2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

shader/shader_ir: Change declare output attribute to a switch

This commit is contained in:
ReinUsesLisp 2020-03-15 20:49:35 -03:00
parent 4dfd5c84ea
commit 464bd5fad7

View file

@ -106,7 +106,8 @@ Node ShaderIR::GetPhysicalInputAttribute(Tegra::Shader::Register physical_addres
} }
Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) { Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) {
if (index == Attribute::Index::LayerViewportPointSize) { switch (index) {
case Attribute::Index::LayerViewportPointSize:
switch (element) { switch (element) {
case 0: case 0:
UNIMPLEMENTED(); UNIMPLEMENTED();
@ -121,8 +122,8 @@ Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buff
uses_point_size = true; uses_point_size = true;
break; break;
} }
} break;
if (index == Attribute::Index::TessCoordInstanceIDVertexID) { case Attribute::Index::TessCoordInstanceIDVertexID:
switch (element) { switch (element) {
case 2: case 2:
uses_instance_id = true; uses_instance_id = true;
@ -130,18 +131,17 @@ Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buff
case 3: case 3:
uses_vertex_id = true; uses_vertex_id = true;
break; break;
default: }
break; break;
} case Attribute::Index::ClipDistances0123:
} case Attribute::Index::ClipDistances4567: {
if (index == Attribute::Index::ClipDistances0123 ||
index == Attribute::Index::ClipDistances4567) {
const auto clip_index = const auto clip_index =
static_cast<u32>((index == Attribute::Index::ClipDistances4567 ? 1 : 0) + element); static_cast<u32>((index == Attribute::Index::ClipDistances4567 ? 1 : 0) + element);
used_clip_distances.at(clip_index) = true; used_clip_distances.at(clip_index) = true;
break;
}
} }
used_output_attributes.insert(index); used_output_attributes.insert(index);
return MakeNode<AbufNode>(index, static_cast<u32>(element), std::move(buffer)); return MakeNode<AbufNode>(index, static_cast<u32>(element), std::move(buffer));
} }