forked from oneapi-src/level-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibddi.cpp.mako
More file actions
60 lines (52 loc) · 1.36 KB
/
libddi.cpp.mako
File metadata and controls
60 lines (52 loc) · 1.36 KB
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
<%!
import re
from templates import helper as th
%><%
n=namespace
N=n.upper()
x=tags['$x']
X=x.upper()
%>/*
*
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file ${name}.cpp
*
*/
#include "${x}_lib.h"
#ifndef DYNAMIC_LOAD_LOADER
#include "${n}_ddi.h"
#endif
namespace ${x}_lib
{
///////////////////////////////////////////////////////////////////////////////
#ifdef DYNAMIC_LOAD_LOADER
__zedlllocal ${x}_result_t context_t::${n}DdiTableInit()
{
${x}_result_t result = ${X}_RESULT_SUCCESS;
%for tbl in th.get_pfntables(specs, meta, n, tags):
if( ${X}_RESULT_SUCCESS == result )
{
auto getTable = reinterpret_cast<${tbl['pfn']}>(
GET_FUNCTION_PTR(loader, "${tbl['export']['name']}") );
result = getTable( ${X}_API_VERSION_CURRENT, &initial${n}DdiTable.${tbl['name']} );
}
%endfor
return result;
}
#else
__zedlllocal ${x}_result_t context_t::${n}DdiTableInit()
{
${x}_result_t result = ${X}_RESULT_SUCCESS;
%for tbl in th.get_pfntables(specs, meta, n, tags):
if( ${X}_RESULT_SUCCESS == result )
{
result = ${tbl['export']['name']}( ${X}_API_VERSION_CURRENT, &initial${n}DdiTable.${tbl['name']} );
}
%endfor
return result;
}
#endif
} // namespace ${x}_lib