| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 694f53d commit d118090
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ | |||
| 9 | 9 | url = https://github.com/KhronosGroup/SPIRV-Headers.git | |
| 10 | 10 | [submodule "spirv-llvm-translator"] | |
| 11 | 11 | path = external/SPIRV-LLVM-Translator | |
| 12 | - url = https://github.com/kpet/SPIRV-LLVM-Translator | ||
| 12 | + url = https://github.com/KhronosGroup/SPIRV-LLVM-Translator | ||
| 13 | 13 | [submodule "spirv-tools"] | |
| 14 | 14 | path = external/SPIRV-Tools | |
| 15 | 15 | url = https://github.com/KhronosGroup/SPIRV-Tools.git | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,9 +72,10 @@ set(OpenCL-dependencies | |||
| 72 | 72 | ${Vulkan_LIBRARIES} | |
| 73 | 73 | ) | |
| 74 | 74 | ||
| 75 | + # The reflection parser requires the headers. | ||
| 76 | + target_include_directories(OpenCL-objects PRIVATE | ||
| 77 | + "${CLSPV_SOURCE_DIR}/include") | ||
| 75 | 78 | if (CLVK_CLSPV_ONLINE_COMPILER) | |
| 76 | - target_include_directories(OpenCL-objects PRIVATE | ||
| 77 | - "${CLSPV_SOURCE_DIR}/include") | ||
| 78 | 79 | set(OpenCL-dependencies ${OpenCL-dependencies} clspv_core) | |
| 79 | 80 | else() | |
| 80 | 81 | add_dependencies(OpenCL-objects clspv) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,9 +23,6 @@ | |||
| 23 | 23 | ||
| 24 | 24 | #include <vulkan/vulkan.h> | |
| 25 | 25 | ||
| 26 | - #ifdef CLSPV_ONLINE_COMPILER | ||
| 27 | - #include "clspv/DescriptorMap.h" | ||
| 28 | - #endif | ||
| 29 | 26 | #include "spirv-tools/libspirv.h" | |
| 30 | 27 | #include "spirv/1.0/spirv.hpp" | |
| 31 | 28 | ||
@@ -111,18 +108,14 @@ class spir_binary { | |||
| 111 | 108 | const uint32_t MAGIC = 0x00BEEF00; | |
| 112 | 109 | ||
| 113 | 110 | public: | |
| 114 | - spir_binary(spv_target_env env) : m_loaded_from_binary(false) { | ||
| 111 | + spir_binary(spv_target_env env) | ||
| 112 | + : m_loaded_from_binary(false), m_target_env(env) { | ||
| 115 | 113 | m_context = spvContextCreate(env); | |
| 116 | 114 | } | |
| 117 | 115 | ~spir_binary() { spvContextDestroy(m_context); } | |
| 118 | 116 | CHECK_RETURN bool load_spir(const char* fname); | |
| 119 | 117 | CHECK_RETURN bool load_spir(std::istream& istream, uint32_t size); | |
| 120 | - CHECK_RETURN bool load_descriptor_map(const char* fname); | ||
| 121 | - CHECK_RETURN bool load_descriptor_map(std::istream& istream); | ||
| 122 | - #ifdef CLSPV_ONLINE_COMPILER | ||
| 123 | - CHECK_RETURN bool load_descriptor_map( | ||
| 124 | - const std::vector<clspv::version0::DescriptorMapEntry>& entries); | ||
| 125 | - #endif | ||
| 118 | + CHECK_RETURN bool load_descriptor_map(); | ||
| 126 | 119 | void insert_descriptor_map(const spir_binary& other); | |
| 127 | 120 | CHECK_RETURN bool save_spir(const char* fname) const; | |
| 128 | 121 | CHECK_RETURN bool load(std::istream& istream); | |
@@ -165,18 +158,27 @@ class spir_binary { | |||
| 165 | 158 | } | |
| 166 | 159 | } | |
| 167 | 160 | ||
| 168 | - private: | ||
| 169 | - CHECK_RETURN bool parse_sampler(const std::vector<std::string>& tokens, | ||
| 170 | - int toknum); | ||
| 171 | - CHECK_RETURN bool parse_kernel(const std::vector<std::string>& tokens, | ||
| 172 | - int toknum); | ||
| 173 | - CHECK_RETURN bool parse_kernel_decl(const std::vector<std::string>& tokens, | ||
| 174 | - int toknum); | ||
| 175 | - CHECK_RETURN bool parse_pushconstant(const std::vector<std::string>& tokens, | ||
| 176 | - int toknum); | ||
| 177 | - CHECK_RETURN bool parse_specconstant(const std::vector<std::string>& tokens, | ||
| 178 | - int toknum); | ||
| 161 | + void add_kernel(const std::string& name) { m_dmaps[name] = {}; } | ||
| 162 | + | ||
| 163 | + void add_kernel_argument(const std::string& name, kernel_argument&& arg) { | ||
| 164 | + m_dmaps[name].push_back(arg); | ||
| 165 | + } | ||
| 179 | 166 | ||
| 167 | + void add_spec_constant(spec_constant constant, uint32_t spec_id) { | ||
| 168 | + m_spec_constants[constant] = spec_id; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + void add_push_constant(pushconstant pc, pushconstant_desc&& desc) { | ||
| 172 | + m_push_constants[pc] = desc; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + void add_literal_sampler(sampler_desc&& desc) { | ||
| 176 | + m_literal_samplers.push_back(desc); | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + bool strip_reflection(std::vector<uint32_t>* stripped); | ||
| 180 | + | ||
| 181 | + private: | ||
| 180 | 182 | spv_context m_context; | |
| 181 | 183 | std::vector<uint32_t> m_code; | |
| 182 | 184 | std::vector<sampler_desc> m_literal_samplers; | |
@@ -185,6 +187,7 @@ class spir_binary { | |||
| 185 | 187 | kernels_arguments_map m_dmaps; | |
| 186 | 188 | std::string m_dmaps_text; | |
| 187 | 189 | bool m_loaded_from_binary; | |
| 190 | + spv_target_env m_target_env; | ||
| 188 | 191 | }; | |
| 189 | 192 | ||
| 190 | 193 | enum class build_operation | |
@@ -507,6 +510,7 @@ struct cvk_program : public _cl_program, api_object { | |||
| 507 | 510 | VkPushConstantRange m_push_constant_range; | |
| 508 | 511 | std::unordered_map<std::string, std::unique_ptr<cvk_entry_point>> | |
| 509 | 512 | m_entry_points; | |
| 513 | + std::vector<uint32_t> m_stripped_binary; | ||
| 510 | 514 | }; | |
| 511 | 515 | ||
| 512 | 516 | static inline cvk_program* icd_downcast(cl_program program) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments