remove old files

This commit is contained in:
mgthepro
2022-01-24 11:43:50 +01:00
parent 87def5b55b
commit ae416cfe9f
8874 changed files with 0 additions and 2090184 deletions

View File

@@ -1,42 +0,0 @@
// Copyright (c) 2016 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
// https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
// Use the SPIR-V 1.1 core instruction set, but with 1.0 versions
// of the GLSL and OpenCL extended instruction sets.
#include <spirv/1.0/GLSL.std.450.h>
#include <spirv/1.0/OpenCL.std.h>
#include <spirv/1.1/spirv.hpp>
namespace {
const GLSLstd450 kSin = GLSLstd450Sin;
const OpenCLLIB::Entrypoints kNative_cos = OpenCLLIB::Native_cos;
const spv::Op kNop = spv::OpNop;
// This instruction is new in SPIR-V 1.1.
const spv::Op kNamedBarrierInit = spv::OpNamedBarrierInitialize;
} // anonymous namespace

View File

@@ -1,37 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#include <cassert>
#include "literal_number.h"
namespace Sirit {
LiteralNumber::LiteralNumber(u64 raw_, bool is_32_)
: Operand{OperandType::Number}, raw{raw_}, is_32{is_32_} {}
LiteralNumber::~LiteralNumber() = default;
void LiteralNumber::Fetch(Stream& stream) const {
if (is_32) {
stream.Write(static_cast<u32>(raw));
} else {
stream.Write(raw);
}
}
std::size_t LiteralNumber::GetWordCount() const noexcept {
return is_32 ? 1 : 2;
}
bool LiteralNumber::operator==(const Operand& other) const noexcept {
if (!EqualType(other)) {
return false;
}
const auto& o{static_cast<const LiteralNumber&>(other)};
return o.raw == raw && o.is_32 == is_32;
}
} // namespace Sirit

View File

@@ -1,43 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#pragma once
#include <cstddef>
#include <cstring>
#include <memory>
#include "operand.h"
#include "stream.h"
namespace Sirit {
class LiteralNumber final : public Operand {
public:
explicit LiteralNumber(u64 raw, bool is_32);
~LiteralNumber() override;
void Fetch(Stream& stream) const override;
std::size_t GetWordCount() const noexcept override;
bool operator==(const Operand& other) const noexcept override;
template <typename T>
static std::unique_ptr<LiteralNumber> Create(T value) {
static_assert(sizeof(T) == 4 || sizeof(T) == 8);
u64 raw{};
std::memcpy(&raw, &value, sizeof(T));
return std::make_unique<LiteralNumber>(raw, sizeof(T) == 4);
}
private:
u64 raw{};
bool is_32{};
};
} // namespace Sirit

View File

@@ -1,33 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#include <string>
#include "common_types.h"
#include "literal_string.h"
namespace Sirit {
LiteralString::LiteralString(std::string string_)
: Operand{OperandType::String}, string{std::move(string_)} {}
LiteralString::~LiteralString() = default;
void LiteralString::Fetch(Stream& stream) const {
stream.Write(string);
}
std::size_t LiteralString::GetWordCount() const noexcept {
return string.size() / 4 + 1;
}
bool LiteralString::operator==(const Operand& other) const noexcept {
if (!EqualType(other)) {
return false;
}
return static_cast<const LiteralString&>(other).string == string;
}
} // namespace Sirit

View File

@@ -1,30 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#pragma once
#include <string>
#include "operand.h"
#include "stream.h"
namespace Sirit {
class LiteralString final : public Operand {
public:
LiteralString(std::string string);
~LiteralString() override;
void Fetch(Stream& stream) const override;
std::size_t GetWordCount() const noexcept override;
bool operator==(const Operand& other) const noexcept override;
private:
std::string string;
};
} // namespace Sirit

View File

