summaryrefslogtreecommitdiff
path: root/src/intel/vulkan/grl/gpu/presplit.grl
blob: d0f6e53fbb12084d7fa5e83f3aac444583db6817 (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
61
62
//
// Copyright (C) 2009-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT
//
//

module presplit;

kernel_module presplit_kernels ("bvh_build_presplit.cl")
{
    links lsc_intrinsics;

    kernel opencl_kernel_compute_num_presplits               < kernelFunction="compute_num_presplits" >;
    kernel opencl_kernel_priority_sum                        < kernelFunction="priority_sum"          >;
    kernel opencl_kernel_perform_presplits                   < kernelFunction="perform_presplits"     >;
}

import struct MKBuilderState "structs.grl";
import struct MKSizeEstimate "structs.grl";


metakernel compute_num_presplits(
    MKBuilderState state,
    qword presplit_buffer,
    dword numHwThreads )
{
    dispatch opencl_kernel_compute_num_presplits ( numHwThreads, 1, 1 ) args(
        state.build_globals,
        state.bvh_buffer,
        state.build_primref_buffer,
        presplit_buffer,
        state.geomDesc_buffer );
}


metakernel priority_sum(
    MKBuilderState state,
    MKSizeEstimate estimate,
    qword presplit_buffer )
{
    dispatch opencl_kernel_priority_sum ( 1, 1, 1 ) args(
        state.build_globals,
        presplit_buffer,
        estimate.numPrimitivesToSplit / 2 );
}

metakernel perform_presplits(
    MKBuilderState state,
    MKSizeEstimate estimate,
    qword presplit_buffer,
    dword numHwThreads )
{
    dispatch opencl_kernel_perform_presplits ( numHwThreads, 1, 1 ) args(
        state.build_globals,
        state.bvh_buffer,
        state.build_primref_buffer,
        presplit_buffer,
        state.bvh_buffer,
        state.geomDesc_buffer,
        estimate.numPrimitivesToSplit / 2 );
}