From 1aadec4f12110795bf288b28de85977f5bafe9c3 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 21 Sep 2017 21:41:20 -0700 Subject: [PATCH] add Shader_interface --- src/spirv_to_llvm/spirv_to_llvm.h | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/spirv_to_llvm/spirv_to_llvm.h b/src/spirv_to_llvm/spirv_to_llvm.h index d24fbb5..f2a7915 100644 --- a/src/spirv_to_llvm/spirv_to_llvm.h +++ b/src/spirv_to_llvm/spirv_to_llvm.h @@ -36,6 +36,7 @@ #include "util/string_view.h" #include "vulkan/vulkan.h" #include "vulkan/remove_xlib_macros.h" +#include "util/bitset.h" namespace kazan { @@ -55,6 +56,51 @@ struct LLVM_type_and_alignment } }; +struct Shader_interface +{ + /** uses a single type for both signed and unsigned integer variants */ + enum class Location_type + { + Int32, + Float32, + }; + enum class Interpolation_kind + { + Perspective, + Linear, + Flat, + }; + struct Location_descriptor + { + Location_type type; + util::bitset<4> used_components; + Interpolation_kind interpolation_kind; + constexpr Location_descriptor() noexcept : type(), used_components(), interpolation_kind() + { + } + constexpr Location_descriptor(Location_type type, + util::bitset<4> used_components, + Interpolation_kind interpolation_kind) noexcept + : type(type), + used_components(used_components), + interpolation_kind(interpolation_kind) + { + } + constexpr explicit operator bool() const noexcept + { + return used_components.any(); + } + }; + std::vector locations; + Shader_interface() noexcept : locations() + { + } + explicit Shader_interface(std::vector locations) noexcept + : locations(std::move(locations)) + { + } +}; + class Simple_type_descriptor; class Vector_type_descriptor; class Matrix_type_descriptor; -- 2.30.2