summaryrefslogtreecommitdiff
path: root/src/intel/vulkan/grl/include/GRLStructs.h
blob: c8af8313ffcd8b91954e3da2c66d6e4b54ffacf0 (plain)
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
//
// Copyright (C) 2009-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT
//
//

#pragma once

#include "GRLIntTypes.h"

GRL_NAMESPACE_BEGIN(GRL)
GRL_NAMESPACE_BEGIN(_INTERNAL)

    struct GeometryTriangles
    {
        gpuva_t        pTransformBuffer;
        gpuva_t        pIndexBuffer;
        gpuva_t        pVertexBuffer;
        qword          VertexBufferByteStride;
        dword          IndexCount;
        dword          VertexCount;
        IndexFormat    IndexFormat;
        VertexFormat   VertexFormat;
    };

    struct GeometryProcedural
    {
        gpuva_t  pAABBs_GPUVA; ///<elements of pAABBs_GPUVA are gpuAABB format.
        qword    AABBByteStride;
        dword    AABBCount;
    };

    // TODO we miss 'unsigned int ShaderIndex_Mask; // extension' field
    struct Geo
    {
        union
        {
            struct GeometryTriangles Triangles;
            struct GeometryProcedural Procedural;
        } Desc;

        GeometryType Type;
        uint8_t Flags;
    };

    // Matches the Vulkan VkAccelerationStructureBuildRangeInfoKHR structure
    // See Vulkan spec for data access rules:
    //     https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkAccelerationStructureBuildRangeInfoKHR.html
    //
    struct IndirectBuildRangeInfo
    {
        dword    primitiveCount;        // Number of primitives
        dword    primitiveOffset;       // Byte offset to primitive data
        dword    firstVertex;           // Index of first vertex
        dword    transformOffset;       // Byte offset to transform data (for triangle Geo with non-null transform)
    };

GRL_NAMESPACE_END(_INTERNAL)
GRL_NAMESPACE_END(GRL)