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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/****************************************************************************
* Copyright (C) 2015 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
***************************************************************************/
#pragma once
//////////////////////////////////////////////////////////////////////////
/// Generate LLVM type information for swr_jit_texture
INLINE static StructType *
Gen_swr_jit_texture(JitManager *pShG)
{
LLVMContext &ctx = pShG->mContext;
std::vector<Type *> members;
members.push_back(Type::getInt32Ty(ctx)); // width
members.push_back(Type::getInt32Ty(ctx)); // height
members.push_back(Type::getInt32Ty(ctx)); // depth
members.push_back(Type::getInt32Ty(ctx)); // first_level
members.push_back(Type::getInt32Ty(ctx)); // last_level
members.push_back(PointerType::get(Type::getInt8Ty(ctx), 0)); // base_ptr
members.push_back(ArrayType::get(Type::getInt32Ty(ctx),
PIPE_MAX_TEXTURE_LEVELS)); // row_stride
members.push_back(ArrayType::get(Type::getInt32Ty(ctx),
PIPE_MAX_TEXTURE_LEVELS)); // img_stride
members.push_back(ArrayType::get(Type::getInt32Ty(ctx),
PIPE_MAX_TEXTURE_LEVELS)); // mip_offsets
return StructType::get(ctx, members, false);
}
static const UINT swr_jit_texture_width = 0;
static const UINT swr_jit_texture_height = 1;
static const UINT swr_jit_texture_depth = 2;
static const UINT swr_jit_texture_first_level = 3;
static const UINT swr_jit_texture_last_level = 4;
static const UINT swr_jit_texture_base_ptr = 5;
static const UINT swr_jit_texture_row_stride = 6;
static const UINT swr_jit_texture_img_stride = 7;
static const UINT swr_jit_texture_mip_offsets = 8;
//////////////////////////////////////////////////////////////////////////
/// Generate LLVM type information for swr_jit_sampler
INLINE static StructType *
Gen_swr_jit_sampler(JitManager *pShG)
{
LLVMContext &ctx = pShG->mContext;
std::vector<Type *> members;
members.push_back(Type::getFloatTy(ctx)); // min_lod
members.push_back(Type::getFloatTy(ctx)); // max_lod
members.push_back(Type::getFloatTy(ctx)); // lod_bias
members.push_back(
ArrayType::get(Type::getFloatTy(ctx), 4)); // border_color
return StructType::get(ctx, members, false);
}
static const UINT swr_jit_sampler_min_lod = 0;
static const UINT swr_jit_sampler_max_lod = 1;
static const UINT swr_jit_sampler_lod_bias = 2;
static const UINT swr_jit_sampler_border_color = 3;
//////////////////////////////////////////////////////////////////////////
/// Generate LLVM type information for swr_draw_context
INLINE static StructType *
Gen_swr_draw_context(JitManager *pShG)
{
LLVMContext &ctx = pShG->mContext;
std::vector<Type *> members;
members.push_back(
ArrayType::get(PointerType::get(Type::getFloatTy(ctx), 0),
PIPE_MAX_CONSTANT_BUFFERS)); // constantVS
members.push_back(ArrayType::get(
Type::getInt32Ty(ctx), PIPE_MAX_CONSTANT_BUFFERS)); // num_constantsVS
members.push_back(
ArrayType::get(PointerType::get(Type::getFloatTy(ctx), 0),
PIPE_MAX_CONSTANT_BUFFERS)); // constantFS
members.push_back(ArrayType::get(
Type::getInt32Ty(ctx), PIPE_MAX_CONSTANT_BUFFERS)); // num_constantsFS
members.push_back(
ArrayType::get(Gen_swr_jit_texture(pShG),
PIPE_MAX_SHADER_SAMPLER_VIEWS)); // texturesVS
members.push_back(ArrayType::get(Gen_swr_jit_sampler(pShG),
PIPE_MAX_SAMPLERS)); // samplersVS
members.push_back(
ArrayType::get(Gen_swr_jit_texture(pShG),
PIPE_MAX_SHADER_SAMPLER_VIEWS)); // texturesFS
members.push_back(ArrayType::get(Gen_swr_jit_sampler(pShG),
PIPE_MAX_SAMPLERS)); // samplersFS
members.push_back(ArrayType::get(Gen_SWR_SURFACE_STATE(pShG),
SWR_NUM_ATTACHMENTS)); // renderTargets
return StructType::get(ctx, members, false);
}
static const UINT swr_draw_context_constantVS = 0;
static const UINT swr_draw_context_num_constantsVS = 1;
static const UINT swr_draw_context_constantFS = 2;
static const UINT swr_draw_context_num_constantsFS = 3;
static const UINT swr_draw_context_texturesVS = 4;
static const UINT swr_draw_context_samplersVS = 5;
static const UINT swr_draw_context_texturesFS = 6;
static const UINT swr_draw_context_samplersFS = 7;
static const UINT swr_draw_context_renderTargets = 8;
|