1 /****************************************************************************
2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * @brief Platform independent JIT interface
29 ******************************************************************************/
31 #include "common/os.h"
33 #include "fetch_jit.h"
34 #include "streamout_jit.h"
35 #include "blend_jit.h"
38 #define EXCEPTION_PRINT_STACK(ret) ret
42 #define JITCALL __stdcall
52 //////////////////////////////////////////////////////////////////////////
53 /// Jit Compile Info Input
54 //////////////////////////////////////////////////////////////////////////
55 struct JIT_COMPILE_INPUT
59 const void* pIR
; ///< Pointer to LLVM IR text.
61 bool enableJitSampler
;
64 //////////////////////////////////////////////////////////////////////////
65 /// @brief Create JIT context.
66 HANDLE JITCALL
JitCreateContext(uint32_t targetSimdWidth
, const char* arch
);
68 //////////////////////////////////////////////////////////////////////////
69 /// @brief Destroy JIT context.
70 void JITCALL
JitDestroyContext(HANDLE hJitContext
);
72 //////////////////////////////////////////////////////////////////////////
73 /// @brief JIT compile shader.
74 /// @param hJitContext - Jit Context
75 /// @param input - Input containing LLVM IR and other information
76 /// @param output - Output containing information about JIT shader
77 ShaderInfo
* JITCALL
JitCompileShader(
79 const JIT_COMPILE_INPUT
& input
);
81 //////////////////////////////////////////////////////////////////////////
82 /// @brief JIT destroy shader.
83 /// @param hJitContext - Jit Context
84 /// @param pShaderInfo - pointer to shader object.
85 void JITCALL
JitDestroyShader(
87 ShaderInfo
*& pShaderInfo
);
89 //////////////////////////////////////////////////////////////////////////
90 /// @brief JIT compiles fetch shader
91 /// @param hJitContext - Jit Context
92 /// @param state - Fetch state to build function from
93 PFN_FETCH_FUNC JITCALL
JitCompileFetch(HANDLE hJitContext
, const FETCH_COMPILE_STATE
& state
);
95 //////////////////////////////////////////////////////////////////////////
96 /// @brief JIT compiles streamout shader
97 /// @param hJitContext - Jit Context
98 /// @param state - SO state to build function from
99 PFN_SO_FUNC JITCALL
JitCompileStreamout(HANDLE hJitContext
, const STREAMOUT_COMPILE_STATE
& state
);
101 //////////////////////////////////////////////////////////////////////////
102 /// @brief JIT compiles blend shader
103 /// @param hJitContext - Jit Context
104 /// @param state - blend state to build function from
105 PFN_BLEND_JIT_FUNC JITCALL
JitCompileBlend(HANDLE hJitContext
, const BLEND_COMPILE_STATE
& state
);