1 /****************************************************************************
2 * Copyright (C) 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
22 ***************************************************************************/
26 //////////////////////////////////////////////////////////////////////////
27 /// Generate LLVM type information for swr_jit_texture
28 INLINE
static StructType
*
29 Gen_swr_jit_texture(JitManager
*pShG
)
31 LLVMContext
&ctx
= pShG
->mContext
;
32 std::vector
<Type
*> members
;
34 members
.push_back(Type::getInt32Ty(ctx
)); // width
35 members
.push_back(Type::getInt32Ty(ctx
)); // height
36 members
.push_back(Type::getInt32Ty(ctx
)); // depth
37 members
.push_back(Type::getInt32Ty(ctx
)); // first_level
38 members
.push_back(Type::getInt32Ty(ctx
)); // last_level
39 members
.push_back(PointerType::get(Type::getInt8Ty(ctx
), 0)); // base_ptr
40 members
.push_back(ArrayType::get(Type::getInt32Ty(ctx
),
41 PIPE_MAX_TEXTURE_LEVELS
)); // row_stride
42 members
.push_back(ArrayType::get(Type::getInt32Ty(ctx
),
43 PIPE_MAX_TEXTURE_LEVELS
)); // img_stride
44 members
.push_back(ArrayType::get(Type::getInt32Ty(ctx
),
45 PIPE_MAX_TEXTURE_LEVELS
)); // mip_offsets
47 return StructType::get(ctx
, members
, false);
50 static const UINT swr_jit_texture_width
= 0;
51 static const UINT swr_jit_texture_height
= 1;
52 static const UINT swr_jit_texture_depth
= 2;
53 static const UINT swr_jit_texture_first_level
= 3;
54 static const UINT swr_jit_texture_last_level
= 4;
55 static const UINT swr_jit_texture_base_ptr
= 5;
56 static const UINT swr_jit_texture_row_stride
= 6;
57 static const UINT swr_jit_texture_img_stride
= 7;
58 static const UINT swr_jit_texture_mip_offsets
= 8;
60 //////////////////////////////////////////////////////////////////////////
61 /// Generate LLVM type information for swr_jit_sampler
62 INLINE
static StructType
*
63 Gen_swr_jit_sampler(JitManager
*pShG
)
65 LLVMContext
&ctx
= pShG
->mContext
;
66 std::vector
<Type
*> members
;
68 members
.push_back(Type::getFloatTy(ctx
)); // min_lod
69 members
.push_back(Type::getFloatTy(ctx
)); // max_lod
70 members
.push_back(Type::getFloatTy(ctx
)); // lod_bias
72 ArrayType::get(Type::getFloatTy(ctx
), 4)); // border_color
74 return StructType::get(ctx
, members
, false);
77 static const UINT swr_jit_sampler_min_lod
= 0;
78 static const UINT swr_jit_sampler_max_lod
= 1;
79 static const UINT swr_jit_sampler_lod_bias
= 2;
80 static const UINT swr_jit_sampler_border_color
= 3;
82 //////////////////////////////////////////////////////////////////////////
83 /// Generate LLVM type information for swr_draw_context
84 INLINE
static StructType
*
85 Gen_swr_draw_context(JitManager
*pShG
)
87 LLVMContext
&ctx
= pShG
->mContext
;
88 std::vector
<Type
*> members
;
91 ArrayType::get(PointerType::get(Type::getFloatTy(ctx
), 0),
92 PIPE_MAX_CONSTANT_BUFFERS
)); // constantVS
93 members
.push_back(ArrayType::get(
94 Type::getInt32Ty(ctx
), PIPE_MAX_CONSTANT_BUFFERS
)); // num_constantsVS
96 ArrayType::get(PointerType::get(Type::getFloatTy(ctx
), 0),
97 PIPE_MAX_CONSTANT_BUFFERS
)); // constantFS
98 members
.push_back(ArrayType::get(
99 Type::getInt32Ty(ctx
), PIPE_MAX_CONSTANT_BUFFERS
)); // num_constantsFS
101 ArrayType::get(Gen_swr_jit_texture(pShG
),
102 PIPE_MAX_SHADER_SAMPLER_VIEWS
)); // texturesVS
103 members
.push_back(ArrayType::get(Gen_swr_jit_sampler(pShG
),
104 PIPE_MAX_SAMPLERS
)); // samplersVS
106 ArrayType::get(Gen_swr_jit_texture(pShG
),
107 PIPE_MAX_SHADER_SAMPLER_VIEWS
)); // texturesFS
108 members
.push_back(ArrayType::get(Gen_swr_jit_sampler(pShG
),
109 PIPE_MAX_SAMPLERS
)); // samplersFS
110 members
.push_back(ArrayType::get(Gen_SWR_SURFACE_STATE(pShG
),
111 SWR_NUM_ATTACHMENTS
)); // renderTargets
113 return StructType::get(ctx
, members
, false);
116 static const UINT swr_draw_context_constantVS
= 0;
117 static const UINT swr_draw_context_num_constantsVS
= 1;
118 static const UINT swr_draw_context_constantFS
= 2;
119 static const UINT swr_draw_context_num_constantsFS
= 3;
120 static const UINT swr_draw_context_texturesVS
= 4;
121 static const UINT swr_draw_context_samplersVS
= 5;
122 static const UINT swr_draw_context_texturesFS
= 6;
123 static const UINT swr_draw_context_samplersFS
= 7;
124 static const UINT swr_draw_context_renderTargets
= 8;