File: descriptor_update_template_decoder.h

package info (click to toggle)
gfxreconstruct 0.9.18%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 24,636 kB
  • sloc: cpp: 328,961; ansic: 25,454; python: 18,156; xml: 255; sh: 128; makefile: 6
file content (106 lines) | stat: -rw-r--r-- 5,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
** Copyright (c) 2018-2020 Valve Corporation
** Copyright (c) 2018-2020 LunarG, Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
** to deal in the Software without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Software, and to permit persons to whom the
** Software is furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
*/

#ifndef GFXRECON_DECODE_DESCRIPTOR_UPDATE_TEMPLATE_DECODER_H
#define GFXRECON_DECODE_DESCRIPTOR_UPDATE_TEMPLATE_DECODER_H

#include "decode/custom_vulkan_struct_decoders_forward.h"
#include "decode/pointer_decoder_base.h"
#include "format/format.h"
#include "generated/generated_vulkan_struct_decoders_forward.h"
#include "util/defines.h"

#include <memory>

GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(decode)

class DescriptorUpdateTemplateDecoder : public PointerDecoderBase
{
  public:
    DescriptorUpdateTemplateDecoder();

    ~DescriptorUpdateTemplateDecoder();

    const void* GetPointer() const { return template_memory_; }

    size_t GetImageInfoCount() const { return image_info_count_; }
    size_t GetBufferInfoCount() const { return buffer_info_count_; }
    size_t GetTexelBufferViewCount() const { return texel_buffer_view_count_; }
    size_t GetAccelerationStructureKHRCount() const { return acceleration_structure_khr_count_; }

    Decoded_VkDescriptorImageInfo*  GetImageInfoMetaStructPointer() { return decoded_image_info_; }
    Decoded_VkDescriptorBufferInfo* GetBufferInfoMetaStructPointer() { return decoded_buffer_info_; }
    format::HandleId* GetTexelBufferViewHandleIdsPointer() { return decoded_texel_buffer_view_handle_ids_; }
    format::HandleId*               GetAccelerationStructureKHRHandleIdsPointer()
    {
        return decoded_acceleration_structure_khr_handle_ids_;
    }

    const Decoded_VkDescriptorImageInfo*  GetImageInfoMetaStructPointer() const { return decoded_image_info_; }
    const Decoded_VkDescriptorBufferInfo* GetBufferInfoMetaStructPointer() const { return decoded_buffer_info_; }
    const format::HandleId* GetTexelBufferViewHandleIdsPointer() const { return decoded_texel_buffer_view_handle_ids_; }
    const format::HandleId* GetAccelerationStructureKHRHandleIdsPointer() const
    {
        return decoded_acceleration_structure_khr_handle_ids_;
    }

    VkDescriptorImageInfo*      GetImageInfoPointer() { return image_info_; }
    VkDescriptorBufferInfo*     GetBufferInfoPointer() { return buffer_info_; }
    VkBufferView*               GetTexelBufferViewPointer() { return texel_buffer_views_; }
    VkAccelerationStructureKHR* GetAccelerationStructureKHRPointer() { return acceleration_structures_khr_; }

    const VkDescriptorImageInfo*      GetImageInfoPointer() const { return image_info_; }
    const VkDescriptorBufferInfo*     GetBufferInfoPointer() const { return buffer_info_; }
    const VkBufferView*               GetTexelBufferViewPointer() const { return texel_buffer_views_; }
    const VkAccelerationStructureKHR* GetAccelerationStructureKHRPointer() const
    {
        return acceleration_structures_khr_;
    }

    size_t Decode(const uint8_t* buffer, size_t buffer_size);

  private:
    uint8_t* template_memory_;

    Decoded_VkDescriptorImageInfo*  decoded_image_info_;
    Decoded_VkDescriptorBufferInfo* decoded_buffer_info_;
    format::HandleId*               decoded_texel_buffer_view_handle_ids_;
    size_t                          image_info_count_;
    size_t                          buffer_info_count_;
    size_t                          texel_buffer_view_count_;
    VkDescriptorImageInfo*          image_info_;
    VkDescriptorBufferInfo*         buffer_info_;
    VkBufferView*                   texel_buffer_views_;

    // The decode data buffer may not contain data for these fields, depending on whether they were used by the captured
    // application.
    format::HandleId*           decoded_acceleration_structure_khr_handle_ids_;
    size_t                      acceleration_structure_khr_count_;
    VkAccelerationStructureKHR* acceleration_structures_khr_;
};

GFXRECON_END_NAMESPACE(decode)
GFXRECON_END_NAMESPACE(gfxrecon)

#endif // GFXRECON_DECODE_DESCRIPTOR_UPDATE_TEMPLATE_DECODER_H