mirror of
https://github.com/yuzu-emu/sirit
synced 2024-11-22 14:43:37 +00:00
Add OpConstantSampler
This commit is contained in:
parent
014c6ab586
commit
42c456f24f
5 changed files with 28 additions and 9 deletions
|
@ -137,12 +137,16 @@ public:
|
||||||
/// Returns a numeric scalar constant.
|
/// Returns a numeric scalar constant.
|
||||||
Ref ConstantComposite(Ref result_type, const std::vector<Ref>& constituents);
|
Ref ConstantComposite(Ref result_type, const std::vector<Ref>& constituents);
|
||||||
|
|
||||||
|
/// Returns a sampler constant.
|
||||||
|
Ref ConstantSampler(Ref result_type, spv::SamplerAddressingMode addressing_mode,
|
||||||
|
bool normalized, spv::SamplerFilterMode filter_mode);
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
|
|
||||||
/// Emits a function.
|
/// Declares a function.
|
||||||
Ref Function(Ref result_type, spv::FunctionControlMask function_control, Ref function_type);
|
Ref Function(Ref result_type, spv::FunctionControlMask function_control, Ref function_type);
|
||||||
|
|
||||||
/// Emits a function end.
|
/// Ends a function.
|
||||||
Ref FunctionEnd();
|
Ref FunctionEnd();
|
||||||
|
|
||||||
// Flow
|
// Flow
|
||||||
|
|
|
@ -11,4 +11,9 @@
|
||||||
|
|
||||||
namespace Sirit {
|
namespace Sirit {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline void AddEnum(Op* op, T value) {
|
||||||
|
op->Add(static_cast<u32>(value));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
|
|
@ -30,4 +30,15 @@ Ref Module::ConstantComposite(Ref result_type, const std::vector<Ref>& constitue
|
||||||
return AddDeclaration(op);
|
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
|
} // namespace Sirit
|
||||||
|
|
2
src/op.h
2
src/op.h
|
@ -34,7 +34,7 @@ public:
|
||||||
void Add(const std::string& string);
|
void Add(const std::string& string);
|
||||||
|
|
||||||
void Add(const std::vector<Ref>& ids);
|
void Add(const std::vector<Ref>& ids);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u16 WordCount() const;
|
u16 WordCount() const;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ public:
|
||||||
// Type testing
|
// Type testing
|
||||||
TypeBool();
|
TypeBool();
|
||||||
TypeBool();
|
TypeBool();
|
||||||
TypeInt(64, true);
|
|
||||||
TypeInt(64, false);
|
TypeInt(64, false);
|
||||||
TypeInt(16, false);
|
TypeInt(16, false);
|
||||||
TypeFloat(16);
|
TypeFloat(16);
|
||||||
|
@ -32,11 +31,11 @@ public:
|
||||||
TypeImage(TypeFloat(32), spv::Dim::Dim2D, 0, false, false, 0,
|
TypeImage(TypeFloat(32), spv::Dim::Dim2D, 0, false, false, 0,
|
||||||
spv::ImageFormat::Rg32f);
|
spv::ImageFormat::Rg32f);
|
||||||
TypeSampledImage(TypeImage(TypeFloat(32), spv::Dim::Rect, 0, false, false, 0,
|
TypeSampledImage(TypeImage(TypeFloat(32), spv::Dim::Rect, 0, false, false, 0,
|
||||||
spv::ImageFormat::Rg32f));
|
spv::ImageFormat::Rg32f));
|
||||||
TypeVector(TypeInt(32, true), 4);
|
TypeVector(TypeInt(32, false), 4);
|
||||||
TypeVector(TypeInt(64, true), 4);
|
TypeVector(TypeInt(64, false), 4);
|
||||||
TypeRuntimeArray(TypeInt(32, true));
|
TypeRuntimeArray(TypeInt(32, false));
|
||||||
TypeStruct({TypeInt(32, true), TypeFloat(64)});
|
TypeStruct({TypeInt(32, false), TypeFloat(64)});
|
||||||
TypePointer(spv::StorageClass::Private, TypeFloat(16));
|
TypePointer(spv::StorageClass::Private, TypeFloat(16));
|
||||||
ConstantTrue(TypeBool());
|
ConstantTrue(TypeBool());
|
||||||
ConstantTrue(TypeBool());
|
ConstantTrue(TypeBool());
|
||||||
|
|
Loading…
Reference in a new issue