Path: blob/21.2-virgl/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h
4574 views
/****************************************************************************1* Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*22* @file jit_api.h23*24* @brief Platform independent JIT interface25*26* Notes:27*28******************************************************************************/29#pragma once30#include "common/os.h"31#include "core/utils.h"3233#include "fetch_jit.h"34#include "streamout_jit.h"35#include "blend_jit.h"3637#include <stdlib.h>3839#if defined(_WIN32)40#define EXCEPTION_PRINT_STACK(ret) ret41#endif // _WIN324243#if defined(_WIN32)44#define JITCALL __stdcall45#else46#define JITCALL47#endif484950struct ShaderInfo;5152//////////////////////////////////////////////////////////////////////////53/// Jit Compile Info Input54//////////////////////////////////////////////////////////////////////////55struct JIT_COMPILE_INPUT56{57SWR_SHADER_TYPE type;58uint32_t crc;5960const void* pIR; ///< Pointer to LLVM IR text.61size_t irLength;6263bool enableJitSampler;6465};666768extern "C" {6970//////////////////////////////////////////////////////////////////////////71/// @brief Create JIT context.72HANDLE JITCALL JitCreateContext(uint32_t targetSimdWidth, const char* arch, const char* core);7374//////////////////////////////////////////////////////////////////////////75/// @brief Destroy JIT context.76void JITCALL JitDestroyContext(HANDLE hJitContext);7778//////////////////////////////////////////////////////////////////////////79/// @brief JIT compile shader.80/// @param hJitContext - Jit Context81/// @param input - Input containing LLVM IR and other information82/// @param output - Output containing information about JIT shader83ShaderInfo* JITCALL JitCompileShader(HANDLE hJitContext, const JIT_COMPILE_INPUT& input);8485ShaderInfo* JITCALL JitGetShader(HANDLE hJitContext, const char* name);8687//////////////////////////////////////////////////////////////////////////88/// @brief JIT destroy shader.89/// @param hJitContext - Jit Context90/// @param pShaderInfo - pointer to shader object.91void JITCALL JitDestroyShader(HANDLE hJitContext, ShaderInfo*& pShaderInfo);9293//////////////////////////////////////////////////////////////////////////94/// @brief JIT compiles fetch shader95/// @param hJitContext - Jit Context96/// @param state - Fetch state to build function from97PFN_FETCH_FUNC JITCALL JitCompileFetch(HANDLE hJitContext, const FETCH_COMPILE_STATE& state);9899//////////////////////////////////////////////////////////////////////////100/// @brief JIT compiles streamout shader101/// @param hJitContext - Jit Context102/// @param state - SO state to build function from103PFN_SO_FUNC JITCALL JitCompileStreamout(HANDLE hJitContext, const STREAMOUT_COMPILE_STATE& state);104105//////////////////////////////////////////////////////////////////////////106/// @brief JIT compiles blend shader107/// @param hJitContext - Jit Context108/// @param state - blend state to build function from109PFN_BLEND_JIT_FUNC JITCALL JitCompileBlend(HANDLE hJitContext, const BLEND_COMPILE_STATE& state);110111}112113114115