| 402 | } |
| 403 | |
| 404 | void SPIRVReflection::parse_push_constants(const spirv_cross::Compiler &compiler, VkShaderStageFlagBits stage, std::vector<ShaderResource> &resources, const ShaderVariant &variant) |
| 405 | { |
| 406 | auto shader_resources = compiler.get_shader_resources(); |
| 407 | |
| 408 | for (auto &resource : shader_resources.push_constant_buffers) |
| 409 | { |
| 410 | const auto &spivr_type = compiler.get_type_from_variable(resource.id); |
| 411 | |
| 412 | std::uint32_t offset = std::numeric_limits<std::uint32_t>::max(); |
| 413 | |
| 414 | for (auto i = 0U; i < spivr_type.member_types.size(); ++i) |
| 415 | { |
| 416 | auto mem_offset = compiler.get_member_decoration(spivr_type.self, i, spv::DecorationOffset); |
| 417 | |
| 418 | offset = std::min(offset, mem_offset); |
| 419 | } |
| 420 | |
| 421 | ShaderResource shader_resource{}; |
| 422 | shader_resource.type = ShaderResourceType::PushConstant; |
| 423 | shader_resource.stages = stage; |
| 424 | shader_resource.name = resource.name; |
| 425 | shader_resource.offset = offset; |
| 426 | |
| 427 | read_resource_size(compiler, resource, shader_resource, variant); |
| 428 | |
| 429 | shader_resource.size -= shader_resource.offset; |
| 430 | |
| 431 | resources.push_back(shader_resource); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | void SPIRVReflection::parse_specialization_constants(const spirv_cross::Compiler &compiler, VkShaderStageFlagBits stage, std::vector<ShaderResource> &resources, const ShaderVariant &variant) |
| 436 | { |
nothing calls this directly
no test coverage detected