shader: Implement miss attribute layer

This commit is contained in:
FengChen 2022-11-11 00:25:03 +08:00
parent ad9e5bc5b7
commit 60e0d4a177
5 changed files with 13 additions and 0 deletions

View file

@ -1355,6 +1355,10 @@ void EmitContext::DefineInputs(const IR::Program& program) {
if (loads[IR::Attribute::PrimitiveId]) {
primitive_id = DefineInput(*this, U32[1], false, spv::BuiltIn::PrimitiveId);
}
if (loads[IR::Attribute::Layer]) {
AddCapability(spv::Capability::Geometry);
layer = DefineInput(*this, U32[1], false, spv::BuiltIn::Layer);
}
if (loads.AnyComponent(IR::Attribute::PositionX)) {
const bool is_fragment{stage != Stage::Fragment};
const spv::BuiltIn built_in{is_fragment ? spv::BuiltIn::Position : spv::BuiltIn::FragCoord};