mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 18:32:49 -06:00
Merge pull request #6887 from v1993/patch-2
SPIR-V: Merge two ifs in EmitGetAttribute
This commit is contained in:
commit
519978ce70
1 changed files with 2 additions and 6 deletions
|
@ -298,14 +298,10 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
|
||||||
if (IR::IsGeneric(attr)) {
|
if (IR::IsGeneric(attr)) {
|
||||||
const u32 index{IR::GenericAttributeIndex(attr)};
|
const u32 index{IR::GenericAttributeIndex(attr)};
|
||||||
const std::optional<AttrInfo> type{AttrTypes(ctx, index)};
|
const std::optional<AttrInfo> type{AttrTypes(ctx, index)};
|
||||||
if (!type) {
|
if (!type || !ctx.runtime_info.previous_stage_stores.Generic(index, element)) {
|
||||||
// Attribute is disabled
|
// Attribute is disabled or varying component is not written
|
||||||
return ctx.Const(element == 3 ? 1.0f : 0.0f);
|
return ctx.Const(element == 3 ? 1.0f : 0.0f);
|
||||||
}
|
}
|
||||||
if (!ctx.runtime_info.previous_stage_stores.Generic(index, element)) {
|
|
||||||
// Varying component is not written
|
|
||||||
return ctx.Const(type && element == 3 ? 1.0f : 0.0f);
|
|
||||||
}
|
|
||||||
const Id generic_id{ctx.input_generics.at(index)};
|
const Id generic_id{ctx.input_generics.at(index)};
|
||||||
const Id pointer{AttrPointer(ctx, type->pointer, vertex, generic_id, ctx.Const(element))};
|
const Id pointer{AttrPointer(ctx, type->pointer, vertex, generic_id, ctx.Const(element))};
|
||||||
const Id value{ctx.OpLoad(type->id, pointer)};
|
const Id value{ctx.OpLoad(type->id, pointer)};
|
||||||
|
|
Loading…
Reference in a new issue