mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-26 03:35:40 +01:00
shader_recompiler: use minimal clip distance array
This commit is contained in:
parent
94244437de
commit
fcfa8b680b
@ -1528,7 +1528,8 @@ void EmitContext::DefineOutputs(const IR::Program& program) {
|
|||||||
if (stage == Stage::Fragment) {
|
if (stage == Stage::Fragment) {
|
||||||
throw NotImplementedException("Storing ClipDistance in fragment stage");
|
throw NotImplementedException("Storing ClipDistance in fragment stage");
|
||||||
}
|
}
|
||||||
const Id type{TypeArray(F32[1], Const(std::min(8U, profile.max_user_clip_distances)))};
|
const Id type{TypeArray(
|
||||||
|
F32[1], Const(std::min(info.used_clip_distances, profile.max_user_clip_distances)))};
|
||||||
clip_distances = DefineOutput(*this, type, invocations, spv::BuiltIn::ClipDistance);
|
clip_distances = DefineOutput(*this, type, invocations, spv::BuiltIn::ClipDistance);
|
||||||
}
|
}
|
||||||
if (info.stores[IR::Attribute::Layer] &&
|
if (info.stores[IR::Attribute::Layer] &&
|
||||||
|
@ -913,7 +913,11 @@ void GatherInfoFromHeader(Environment& env, Info& info) {
|
|||||||
}
|
}
|
||||||
for (size_t index = 0; index < 8; ++index) {
|
for (size_t index = 0; index < 8; ++index) {
|
||||||
const u16 mask{header.vtg.omap_systemc.clip_distances};
|
const u16 mask{header.vtg.omap_systemc.clip_distances};
|
||||||
info.stores.Set(IR::Attribute::ClipDistance0 + index, ((mask >> index) & 1) != 0);
|
const bool used{((mask >> index) & 1) != 0};
|
||||||
|
info.stores.Set(IR::Attribute::ClipDistance0 + index, used);
|
||||||
|
if (used) {
|
||||||
|
info.used_clip_distances = static_cast<u32>(index) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
info.stores.Set(IR::Attribute::PrimitiveId,
|
info.stores.Set(IR::Attribute::PrimitiveId,
|
||||||
header.vtg.omap_systemb.primitive_array_id != 0);
|
header.vtg.omap_systemb.primitive_array_id != 0);
|
||||||
|
@ -227,6 +227,8 @@ struct Info {
|
|||||||
bool requires_layer_emulation{};
|
bool requires_layer_emulation{};
|
||||||
IR::Attribute emulated_layer{};
|
IR::Attribute emulated_layer{};
|
||||||
|
|
||||||
|
u32 used_clip_distances{};
|
||||||
|
|
||||||
boost::container::static_vector<ConstantBufferDescriptor, MAX_CBUFS>
|
boost::container::static_vector<ConstantBufferDescriptor, MAX_CBUFS>
|
||||||
constant_buffer_descriptors;
|
constant_buffer_descriptors;
|
||||||
boost::container::static_vector<StorageBufferDescriptor, MAX_SSBOS> storage_buffers_descriptors;
|
boost::container::static_vector<StorageBufferDescriptor, MAX_SSBOS> storage_buffers_descriptors;
|
||||||
|
Loading…
Reference in New Issue
Block a user