@@ -1,135 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#include <algorithm>
#include <cassert>
#include <limits>
#include "common_types.h"
#include "literal_number.h"
#include "literal_string.h"
#include "op.h"
#include "operand.h"
namespace Sirit {
Op::Op(spv::Op opcode_, std::optional<u32> id_, Id result_type_)
: Operand{OperandType::Op}, opcode{opcode_}, result_type{result_type_}, id{id_} {}
Op::~Op() = default;
void Op::Fetch(Stream& stream) const {
assert(id.has_value());
stream.Write(id.value());
}
std::size_t Op::GetWordCount() const noexcept {
return 1;
}
bool Op::operator==(const Operand& other) const noexcept {
if (!EqualType(other)) {
return false;
}
const auto& op = static_cast<const Op&>(other);
if (op.opcode == opcode && result_type == op.result_type &&
operands.size() == op.operands.size()) {
for (std::size_t i = 0; i < operands.size(); i++) {
if (*operands[i] != *op.operands[i]) {
return false;
}
}
return true;
}
return false;
}
void Op::Write(Stream& stream) const {
stream.Write(static_cast<u16>(opcode), CalculateTotalWords());
if (result_type) {
result_type->Fetch(stream);
}
if (id.has_value()) {
stream.Write(id.value());
}
for (const auto* operand : operands) {
operand->Fetch(stream);
}
}
void Op::Sink(std::unique_ptr<Operand> operand) {
Add(static_cast<const Operand*>(operand.get()));
operand_store.push_back(std::move(operand));
}
void Op::Add(const Literal& literal) {
Sink([&] {
switch (literal.index()) {
case 0:
return LiteralNumber::Create(std::get<0>(literal));
case 1:
return LiteralNumber::Create(std::get<1>(literal));
case 2:
return LiteralNumber::Create(std::get<2>(literal));
case 3:
return LiteralNumber::Create(std::get<3>(literal));
case 4:
return LiteralNumber::Create(std::get<4>(literal));
case 5:
return LiteralNumber::Create(std::get<5>(literal));
default:
// Invalid literal type
assert(0);
abort();
}
}());
}
void Op::Add(const std::vector<Literal>& literals) {
for (const auto& literal : literals) {
Add(literal);
}
}
void Op::Add(const Operand* operand) {
assert(operand);
operands.push_back(operand);
}
void Op::Add(u32 integer) {
Sink(LiteralNumber::Create(integer));
}
void Op::Add(s32 integer) {
Sink(LiteralNumber::Create(integer));
}
void Op::Add(std::string string) {
Sink(std::make_unique<LiteralString>(std::move(string)));
}
void Op::Add(const std::vector<Id>& ids) {
assert(std::all_of(ids.begin(), ids.end(), [](auto id_) { return id_; }));
operands.insert(operands.end(), ids.begin(), ids.end());
}
u16 Op::CalculateTotalWords() const noexcept {
std::size_t count = 1;
if (result_type) {
++count;
}
if (id.has_value()) {
++count;
}
for (const Operand* operand : operands) {
count += operand->GetWordCount();
}
assert(count < std::numeric_limits<u16>::max());
return static_cast<u16>(count);
}
} // namespace Sirit

View File

@@ -1,63 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#pragma once
#include <cstddef>
#include <optional>
#include <vector>
#include "common_types.h"
#include "operand.h"
#include "sirit/sirit.h"
#include "stream.h"
namespace Sirit {
class Op final : public Operand {
public:
explicit Op(spv::Op opcode, std::optional<u32> id = {}, Id result_type = nullptr);
~Op() override;
void Fetch(Stream& stream) const override;
std::size_t GetWordCount() const noexcept override;
bool operator==(const Operand& other) const noexcept override;
void Write(Stream& stream) const;
void Sink(std::unique_ptr<Operand> operand);
void Add(const Literal& literal);
void Add(const std::vector<Literal>& literals);
void Add(const Operand* operand);
void Add(u32 integer);
void Add(s32 integer);
void Add(std::string string);
void Add(const std::vector<Id>& ids);
private:
u16 CalculateTotalWords() const noexcept;
spv::Op opcode;
Id result_type;
std::optional<u32> id;
std::vector<const Operand*> operands;
std::vector<std::unique_ptr<Operand>> operand_store;
};
} // namespace Sirit

View File

@@ -1,16 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#include <cassert>
#include "operand.h"
namespace Sirit {
Operand::Operand(OperandType operand_type_) : operand_type{operand_type_} {}
Operand::~Operand() = default;
} // namespace Sirit

View File

@@ -1,40 +0,0 @@
/* This file is part of the sirit project.
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
*/
#pragma once
#include <cstddef>
#include "stream.h"
namespace Sirit {
enum class OperandType { Invalid, Op, Number, String };
class Operand {
public:
explicit Operand(OperandType operand_type);
virtual ~Operand();
virtual void Fetch(Stream& stream) const = 0;
virtual std::size_t GetWordCount() const noexcept = 0;
virtual bool operator==(const Operand& other) const noexcept = 0;
bool operator!=(const Operand& other) const noexcept {
return !operator==(other);
}
bool EqualType(const Operand& other) const noexcept {
return operand_type == other.operand_type;
}
private:
OperandType operand_type;
};
} // namespace Sirit