shader: Properly manage attributes not written from previous stages

This commit is contained in:
ReinUsesLisp 2021-06-16 04:59:30 -03:00 committed by ameerj
parent 892b8aa2ad
commit 374eeda1a3
12 changed files with 62 additions and 41 deletions

View file

@ -1209,6 +1209,9 @@ void EmitContext::DefineInputs(const Info& info) {
tess_coord = DefineInput(*this, F32[3], false, spv::BuiltIn::TessCoord);
}
for (size_t index = 0; index < info.input_generics.size(); ++index) {
if (!runtime_info.previous_stage_stores_generic[index]) {
continue;
}
const InputVarying generic{info.input_generics[index]};
if (!generic.used) {
continue;

View file

@ -286,7 +286,7 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
if (IR::IsGeneric(attr)) {
const u32 index{IR::GenericAttributeIndex(attr)};
const std::optional<AttrInfo> type{AttrTypes(ctx, index)};
if (!type) {
if (!type || !ctx.runtime_info.previous_stage_stores_generic[index]) {
// Attribute is disabled
return ctx.Const(0.0f);
}