RetroArch
spirv_reflect.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Bradley Austin Davis
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SPIRV_CROSS_REFLECT_HPP
18 #define SPIRV_CROSS_REFLECT_HPP
19 
20 #include "spirv_glsl.hpp"
21 #include <utility>
22 #include <vector>
23 
24 namespace simple_json
25 {
26 class Stream;
27 }
28 
29 namespace spirv_cross
30 {
32 {
34 
35 public:
36  CompilerReflection(std::vector<uint32_t> spirv_)
37  : Parent(move(spirv_))
38  {
40  }
41 
42  CompilerReflection(const uint32_t *ir, size_t word_count)
43  : Parent(ir, word_count)
44  {
46  }
47 
48  void set_format(const std::string &format);
49  std::string compile() override;
50 
51 private:
53 
54  void emit_entry_points();
55  void emit_types();
56  void emit_resources();
58 
59  void emit_type(const SPIRType &type, bool &emitted_open_tag);
62  void emit_type_array(const SPIRType &type);
63  void emit_resources(const char *tag, const std::vector<Resource> &resources);
64 
66 
67  std::shared_ptr<simple_json::Stream> json_stream;
68 };
69 
70 } // namespace spirv_cross
71 
72 #endif
std::string compile() override
Definition: spirv_reflect.cpp:248
Definition: spirv_glsl.hpp:56
static const unsigned char tag[MAX_TESTS *3][16]
Definition: gcm.c:696
Definition: spirv_common.hpp:369
CompilerReflection(std::vector< uint32_t > spirv_)
Definition: spirv_reflect.hpp:36
static std::string execution_model_to_str(spv::ExecutionModel model)
Definition: spirv_reflect.cpp:374
GLsizei const GLchar *const * string
Definition: glext.h:6699
CompilerGLSL(std::vector< uint32_t > spirv_)
Definition: spirv_glsl.hpp:132
GLenum type
Definition: glext.h:6233
Options options
Definition: spirv_glsl.hpp:310
Definition: barrier.hpp:23
Definition: spirv_reflect.hpp:31
std::string to_member_name(const SPIRType &type, uint32_t index) const
Definition: spirv_reflect.cpp:566
void emit_resources()
Definition: spirv_reflect.cpp:413
void emit_type_member(const SPIRType &type, uint32_t index)
Definition: spirv_reflect.cpp:321
void emit_type_array(const SPIRType &type)
Definition: spirv_reflect.cpp:341
void emit_type_member_qualifiers(const SPIRType &type, uint32_t index)
Definition: spirv_reflect.cpp:355
std::shared_ptr< simple_json::Stream > json_stream
Definition: spirv_reflect.hpp:67
ExecutionModel
Definition: spirv.hpp:68
Definition: spirv_reflect.cpp:25
GLuint index
Definition: glext.h:6671
bool vulkan_semantics
Definition: spirv_glsl.hpp:72
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:6293
void emit_entry_points()
Definition: spirv_reflect.cpp:396
void set_format(const std::string &format)
Definition: spirv_reflect.cpp:240
CompilerReflection(const uint32_t *ir, size_t word_count)
Definition: spirv_reflect.hpp:42
void emit_specialization_constants()
Definition: spirv_reflect.cpp:526
void emit_types()
Definition: spirv_reflect.cpp:264
unsigned int uint32_t
Definition: stdint.h:126
void emit_type(const SPIRType &type, bool &emitted_open_tag)
Definition: spirv_reflect.cpp:286