| 136 | }; |
| 137 | |
| 138 | class codegen_spirv final : public codegen |
| 139 | { |
| 140 | static_assert(sizeof(id) == sizeof(spv::Id), "unexpected SPIR-V id type size"); |
| 141 | |
| 142 | public: |
| 143 | codegen_spirv(bool vulkan_semantics, bool debug_info, bool uniforms_to_spec_constants, bool enable_16bit_types, bool flip_vert_y) : |
| 144 | _debug_info(debug_info), |
| 145 | _vulkan_semantics(vulkan_semantics), |
| 146 | _uniforms_to_spec_constants(uniforms_to_spec_constants), |
| 147 | _enable_16bit_types(enable_16bit_types), |
| 148 | _flip_vert_y(flip_vert_y) |
| 149 | { |
| 150 | _glsl_ext = make_id(); |
| 151 | } |
| 152 | |
| 153 | private: |
| 154 | struct type_lookup |
| 155 | { |
| 156 | reshadefx::type type; |
| 157 | bool is_ptr; |
| 158 | uint32_t array_stride; |
| 159 | std::pair<spv::StorageClass, spv::ImageFormat> storage; |
| 160 | |
| 161 | friend bool operator==(const type_lookup &lhs, const type_lookup &rhs) |
| 162 | { |
| 163 | return lhs.type == rhs.type && lhs.is_ptr == rhs.is_ptr && lhs.array_stride == rhs.array_stride && lhs.storage == rhs.storage; |
| 164 | } |
| 165 | }; |
| 166 | struct function_blocks |
| 167 | { |
| 168 | spirv_basic_block declaration; |
| 169 | spirv_basic_block variables; |
| 170 | spirv_basic_block definition; |
| 171 | reshadefx::type return_type; |
| 172 | std::vector<reshadefx::type> param_types; |
| 173 | |
| 174 | friend bool operator==(const function_blocks &lhs, const function_blocks &rhs) |
| 175 | { |
| 176 | if (lhs.param_types.size() != rhs.param_types.size()) |
| 177 | return false; |
| 178 | for (size_t i = 0; i < lhs.param_types.size(); ++i) |
| 179 | if (!(lhs.param_types[i] == rhs.param_types[i])) |
| 180 | return false; |
| 181 | return lhs.return_type == rhs.return_type; |
| 182 | } |
| 183 | }; |
| 184 | |
| 185 | bool _debug_info = false; |
| 186 | bool _vulkan_semantics = false; |
| 187 | bool _uniforms_to_spec_constants = false; |
| 188 | bool _enable_16bit_types = false; |
| 189 | bool _flip_vert_y = false; |
| 190 | |
| 191 | spirv_basic_block _entries; |
| 192 | spirv_basic_block _execution_modes; |
| 193 | spirv_basic_block _debug_a; |
| 194 | spirv_basic_block _debug_b; |
| 195 | spirv_basic_block _annotations; |
nothing calls this directly
no test coverage detected