[spir-v] Flat decorations for input interfaces
This commit is contained in:
parent
977904cd27
commit
8dfc42b45a
|
|
@ -1435,6 +1435,9 @@ void EmitContext::DefineInputs(const IR::Program& program) {
|
||||||
}
|
}
|
||||||
if (info.uses_sample_id) {
|
if (info.uses_sample_id) {
|
||||||
sample_id = DefineInput(*this, U32[1], false, spv::BuiltIn::SampleId);
|
sample_id = DefineInput(*this, U32[1], false, spv::BuiltIn::SampleId);
|
||||||
|
if (stage == Stage::Fragment) {
|
||||||
|
Decorate(sample_id, spv::Decoration::Flat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (info.uses_is_helper_invocation) {
|
if (info.uses_is_helper_invocation) {
|
||||||
is_helper_invocation = DefineInput(*this, U1, false, spv::BuiltIn::HelperInvocation);
|
is_helper_invocation = DefineInput(*this, U1, false, spv::BuiltIn::HelperInvocation);
|
||||||
|
|
@ -1445,6 +1448,13 @@ void EmitContext::DefineInputs(const IR::Program& program) {
|
||||||
subgroup_mask_le = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupLeMaskKHR);
|
subgroup_mask_le = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupLeMaskKHR);
|
||||||
subgroup_mask_gt = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGtMaskKHR);
|
subgroup_mask_gt = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGtMaskKHR);
|
||||||
subgroup_mask_ge = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGeMaskKHR);
|
subgroup_mask_ge = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGeMaskKHR);
|
||||||
|
if (stage == Stage::Fragment) {
|
||||||
|
Decorate(subgroup_mask_eq, spv::Decoration::Flat);
|
||||||
|
Decorate(subgroup_mask_lt, spv::Decoration::Flat);
|
||||||
|
Decorate(subgroup_mask_le, spv::Decoration::Flat);
|
||||||
|
Decorate(subgroup_mask_gt, spv::Decoration::Flat);
|
||||||
|
Decorate(subgroup_mask_ge, spv::Decoration::Flat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (info.uses_fswzadd || info.uses_subgroup_invocation_id || info.uses_subgroup_shuffles ||
|
if (info.uses_fswzadd || info.uses_subgroup_invocation_id || info.uses_subgroup_shuffles ||
|
||||||
(profile.warp_size_potentially_larger_than_guest &&
|
(profile.warp_size_potentially_larger_than_guest &&
|
||||||
|
|
@ -1464,6 +1474,9 @@ void EmitContext::DefineInputs(const IR::Program& program) {
|
||||||
}
|
}
|
||||||
if (loads[IR::Attribute::PrimitiveId]) {
|
if (loads[IR::Attribute::PrimitiveId]) {
|
||||||
primitive_id = DefineInput(*this, U32[1], false, spv::BuiltIn::PrimitiveId);
|
primitive_id = DefineInput(*this, U32[1], false, spv::BuiltIn::PrimitiveId);
|
||||||
|
if (stage == Stage::Fragment) {
|
||||||
|
Decorate(primitive_id, spv::Decoration::Flat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (loads[IR::Attribute::Layer]) {
|
if (loads[IR::Attribute::Layer]) {
|
||||||
AddCapability(spv::Capability::Geometry);
|
AddCapability(spv::Capability::Geometry);
|
||||||
|
|
@ -1555,17 +1568,21 @@ void EmitContext::DefineInputs(const IR::Program& program) {
|
||||||
if (stage != Stage::Fragment) {
|
if (stage != Stage::Fragment) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (info.interpolation[index]) {
|
const bool is_integer = input_type == AttributeType::SignedInt ||
|
||||||
case Interpolation::Smooth:
|
input_type == AttributeType::UnsignedInt;
|
||||||
// Default
|
if (is_integer) {
|
||||||
// Decorate(id, spv::Decoration::Smooth);
|
|
||||||
break;
|
|
||||||
case Interpolation::NoPerspective:
|
|
||||||
Decorate(id, spv::Decoration::NoPerspective);
|
|
||||||
break;
|
|
||||||
case Interpolation::Flat:
|
|
||||||
Decorate(id, spv::Decoration::Flat);
|
Decorate(id, spv::Decoration::Flat);
|
||||||
break;
|
} else {
|
||||||
|
switch (info.interpolation[index]) {
|
||||||
|
case Interpolation::Smooth:
|
||||||
|
break;
|
||||||
|
case Interpolation::NoPerspective:
|
||||||
|
Decorate(id, spv::Decoration::NoPerspective);
|
||||||
|
break;
|
||||||
|
case Interpolation::Flat:
|
||||||
|
Decorate(id, spv::Decoration::Flat);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stage == Stage::TessellationEval) {
|
if (stage == Stage::TessellationEval) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue