upgpkg: ocaml-integers 0.5.0-1
[arch-packages.git] / mesa / trunk / swr-llvm13-patch2.patch
blobc87663eb196b930a41f340b31ff3c18b5785fbab
1 From 98859f67c3d54c9c6d8bbf55251717cbe3511f4e Mon Sep 17 00:00:00 2001
2 From: Grigory Vasilyev <h0tc0d3@gmail.com>
3 Date: Fri, 8 Oct 2021 15:26:49 +0300
4 Subject: [PATCH] Fix swr build with LLVM 13
6 ---
7 .../swr/rasterizer/jitter/builder_mem.cpp | 12 +++++++++++
8 .../swr/rasterizer/jitter/builder_mem.h | 4 ++++
9 src/gallium/drivers/swr/swr_shader.cpp | 20 ++++++++++++++-----
10 3 files changed, 31 insertions(+), 5 deletions(-)
12 diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
13 index b5eb0a782b1..ff0672cfd14 100644
14 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
15 +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
16 @@ -82,7 +82,11 @@ namespace SwrJit
17 std::vector<Value*> indices;
18 for (auto i : indexList)
19 indices.push_back(i);
20 +#if LLVM_VERSION_MAJOR >= 13
21 + return IN_BOUNDS_GEP(ptr->getType(), ptr, indices);
22 +#else
23 return IN_BOUNDS_GEP(ptr, indices);
24 +#endif
27 Value* Builder::IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<uint32_t>& indexList)
28 @@ -90,7 +94,11 @@ namespace SwrJit
29 std::vector<Value*> indices;
30 for (auto i : indexList)
31 indices.push_back(C(i));
32 +#if LLVM_VERSION_MAJOR >= 13
33 + return IN_BOUNDS_GEP(ptr->getType(), ptr, indices);
34 +#else
35 return IN_BOUNDS_GEP(ptr, indices);
36 +#endif
39 LoadInst* Builder::LOAD(Value* Ptr, const char* Name, Type* Ty, MEM_CLIENT usage)
40 @@ -234,7 +242,11 @@ namespace SwrJit
41 /// @param pVecPassthru - SIMD wide vector of values to load when lane is inactive
42 Value* Builder::GATHER_PTR(Value* pVecSrcPtr, Value* pVecMask, Value* pVecPassthru)
44 +#if LLVM_VERSION_MAJOR >= 13
45 + return MASKED_GATHER(pVecSrcPtr->getType(), pVecSrcPtr, AlignType(4), pVecMask, pVecPassthru);
46 +#else
47 return MASKED_GATHER(pVecSrcPtr, AlignType(4), pVecMask, pVecPassthru);
48 +#endif
51 void Builder::SCATTER_PTR(Value* pVecDstPtr, Value* pVecSrc, Value* pVecMask)
52 diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
53 index 429d5779a4d..c6cfb812b81 100644
54 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
55 +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
56 @@ -84,7 +84,11 @@ virtual CallInst* MASKED_LOAD(Value* Ptr,
57 Type* Ty = nullptr,
58 MEM_CLIENT usage = MEM_CLIENT::MEM_CLIENT_INTERNAL)
60 +#if LLVM_VERSION_MAJOR >= 13
61 + return IRB()->CreateMaskedLoad(Ptr->getType(), Ptr, AlignType(Align), Mask, PassThru, Name);
62 +#else
63 return IRB()->CreateMaskedLoad(Ptr, AlignType(Align), Mask, PassThru, Name);
64 +#endif
67 virtual StoreInst* STORE(Value *Val, Value *Ptr, bool isVolatile = false, Type* Ty = nullptr, MEM_CLIENT usage = MEM_CLIENT::MEM_CLIENT_INTERNAL)
68 diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
69 index 315036920fb..26e967759cd 100644
70 --- a/src/gallium/drivers/swr/swr_shader.cpp
71 +++ b/src/gallium/drivers/swr/swr_shader.cpp
72 @@ -1553,7 +1553,9 @@ BuilderSWR::CompileGS(struct swr_context *ctx, swr_jit_gs_key &key)
73 GlobalValue::ExternalLinkage,
74 "GS",
75 JM()->mpCurrentModule);
76 -#if LLVM_VERSION_MAJOR < 5
77 +#if LLVM_VERSION_MAJOR >= 13
78 + pFunction->addParamAttrs(AttributeList::FunctionIndex, attrBuilder);
79 +#elif LLVM_VERSION_MAJOR < 5
80 AttributeSet attrSet = AttributeSet::get(
81 JM()->mContext, AttributeSet::FunctionIndex, attrBuilder);
82 pFunction->addAttributes(AttributeSet::FunctionIndex, attrSet);
83 @@ -1781,7 +1783,9 @@ BuilderSWR::CompileTES(struct swr_context *ctx, swr_jit_tes_key &key)
84 "TES",
85 JM()->mpCurrentModule);
87 -#if LLVM_VERSION_MAJOR < 5
88 +#if LLVM_VERSION_MAJOR >= 13
89 + pFunction->addParamAttrs(AttributeList::FunctionIndex, attrBuilder);
90 +#elif LLVM_VERSION_MAJOR < 5
91 AttributeSet attrSet = AttributeSet::get(
92 JM()->mContext, AttributeSet::FunctionIndex, attrBuilder);
93 pFunction->addAttributes(AttributeSet::FunctionIndex, attrSet);
94 @@ -2082,7 +2086,9 @@ BuilderSWR::CompileTCS(struct swr_context *ctx, swr_jit_tcs_key &key)
95 "TCS",
96 JM()->mpCurrentModule);
98 -#if LLVM_VERSION_MAJOR < 5
99 +#if LLVM_VERSION_MAJOR >= 13
100 + pFunction->addParamAttrs(AttributeList::FunctionIndex, attrBuilder);
101 +#elif LLVM_VERSION_MAJOR < 5
102 AttributeSet attrSet = AttributeSet::get(
103 JM()->mContext, AttributeSet::FunctionIndex, attrBuilder);
104 pFunction->addAttributes(AttributeSet::FunctionIndex, attrSet);
105 @@ -2337,7 +2343,9 @@ BuilderSWR::CompileVS(struct swr_context *ctx, swr_jit_vs_key &key)
106 GlobalValue::ExternalLinkage,
107 "VS",
108 JM()->mpCurrentModule);
109 -#if LLVM_VERSION_MAJOR < 5
110 +#if LLVM_VERSION_MAJOR >= 13
111 + pFunction->addParamAttrs(AttributeList::FunctionIndex, attrBuilder);
112 +#elif LLVM_VERSION_MAJOR < 5
113 AttributeSet attrSet = AttributeSet::get(
114 JM()->mContext, AttributeSet::FunctionIndex, attrBuilder);
115 pFunction->addAttributes(AttributeSet::FunctionIndex, attrSet);
116 @@ -2642,7 +2650,9 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
117 GlobalValue::ExternalLinkage,
118 "FS",
119 JM()->mpCurrentModule);
120 -#if LLVM_VERSION_MAJOR < 5
121 +#if LLVM_VERSION_MAJOR >= 13
122 + pFunction->addParamAttrs(AttributeList::FunctionIndex, attrBuilder);
123 +#elif LLVM_VERSION_MAJOR < 5
124 AttributeSet attrSet = AttributeSet::get(
125 JM()->mContext, AttributeSet::FunctionIndex, attrBuilder);
126 pFunction->addAttributes(AttributeSet::FunctionIndex, attrSet);
128 GitLab