mirror of
https://github.com/shadps4-emu/sirit.git
synced 2024-11-26 20:50:35 +00:00
Change clang-format settings
This commit is contained in:
parent
38838c9a9d
commit
73595f4588
@ -1,6 +1,88 @@
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^\<[^Q][^/.>]*\>'
|
||||
Priority: -2
|
||||
- Regex: '^\<'
|
||||
Priority: -1
|
||||
- Regex: '^\"'
|
||||
Priority: 0
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 150
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
||||
|
@ -10,10 +10,10 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <spirv/unified1/spirv.hpp11>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <spirv/unified1/spirv.hpp11>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
@ -22,8 +22,8 @@ constexpr std::uint32_t GENERATOR_MAGIC_NUMBER = 0;
|
||||
class Op;
|
||||
class Operand;
|
||||
|
||||
using Literal = std::variant<std::uint32_t, std::uint64_t, std::int32_t,
|
||||
std::int64_t, float, double>;
|
||||
using Literal =
|
||||
std::variant<std::uint32_t, std::uint64_t, std::int32_t, std::int64_t, float, double>;
|
||||
using Id = const Op*;
|
||||
|
||||
class Module {
|
||||
@ -46,12 +46,10 @@ class Module {
|
||||
void AddCapability(spv::Capability capability);
|
||||
|
||||
/// Sets module memory model.
|
||||
void SetMemoryModel(spv::AddressingModel addressing_model,
|
||||
spv::MemoryModel memory_model);
|
||||
void SetMemoryModel(spv::AddressingModel addressing_model, spv::MemoryModel memory_model);
|
||||
|
||||
/// Adds an entry point.
|
||||
void AddEntryPoint(spv::ExecutionModel execution_model, Id entry_point,
|
||||
const std::string& name,
|
||||
void AddEntryPoint(spv::ExecutionModel execution_model, Id entry_point, const std::string& name,
|
||||
const std::vector<Id>& interfaces = {});
|
||||
|
||||
/// Declare an execution mode for an entry point.
|
||||
@ -94,8 +92,8 @@ class Module {
|
||||
Id OpTypeMatrix(Id column_type, int column_count);
|
||||
|
||||
/// Returns type image.
|
||||
Id OpTypeImage(Id sampled_type, spv::Dim dim, int depth, bool arrayed,
|
||||
bool ms, int sampled, spv::ImageFormat image_format,
|
||||
Id OpTypeImage(Id sampled_type, spv::Dim dim, int depth, bool arrayed, bool ms, int sampled,
|
||||
spv::ImageFormat image_format,
|
||||
std::optional<spv::AccessQualifier> access_qualifier = {});
|
||||
|
||||
/// Returns type sampler.
|
||||
@ -152,9 +150,8 @@ class Module {
|
||||
Id ConstantComposite(Id result_type, const std::vector<Id>& constituents);
|
||||
|
||||
/// Returns a sampler constant.
|
||||
Id ConstantSampler(Id result_type,
|
||||
spv::SamplerAddressingMode addressing_mode,
|
||||
bool normalized, spv::SamplerFilterMode filter_mode);
|
||||
Id ConstantSampler(Id result_type, spv::SamplerAddressingMode addressing_mode, bool normalized,
|
||||
spv::SamplerFilterMode filter_mode);
|
||||
|
||||
/// Returns a null constant value.
|
||||
Id ConstantNull(Id result_type);
|
||||
@ -162,26 +159,22 @@ class Module {
|
||||
// Function
|
||||
|
||||
/// Declares a function.
|
||||
Id OpFunction(Id result_type, spv::FunctionControlMask function_control,
|
||||
Id function_type);
|
||||
Id OpFunction(Id result_type, spv::FunctionControlMask function_control, Id function_type);
|
||||
|
||||
/// Ends a function.
|
||||
Id OpFunctionEnd();
|
||||
|
||||
/// Call a function.
|
||||
Id OpFunctionCall(Id result_type, Id function,
|
||||
const std::vector<Id>& arguments = {});
|
||||
Id OpFunctionCall(Id result_type, Id function, const std::vector<Id>& arguments = {});
|
||||
|
||||
// Flow
|
||||
|
||||
/// Declare a structured loop.
|
||||
Id OpLoopMerge(Id merge_block, Id continue_target,
|
||||
spv::LoopControlMask loop_control,
|
||||
Id OpLoopMerge(Id merge_block, Id continue_target, spv::LoopControlMask loop_control,
|
||||
const std::vector<Id>& literals = {});
|
||||
|
||||
/// Declare a structured selection.
|
||||
Id OpSelectionMerge(Id merge_block,
|
||||
spv::SelectionControlMask selection_control);
|
||||
Id OpSelectionMerge(Id merge_block, spv::SelectionControlMask selection_control);
|
||||
|
||||
/// The block label instruction: Any reference to a block is through this
|
||||
/// ref.
|
||||
@ -193,12 +186,10 @@ class Module {
|
||||
/// If condition is true branch to true_label, otherwise branch to
|
||||
/// false_label.
|
||||
Id OpBranchConditional(Id condition, Id true_label, Id false_label,
|
||||
std::uint32_t true_weight = 0,
|
||||
std::uint32_t false_weight = 0);
|
||||
std::uint32_t true_weight = 0, std::uint32_t false_weight = 0);
|
||||
|
||||
/// Multi-way branch to one of the operand label.
|
||||
Id OpSwitch(Id selector, Id default_label,
|
||||
const std::vector<Literal>& literals,
|
||||
Id OpSwitch(Id selector, Id default_label, const std::vector<Literal>& literals,
|
||||
const std::vector<Id>& labels);
|
||||
|
||||
/// Returns with no value from a function with void return type.
|
||||
@ -229,29 +220,24 @@ class Module {
|
||||
// Memory
|
||||
|
||||
/// Allocate an object in memory, resulting in a copy to it.
|
||||
Id OpVariable(Id result_type, spv::StorageClass storage_class,
|
||||
Id initializer = nullptr);
|
||||
Id OpVariable(Id result_type, spv::StorageClass storage_class, Id initializer = nullptr);
|
||||
|
||||
/// Load through a pointer.
|
||||
Id OpLoad(Id result_type, Id pointer,
|
||||
std::optional<spv::MemoryAccessMask> memory_access = {});
|
||||
Id OpLoad(Id result_type, Id pointer, std::optional<spv::MemoryAccessMask> memory_access = {});
|
||||
|
||||
/// Store through a pointer.
|
||||
Id OpStore(Id pointer, Id object,
|
||||
std::optional<spv::MemoryAccessMask> memory_access = {});
|
||||
Id OpStore(Id pointer, Id object, std::optional<spv::MemoryAccessMask> memory_access = {});
|
||||
|
||||
/// Create a pointer into a composite object that can be used with OpLoad
|
||||
/// and OpStore.
|
||||
Id OpAccessChain(Id result_type, Id base,
|
||||
const std::vector<Id>& indexes = {});
|
||||
Id OpAccessChain(Id result_type, Id base, const std::vector<Id>& indexes = {});
|
||||
|
||||
/// Make a copy of a composite object, while modifying one part of it.
|
||||
Id OpCompositeInsert(Id result_type, Id object, Id composite,
|
||||
const std::vector<Literal>& indexes = {});
|
||||
|
||||
/// Extract a part of a composite object.
|
||||
Id OpCompositeExtract(Id result_type, Id composite,
|
||||
const std::vector<Literal>& indexes = {});
|
||||
Id OpCompositeExtract(Id result_type, Id composite, const std::vector<Literal>& indexes = {});
|
||||
|
||||
/// Construct a new composite object from a set of constituent objects that
|
||||
/// will fully form it.
|
||||
@ -260,11 +246,9 @@ class Module {
|
||||
// Annotation
|
||||
|
||||
/// Add a decoration to target.
|
||||
Id Decorate(Id target, spv::Decoration decoration,
|
||||
const std::vector<Literal>& literals = {});
|
||||
Id Decorate(Id target, spv::Decoration decoration, const std::vector<Literal>& literals = {});
|
||||
|
||||
Id MemberDecorate(Id structure_type, Literal member,
|
||||
spv::Decoration decoration,
|
||||
Id MemberDecorate(Id structure_type, Literal member, spv::Decoration decoration,
|
||||
const std::vector<Literal>& literals = {});
|
||||
|
||||
// Misc
|
||||
@ -383,8 +367,7 @@ class Module {
|
||||
/// Does a bitwise Not on the operand.
|
||||
Id OpNot(Id result_type, Id operand);
|
||||
|
||||
Id OpBitFieldInsert(Id result_type, Id base, Id insert, Id offset,
|
||||
Id count);
|
||||
Id OpBitFieldInsert(Id result_type, Id base, Id insert, Id offset, Id count);
|
||||
|
||||
Id OpBitFieldSExtract(Id result_type, Id base, Id offset, Id count);
|
||||
|
||||
@ -533,8 +516,7 @@ class Module {
|
||||
|
||||
Id OpSampledImage(Id result_type, Id image, Id sampler);
|
||||
|
||||
Id OpImageSampleImplicitLod(
|
||||
Id result_type, Id sampled_image, Id coordinate,
|
||||
Id OpImageSampleImplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
@ -542,50 +524,39 @@ class Module {
|
||||
spv::ImageOperandsMask image_operands, Id lod,
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageSampleDrefImplicitLod(
|
||||
Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
Id OpImageSampleDrefImplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageSampleDrefExplicitLod(Id result_type, Id sampled_image,
|
||||
Id coordinate, Id dref,
|
||||
spv::ImageOperandsMask image_operands,
|
||||
Id lod,
|
||||
Id OpImageSampleDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
spv::ImageOperandsMask image_operands, Id lod,
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageSampleProjImplicitLod(
|
||||
Id result_type, Id sampled_image, Id coordinate,
|
||||
Id OpImageSampleProjImplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageSampleProjExplicitLod(Id result_type, Id sampled_image,
|
||||
Id coordinate,
|
||||
spv::ImageOperandsMask image_operands,
|
||||
Id lod,
|
||||
Id OpImageSampleProjExplicitLod(Id result_type, Id sampled_image, Id coordinate,
|
||||
spv::ImageOperandsMask image_operands, Id lod,
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageSampleProjDrefImplicitLod(
|
||||
Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
Id OpImageSampleProjDrefImplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageSampleProjDrefExplicitLod(Id result_type, Id sampled_image,
|
||||
Id coordinate, Id dref,
|
||||
spv::ImageOperandsMask image_operands,
|
||||
Id lod,
|
||||
Id OpImageSampleProjDrefExplicitLod(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
spv::ImageOperandsMask image_operands, Id lod,
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageFetch(Id result_type, Id sampled_image, Id coordinate,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id OpImageGather(Id result_type, Id sampled_image, Id coordinate,
|
||||
Id component,
|
||||
Id OpImageGather(Id result_type, Id sampled_image, Id coordinate, Id component,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
Id
|
||||
OpImageDrefGather(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
Id OpImageDrefGather(Id result_type, Id sampled_image, Id coordinate, Id dref,
|
||||
std::optional<spv::ImageOperandsMask> image_operands = {},
|
||||
const std::vector<Id>& operands = {});
|
||||
|
||||
|
@ -4,16 +4,15 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::Decorate(Id target, spv::Decoration decoration,
|
||||
const std::vector<Literal>& literals) {
|
||||
Id Module::Decorate(Id target, spv::Decoration decoration, const std::vector<Literal>& literals) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpDecorate)};
|
||||
op->Add(target);
|
||||
op->Add(static_cast<u32>(decoration));
|
||||
@ -22,8 +21,7 @@ Id Module::Decorate(Id target, spv::Decoration decoration,
|
||||
return target;
|
||||
}
|
||||
|
||||
Id Module::MemberDecorate(Id structure_type, Literal member,
|
||||
spv::Decoration decoration,
|
||||
Id Module::MemberDecorate(Id structure_type, Literal member, spv::Decoration decoration,
|
||||
const std::vector<Literal>& literals) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpMemberDecorate)};
|
||||
op->Add(structure_type);
|
||||
|
@ -4,10 +4,10 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
@ -27,8 +27,7 @@ namespace Sirit {
|
||||
}
|
||||
|
||||
#define DEFINE_TRINARY(funcname, opcode) \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2, \
|
||||
Id operand_3) { \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2, Id operand_3) { \
|
||||
auto op{std::make_unique<Op>(opcode, bound++, result_type)}; \
|
||||
op->Add(operand_1); \
|
||||
op->Add(operand_2); \
|
||||
@ -54,5 +53,4 @@ DEFINE_BINARY(OpFMod, spv::Op::OpFMod)
|
||||
DEFINE_BINARY(OpSRem, spv::Op::OpSRem)
|
||||
DEFINE_BINARY(OpFRem, spv::Op::OpFRem)
|
||||
|
||||
|
||||
} // namespace Sirit
|
||||
|
@ -4,32 +4,29 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpShiftRightLogical(Id result_type, Id base, Id shift) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftRightLogical, bound++,
|
||||
result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftRightLogical, bound++, result_type)};
|
||||
op->Add(base);
|
||||
op->Add(shift);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpShiftRightArithmetic(Id result_type, Id base, Id shift) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftRightArithmetic, bound++,
|
||||
result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftRightArithmetic, bound++, result_type)};
|
||||
op->Add(base);
|
||||
op->Add(shift);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpShiftLeftLogical(Id result_type, Id base, Id shift) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftLeftLogical, bound++,
|
||||
result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftLeftLogical, bound++, result_type)};
|
||||
op->Add(base);
|
||||
op->Add(shift);
|
||||
return AddCode(std::move(op));
|
||||
|
@ -4,20 +4,18 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::ConstantTrue(Id result_type) {
|
||||
return AddDeclaration(
|
||||
std::make_unique<Op>(spv::Op::OpConstantTrue, bound, result_type));
|
||||
return AddDeclaration(std::make_unique<Op>(spv::Op::OpConstantTrue, bound, result_type));
|
||||
}
|
||||
|
||||
Id Module::ConstantFalse(Id result_type) {
|
||||
return AddDeclaration(
|
||||
std::make_unique<Op>(spv::Op::OpConstantFalse, bound, result_type));
|
||||
return AddDeclaration(std::make_unique<Op>(spv::Op::OpConstantFalse, bound, result_type));
|
||||
}
|
||||
|
||||
Id Module::Constant(Id result_type, const Literal& literal) {
|
||||
@ -26,22 +24,17 @@ Id Module::Constant(Id result_type, const Literal& literal) {
|
||||
return AddDeclaration(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::ConstantComposite(Id result_type,
|
||||
const std::vector<Id>& constituents) {
|
||||
auto op{
|
||||
std::make_unique<Op>(spv::Op::OpConstantComposite, bound, result_type)};
|
||||
Id Module::ConstantComposite(Id result_type, const std::vector<Id>& constituents) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpConstantComposite, bound, result_type)};
|
||||
op->Add(constituents);
|
||||
return AddDeclaration(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::ConstantSampler(Id result_type,
|
||||
spv::SamplerAddressingMode addressing_mode,
|
||||
bool normalized,
|
||||
spv::SamplerFilterMode filter_mode) {
|
||||
Id Module::ConstantSampler(Id result_type, spv::SamplerAddressingMode addressing_mode,
|
||||
bool normalized, spv::SamplerFilterMode filter_mode) {
|
||||
AddCapability(spv::Capability::LiteralSampler);
|
||||
AddCapability(spv::Capability::Kernel);
|
||||
auto op{
|
||||
std::make_unique<Op>(spv::Op::OpConstantSampler, bound, result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpConstantSampler, bound, result_type)};
|
||||
op->Add(static_cast<u32>(addressing_mode));
|
||||
op->Add(normalized ? 1 : 0);
|
||||
op->Add(static_cast<u32>(filter_mode));
|
||||
@ -49,8 +42,7 @@ Id Module::ConstantSampler(Id result_type,
|
||||
}
|
||||
|
||||
Id Module::ConstantNull(Id result_type) {
|
||||
return AddDeclaration(
|
||||
std::make_unique<Op>(spv::Op::OpConstantNull, bound, result_type));
|
||||
return AddDeclaration(std::make_unique<Op>(spv::Op::OpConstantNull, bound, result_type));
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
|
@ -4,10 +4,10 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
|
@ -4,16 +4,15 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <spirv/unified1/GLSL.std.450.h>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
#include <spirv/unified1/GLSL.std.450.h>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpExtInst(Id result_type, Id set, u32 instruction,
|
||||
const std::vector<Id>& operands) {
|
||||
Id Module::OpExtInst(Id result_type, Id set, u32 instruction, const std::vector<Id>& operands) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpExtInst, bound++, result_type)};
|
||||
op->Add(set);
|
||||
op->Add(instruction);
|
||||
@ -28,15 +27,12 @@ Id Module::OpExtInst(Id result_type, Id set, u32 instruction,
|
||||
|
||||
#define DEFINE_BINARY(funcname, opcode) \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2) { \
|
||||
return OpExtInst(result_type, GetGLSLstd450(), opcode, \
|
||||
{operand_1, operand_2}); \
|
||||
return OpExtInst(result_type, GetGLSLstd450(), opcode, {operand_1, operand_2}); \
|
||||
}
|
||||
|
||||
#define DEFINE_TRINARY(funcname, opcode) \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2, \
|
||||
Id operand_3) { \
|
||||
return OpExtInst(result_type, GetGLSLstd450(), opcode, \
|
||||
{operand_1, operand_2, operand_3}); \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2, Id operand_3) { \
|
||||
return OpExtInst(result_type, GetGLSLstd450(), opcode, {operand_1, operand_2, operand_3}); \
|
||||
}
|
||||
|
||||
DEFINE_UNARY(OpFAbs, GLSLstd450FAbs)
|
||||
|
@ -4,16 +4,15 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpLoopMerge(Id merge_block, Id continue_target,
|
||||
spv::LoopControlMask loop_control,
|
||||
Id Module::OpLoopMerge(Id merge_block, Id continue_target, spv::LoopControlMask loop_control,
|
||||
const std::vector<Id>& literals) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpLoopMerge)};
|
||||
op->Add(merge_block);
|
||||
@ -23,15 +22,16 @@ Id Module::OpLoopMerge(Id merge_block, Id continue_target,
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpSelectionMerge(Id merge_block,
|
||||
spv::SelectionControlMask selection_control) {
|
||||
Id Module::OpSelectionMerge(Id merge_block, spv::SelectionControlMask selection_control) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpSelectionMerge)};
|
||||
op->Add(merge_block);
|
||||
op->Add(static_cast<u32>(selection_control));
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpLabel() { return AddCode(spv::Op::OpLabel, bound++); }
|
||||
Id Module::OpLabel() {
|
||||
return AddCode(spv::Op::OpLabel, bound++);
|
||||
}
|
||||
|
||||
Id Module::OpBranch(Id target_label) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpBranch)};
|
||||
@ -39,8 +39,8 @@ Id Module::OpBranch(Id target_label) {
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpBranchConditional(Id condition, Id true_label, Id false_label,
|
||||
u32 true_weight, u32 false_weight) {
|
||||
Id Module::OpBranchConditional(Id condition, Id true_label, Id false_label, u32 true_weight,
|
||||
u32 false_weight) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpBranchConditional)};
|
||||
op->Add(condition);
|
||||
op->Add(true_label);
|
||||
@ -52,8 +52,7 @@ Id Module::OpBranchConditional(Id condition, Id true_label, Id false_label,
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpSwitch(Id selector, Id default_label,
|
||||
const std::vector<Literal>& literals,
|
||||
Id Module::OpSwitch(Id selector, Id default_label, const std::vector<Literal>& literals,
|
||||
const std::vector<Id>& labels) {
|
||||
const std::size_t size = literals.size();
|
||||
assert(literals.size() == labels.size());
|
||||
@ -67,7 +66,9 @@ Id Module::OpSwitch(Id selector, Id default_label,
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpReturn() { return AddCode(spv::Op::OpReturn); }
|
||||
Id Module::OpReturn() {
|
||||
return AddCode(spv::Op::OpReturn);
|
||||
}
|
||||
|
||||
Id Module::OpReturnValue(Id value) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpReturnValue)};
|
||||
|
@ -10,20 +10,19 @@
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control,
|
||||
Id function_type) {
|
||||
Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control, Id function_type) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpFunction, bound++, result_type)};
|
||||
op->Add(static_cast<u32>(function_control));
|
||||
op->Add(function_type);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); }
|
||||
Id Module::OpFunctionEnd() {
|
||||
return AddCode(spv::Op::OpFunctionEnd);
|
||||
}
|
||||
|
||||
Id Module::OpFunctionCall(Id result_type, Id function,
|
||||
const std::vector<Id>& arguments) {
|
||||
auto op{
|
||||
std::make_unique<Op>(spv::Op::OpFunctionCall, bound++, result_type)};
|
||||
Id Module::OpFunctionCall(Id result_type, Id function, const std::vector<Id>& arguments) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpFunctionCall, bound++, result_type)};
|
||||
op->Add(function);
|
||||
op->Add(arguments);
|
||||
return AddCode(std::move(op));
|
||||
|
@ -10,8 +10,7 @@
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
static void
|
||||
AddImageOperands(Op* op, std::optional<spv::ImageOperandsMask> image_operands,
|
||||
static void AddImageOperands(Op* op, std::optional<spv::ImageOperandsMask> image_operands,
|
||||
const std::vector<Id>& operands) {
|
||||
if (!image_operands)
|
||||
return;
|
||||
@ -44,8 +43,7 @@ AddImageOperands(Op* op, std::optional<spv::ImageOperandsMask> image_operands,
|
||||
}
|
||||
|
||||
#define DEFINE_IMAGE_EXTRA_OP(opcode) \
|
||||
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, \
|
||||
Id extra, \
|
||||
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, Id extra, \
|
||||
std::optional<spv::ImageOperandsMask> image_operands, \
|
||||
const std::vector<Id>& operands) { \
|
||||
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
||||
@ -57,8 +55,8 @@ AddImageOperands(Op* op, std::optional<spv::ImageOperandsMask> image_operands,
|
||||
}
|
||||
|
||||
#define DEFINE_IMAGE_EXTRA_EXP_OP(opcode) \
|
||||
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, \
|
||||
Id extra, spv::ImageOperandsMask image_operands, Id lod, \
|
||||
Id Module::opcode(Id result_type, Id sampled_image, Id coordinate, Id extra, \
|
||||
spv::ImageOperandsMask image_operands, Id lod, \
|
||||
const std::vector<Id>& operands) { \
|
||||
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
||||
op->Add(sampled_image); \
|
||||
@ -104,8 +102,7 @@ DEFINE_IMAGE_QUERY_OP(OpImageQueryLevels)
|
||||
DEFINE_IMAGE_QUERY_OP(OpImageQuerySamples)
|
||||
|
||||
Id Module::OpSampledImage(Id result_type, Id image, Id sampler) {
|
||||
auto op{
|
||||
std::make_unique<Op>(spv::Op::OpSampledImage, bound++, result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpSampledImage, bound++, result_type)};
|
||||
op->Add(image);
|
||||
op->Add(sampler);
|
||||
return AddCode(std::move(op));
|
||||
|
@ -4,10 +4,10 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
@ -27,8 +27,7 @@ namespace Sirit {
|
||||
}
|
||||
|
||||
#define DEFINE_TRINARY(funcname, opcode) \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2, \
|
||||
Id operand_3) { \
|
||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2, Id operand_3) { \
|
||||
auto op{std::make_unique<Op>(opcode, bound++, result_type)}; \
|
||||
op->Add(operand_1); \
|
||||
op->Add(operand_2); \
|
||||
|
@ -4,14 +4,13 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpVariable(Id result_type, spv::StorageClass storage_class,
|
||||
Id initializer) {
|
||||
Id Module::OpVariable(Id result_type, spv::StorageClass storage_class, Id initializer) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpVariable, bound++, result_type)};
|
||||
op->Add(static_cast<u32>(storage_class));
|
||||
if (initializer) {
|
||||
@ -20,8 +19,7 @@ Id Module::OpVariable(Id result_type, spv::StorageClass storage_class,
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpLoad(Id result_type, Id pointer,
|
||||
std::optional<spv::MemoryAccessMask> memory_access) {
|
||||
Id Module::OpLoad(Id result_type, Id pointer, std::optional<spv::MemoryAccessMask> memory_access) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpLoad, bound++, result_type)};
|
||||
op->Add(pointer);
|
||||
if (memory_access) {
|
||||
@ -30,8 +28,7 @@ Id Module::OpLoad(Id result_type, Id pointer,
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpStore(Id pointer, Id object,
|
||||
std::optional<spv::MemoryAccessMask> memory_access) {
|
||||
Id Module::OpStore(Id pointer, Id object, std::optional<spv::MemoryAccessMask> memory_access) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpStore)};
|
||||
op->Add(pointer);
|
||||
op->Add(object);
|
||||
@ -41,8 +38,7 @@ Id Module::OpStore(Id pointer, Id object,
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpAccessChain(Id result_type, Id base,
|
||||
const std::vector<Id>& indexes) {
|
||||
Id Module::OpAccessChain(Id result_type, Id base, const std::vector<Id>& indexes) {
|
||||
assert(indexes.size() > 0);
|
||||
auto op{std::make_unique<Op>(spv::Op::OpAccessChain, bound++, result_type)};
|
||||
op->Add(base);
|
||||
@ -52,18 +48,15 @@ Id Module::OpAccessChain(Id result_type, Id base,
|
||||
|
||||
Id Module::OpCompositeInsert(Id result_type, Id object, Id composite,
|
||||
const std::vector<Literal>& indexes) {
|
||||
auto op{
|
||||
std::make_unique<Op>(spv::Op::OpCompositeInsert, bound++, result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpCompositeInsert, bound++, result_type)};
|
||||
op->Add(object);
|
||||
op->Add(composite);
|
||||
op->Add(indexes);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpCompositeExtract(Id result_type, Id composite,
|
||||
const std::vector<Literal>& indexes) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpCompositeExtract, bound++,
|
||||
result_type)};
|
||||
Id Module::OpCompositeExtract(Id result_type, Id composite, const std::vector<Literal>& indexes) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpCompositeExtract, bound++, result_type)};
|
||||
op->Add(composite);
|
||||
op->Add(indexes);
|
||||
return AddCode(std::move(op));
|
||||
@ -71,8 +64,7 @@ Id Module::OpCompositeExtract(Id result_type, Id composite,
|
||||
|
||||
Id Module::OpCompositeConstruct(Id result_type, const std::vector<Id>& ids) {
|
||||
assert(ids.size() >= 1);
|
||||
auto op{std::make_unique<Op>(spv::Op::OpCompositeConstruct, bound++,
|
||||
result_type)};
|
||||
auto op{std::make_unique<Op>(spv::Op::OpCompositeConstruct, bound++, result_type)};
|
||||
op->Add(ids);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "op.h"
|
||||
@ -63,8 +63,8 @@ Id Module::OpTypeMatrix(Id column_type, int column_count) {
|
||||
return AddDeclaration(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpTypeImage(Id sampled_type, spv::Dim dim, int depth, bool arrayed,
|
||||
bool ms, int sampled, spv::ImageFormat image_format,
|
||||
Id Module::OpTypeImage(Id sampled_type, spv::Dim dim, int depth, bool arrayed, bool ms, int sampled,
|
||||
spv::ImageFormat image_format,
|
||||
std::optional<spv::AccessQualifier> access_qualifier) {
|
||||
switch (dim) {
|
||||
case spv::Dim::Dim1D:
|
||||
|
@ -4,8 +4,8 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include "literal_number.h"
|
||||
#include <cassert>
|
||||
#include "literal_number.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
@ -23,7 +23,9 @@ void LiteralNumber::Fetch(Stream& stream) const {
|
||||
}
|
||||
}
|
||||
|
||||
u16 LiteralNumber::GetWordCount() const { return is_32 ? 1 : 2; }
|
||||
u16 LiteralNumber::GetWordCount() const {
|
||||
return is_32 ? 1 : 2;
|
||||
}
|
||||
|
||||
bool LiteralNumber::operator==(const Operand& other) const {
|
||||
if (operand_type == other.GetType()) {
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "operand.h"
|
||||
#include "stream.h"
|
||||
#include <cstring>
|
||||
#include <typeindex>
|
||||
#include "operand.h"
|
||||
#include "stream.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
@ -23,7 +23,8 @@ class LiteralNumber : public Operand {
|
||||
|
||||
virtual bool operator==(const Operand& other) const;
|
||||
|
||||
template <typename T> static LiteralNumber* Create(T value) {
|
||||
template <typename T>
|
||||
static LiteralNumber* Create(T value) {
|
||||
static_assert(sizeof(T) == 4 || sizeof(T) == 8);
|
||||
|
||||
LiteralNumber* number = new LiteralNumber(std::type_index(typeid(T)));
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include "literal_string.h"
|
||||
#include "common_types.h"
|
||||
#include <string>
|
||||
#include "common_types.h"
|
||||
#include "literal_string.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "operand.h"
|
||||
#include "stream.h"
|
||||
#include <string>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
|
16
src/op.cpp
16
src/op.cpp
@ -26,7 +26,9 @@ void Op::Fetch(Stream& stream) const {
|
||||
stream.Write(id.value());
|
||||
}
|
||||
|
||||
u16 Op::GetWordCount() const { return 1; }
|
||||
u16 Op::GetWordCount() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool Op::operator==(const Operand& other) const {
|
||||
if (operand_type != other.GetType()) {
|
||||
@ -100,11 +102,17 @@ void Op::Add(const std::vector<Literal>& literals) {
|
||||
}
|
||||
}
|
||||
|
||||
void Op::Add(const Operand* operand) { operands.push_back(operand); }
|
||||
void Op::Add(const Operand* operand) {
|
||||
operands.push_back(operand);
|
||||
}
|
||||
|
||||
void Op::Add(u32 integer) { Sink(LiteralNumber::Create<u32>(integer)); }
|
||||
void Op::Add(u32 integer) {
|
||||
Sink(LiteralNumber::Create<u32>(integer));
|
||||
}
|
||||
|
||||
void Op::Add(const std::string& string) { Sink(new LiteralString(string)); }
|
||||
void Op::Add(const std::string& string) {
|
||||
Sink(new LiteralString(string));
|
||||
}
|
||||
|
||||
void Op::Add(const std::vector<Id>& ids) {
|
||||
for (Id op : ids) {
|
||||
|
5
src/op.h
5
src/op.h
@ -6,18 +6,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include "common_types.h"
|
||||
#include "operand.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include "stream.h"
|
||||
#include <optional>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
class Op : public Operand {
|
||||
public:
|
||||
explicit Op(spv::Op opcode, std::optional<u32> id = {},
|
||||
Id result_type = nullptr);
|
||||
explicit Op(spv::Op opcode, std::optional<u32> id = {}, Id result_type = nullptr);
|
||||
~Op();
|
||||
|
||||
virtual void Fetch(Stream& stream) const;
|
||||
|
@ -4,8 +4,8 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include "operand.h"
|
||||
#include <cassert>
|
||||
#include "operand.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
@ -22,12 +22,16 @@ u16 Operand::GetWordCount() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Operand::operator==(const Operand& other) const { return false; }
|
||||
bool Operand::operator==(const Operand& other) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Operand::operator!=(const Operand& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
OperandType Operand::GetType() const { return operand_type; }
|
||||
OperandType Operand::GetType() const {
|
||||
return operand_type;
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
|
@ -4,16 +4,17 @@
|
||||
* Lesser General Public License version 3 or any later version.
|
||||
*/
|
||||
|
||||
#include "sirit/sirit.h"
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "stream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include "stream.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
template <typename T> static void WriteSet(Stream& stream, const T& set) {
|
||||
template <typename T>
|
||||
static void WriteSet(Stream& stream, const T& set) {
|
||||
for (const auto& item : set) {
|
||||
item->Write(stream);
|
||||
}
|
||||
@ -73,15 +74,13 @@ void Module::AddCapability(spv::Capability capability) {
|
||||
capabilities.insert(capability);
|
||||
}
|
||||
|
||||
void Module::SetMemoryModel(spv::AddressingModel addressing_model,
|
||||
spv::MemoryModel memory_model) {
|
||||
void Module::SetMemoryModel(spv::AddressingModel addressing_model, spv::MemoryModel memory_model) {
|
||||
this->addressing_model = addressing_model;
|
||||
this->memory_model = memory_model;
|
||||
}
|
||||
|
||||
void Module::AddEntryPoint(spv::ExecutionModel execution_model, Id entry_point,
|
||||
const std::string& name,
|
||||
const std::vector<Id>& interfaces) {
|
||||
const std::string& name, const std::vector<Id>& interfaces) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpEntryPoint)};
|
||||
op->Add(static_cast<u32>(execution_model));
|
||||
op->Add(entry_point);
|
||||
@ -121,8 +120,7 @@ Id Module::AddCode(spv::Op opcode, std::optional<u32> id) {
|
||||
}
|
||||
|
||||
Id Module::AddDeclaration(std::unique_ptr<Op> op) {
|
||||
const auto& found{
|
||||
std::find_if(declarations.begin(), declarations.end(),
|
||||
const auto& found{std::find_if(declarations.begin(), declarations.end(),
|
||||
[&op](const auto& other) { return *other == *op; })};
|
||||
if (found != declarations.end()) {
|
||||
return found->get();
|
||||
|
@ -41,6 +41,8 @@ void Stream::Write(u16 value) {
|
||||
Write(mem[1]);
|
||||
}
|
||||
|
||||
void Stream::Write(u8 value) { bytes.push_back(value); }
|
||||
void Stream::Write(u8 value) {
|
||||
bytes.push_back(value);
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common_types.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "common_types.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user