mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2026-02-19 16:49:43 +00:00
Add OpConstantSampler
This commit is contained in:
@@ -11,4 +11,9 @@
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
template<typename T>
|
||||
inline void AddEnum(Op* op, T value) {
|
||||
op->Add(static_cast<u32>(value));
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
|
||||
@@ -30,4 +30,15 @@ Ref Module::ConstantComposite(Ref result_type, const std::vector<Ref>& constitue
|
||||
return AddDeclaration(op);
|
||||
}
|
||||
|
||||
Ref Module::ConstantSampler(Ref result_type, spv::SamplerAddressingMode addressing_mode,
|
||||
bool normalized, spv::SamplerFilterMode filter_mode) {
|
||||
AddCapability(spv::Capability::LiteralSampler);
|
||||
AddCapability(spv::Capability::Kernel);
|
||||
Op* op{new Op(spv::Op::OpConstantSampler, bound, result_type)};
|
||||
AddEnum(op, addressing_mode);
|
||||
op->Add(normalized ? 1 : 0);
|
||||
AddEnum(op, filter_mode);
|
||||
return AddDeclaration(op);
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
|
||||
Reference in New Issue
Block a user