summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/Makefile.am
blob: 2bc129429c695864bdd0cd0642cab0f1661f4359 (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# 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.

include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc

AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) $(CXX11_CXXFLAGS)

noinst_LTLIBRARIES = libmesaswr.la

libmesaswr_la_SOURCES = \
	$(CXX_SOURCES) \
	$(JITTER_CXX_SOURCES) \
	$(LOADER_SOURCES)

COMMON_CXXFLAGS = \
	-fno-strict-aliasing \
	$(GALLIUM_DRIVER_CFLAGS) \
	$(LLVM_CXXFLAGS) \
	$(CXX11_CXXFLAGS) \
	-I$(builddir)/rasterizer/codegen \
	-I$(builddir)/rasterizer/core \
	-I$(builddir)/rasterizer/jitter \
	-I$(builddir)/rasterizer/archrast \
	-I$(srcdir)/rasterizer \
	-I$(srcdir)/rasterizer/core \
	-I$(srcdir)/rasterizer/codegen \
	-I$(srcdir)/rasterizer/jitter \
	-I$(srcdir)/rasterizer/archrast

# SWR_AVX_CXXFLAGS needed for intrinsic usage in swr api headers
libmesaswr_la_CXXFLAGS = \
	$(SWR_AVX_CXXFLAGS) \
	$(COMMON_CXXFLAGS)

if HAVE_SWR_AVX
libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX
endif

if HAVE_SWR_AVX2
libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX2
endif

if HAVE_SWR_KNL
libmesaswr_la_CXXFLAGS += -DHAVE_SWR_KNL
endif

if HAVE_SWR_SKX
libmesaswr_la_CXXFLAGS += -DHAVE_SWR_SKX
endif

COMMON_SOURCES = \
	$(ARCHRAST_CXX_SOURCES) \
	$(COMMON_CXX_SOURCES) \
	$(CORE_CXX_SOURCES) \
	$(MEMORY_CXX_SOURCES) \
	$(BUILT_SOURCES)

BUILT_SOURCES = \
	gen_swr_context_llvm.h \
	rasterizer/codegen/gen_knobs.cpp \
	rasterizer/codegen/gen_knobs.h \
	rasterizer/jitter/gen_state_llvm.h \
	rasterizer/jitter/gen_builder.hpp \
	rasterizer/jitter/gen_builder_x86.hpp \
	rasterizer/archrast/gen_ar_event.hpp \
	rasterizer/archrast/gen_ar_event.cpp \
	rasterizer/archrast/gen_ar_eventhandler.hpp \
	rasterizer/archrast/gen_ar_eventhandlerfile.hpp \
	rasterizer/core/backends/gen_BackendPixelRate0.cpp \
	rasterizer/core/backends/gen_BackendPixelRate1.cpp \
	rasterizer/core/backends/gen_BackendPixelRate2.cpp \
	rasterizer/core/backends/gen_BackendPixelRate3.cpp \
	rasterizer/core/backends/gen_BackendPixelRate.hpp \
	rasterizer/core/backends/gen_rasterizer0.cpp \
	rasterizer/core/backends/gen_rasterizer1.cpp \
	rasterizer/core/backends/gen_rasterizer2.cpp \
	rasterizer/core/backends/gen_rasterizer3.cpp \
	rasterizer/core/backends/gen_rasterizer.hpp

MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
gen_swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp swr_context.h
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
		--input $(srcdir)/swr_context.h \
		--output ./gen_swr_context_llvm.h

rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/gen_knobs.cpp rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_knobs.py \
		--output rasterizer/codegen/gen_knobs.cpp \
		--gen_cpp

rasterizer/codegen/gen_knobs.h: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/gen_knobs.h rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_knobs.py \
		--output rasterizer/codegen/gen_knobs.h \
		--gen_h

rasterizer/jitter/gen_state_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp rasterizer/core/state.h rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
		--input $(srcdir)/rasterizer/core/state.h \
		--output rasterizer/jitter/gen_state_llvm.h

rasterizer/jitter/gen_builder.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
		--input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
		--output rasterizer/jitter \
		--gen_h

rasterizer/jitter/gen_builder_x86.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
		--output rasterizer/jitter \
		--gen_x86_h

rasterizer/archrast/gen_ar_event.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.hpp rasterizer/archrast/events.proto rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_archrast.py \
		--proto $(srcdir)/rasterizer/archrast/events.proto \
		--output rasterizer/archrast/gen_ar_event.hpp \
		--gen_event_h

rasterizer/archrast/gen_ar_event.cpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.cpp rasterizer/archrast/events.proto rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_archrast.py \
		--proto $(srcdir)/rasterizer/archrast/events.proto \
		--output rasterizer/archrast/gen_ar_event.cpp \
		--gen_event_cpp

rasterizer/archrast/gen_ar_eventhandler.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandler.hpp rasterizer/archrast/events.proto rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_archrast.py \
		--proto $(srcdir)/rasterizer/archrast/events.proto \
		--output rasterizer/archrast/gen_ar_eventhandler.hpp \
		--gen_eventhandler_h

rasterizer/archrast/gen_ar_eventhandlerfile.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp rasterizer/archrast/events.proto rasterizer/codegen/gen_common.py
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_archrast.py \
		--proto $(srcdir)/rasterizer/archrast/events.proto \
		--output rasterizer/archrast/gen_ar_eventhandlerfile.hpp \
		--gen_eventhandlerfile_h

rasterizer/core/backends/gen_BackendPixelRate0.cpp \
rasterizer/core/backends/gen_BackendPixelRate1.cpp \
rasterizer/core/backends/gen_BackendPixelRate2.cpp \
rasterizer/core/backends/gen_BackendPixelRate3.cpp \
rasterizer/core/backends/gen_BackendPixelRate.hpp: \
backend.intermediate

# 5 SWR_MULTISAMPLE_TYPE_COUNT
# 2 SWR_MSAA_SAMPLE_PATTERN_COUNT
# 3 SWR_INPUT_COVERAGE_COUNT
# 2 centroid
# 2 forcedSampleCount
# 2 canEarlyZ

# use intermediate rule to tell make that all files can be
# generated in one invocation of gen_backends.py (prevents
# parallel make race condition)
.INTERMEDIATE: backend.intermediate
backend.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/gen_backend.cpp rasterizer/codegen/templates/gen_header_init.hpp
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_backends.py \
		--outdir rasterizer/core/backends \
		--dim 5 2 3 2 2 2 \
		--numfiles 4 \
		--cpp \
		--hpp

rasterizer/core/backends/gen_rasterizer0.cpp \
rasterizer/core/backends/gen_rasterizer1.cpp \
rasterizer/core/backends/gen_rasterizer2.cpp \
rasterizer/core/backends/gen_rasterizer3.cpp \
rasterizer/core/backends/gen_rasterizer.hpp: \
rasterizer.intermediate

# 5 SWR_MULTISAMPLE_TYPE_COUNT
# 2 CenterPattern
# 2 Conservative
# 3 SWR_INPUT_COVERAGE_COUNT
# 5 STATE_VALID_TRI_EDGE_COUNT
# 2 RasterScissorEdges

# use intermediate rule to tell make that all files can be
# generated in one invocation of gen_backends.py (prevents
# parallel make race condition)
.INTERMEDIATE: rasterizer.intermediate
rasterizer.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/gen_rasterizer.cpp rasterizer/codegen/templates/gen_header_init.hpp
	$(MKDIR_GEN)
	$(PYTHON_GEN) \
		$(srcdir)/rasterizer/codegen/gen_backends.py \
		--outdir rasterizer/core/backends \
		--rast \
		--dim 5 2 2 3 5 2 \
		--numfiles 4 \
		--cpp \
		--hpp

COMMON_LDFLAGS = \
	-shared \
	-module \
	-no-undefined \
	$(GC_SECTIONS) \
	$(LD_NO_UNDEFINED)

lib_LTLIBRARIES =

if HAVE_SWR_AVX
libswrAVX_la_CXXFLAGS = \
	$(PTHREAD_CFLAGS) \
	$(SWR_AVX_CXXFLAGS) \
	-DKNOB_ARCH=KNOB_ARCH_AVX \
	$(COMMON_CXXFLAGS)

libswrAVX_la_SOURCES = \
	$(COMMON_SOURCES)

libswrAVX_la_LIBADD = \
	$(PTHREAD_LIBS)

libswrAVX_la_LDFLAGS = \
	$(COMMON_LDFLAGS)
endif

if HAVE_SWR_AVX2
libswrAVX2_la_CXXFLAGS = \
	$(PTHREAD_CFLAGS) \
	$(SWR_AVX2_CXXFLAGS) \
	-DKNOB_ARCH=KNOB_ARCH_AVX2 \
	$(COMMON_CXXFLAGS)

libswrAVX2_la_SOURCES = \
	$(COMMON_SOURCES)

libswrAVX2_la_LIBADD = \
	$(PTHREAD_LIBS)

libswrAVX2_la_LDFLAGS = \
	$(COMMON_LDFLAGS)
endif

if HAVE_SWR_KNL
libswrKNL_la_CXXFLAGS = \
	$(PTHREAD_CFLAGS) \
	$(SWR_KNL_CXXFLAGS) \
	-DKNOB_ARCH=KNOB_ARCH_AVX512 -DSIMD_ARCH_KNIGHTS \
	$(COMMON_CXXFLAGS)

libswrKNL_la_SOURCES = \
	$(COMMON_SOURCES)

libswrKNL_la_LIBADD = \
	$(PTHREAD_LIBS)

libswrKNL_la_LDFLAGS = \
	$(COMMON_LDFLAGS)
endif

if HAVE_SWR_SKX
libswrSKX_la_CXXFLAGS = \
	$(PTHREAD_CFLAGS) \
	$(SWR_SKX_CXXFLAGS) \
	-DKNOB_ARCH=KNOB_ARCH_AVX512 \
	$(COMMON_CXXFLAGS)

libswrSKX_la_SOURCES = \
	$(COMMON_SOURCES)

libswrSKX_la_LIBADD = \
	$(PTHREAD_LIBS)

libswrSKX_la_LDFLAGS = \
	$(COMMON_LDFLAGS)
endif

if HAVE_SWR_BUILTIN
libmesaswr_la_CXXFLAGS += -DHAVE_SWR_BUILTIN
libmesaswr_la_LIBADD =
if HAVE_SWR_AVX
noinst_LTLIBRARIES += libswrAVX.la
libmesaswr_la_LIBADD += libswrAVX.la
endif
if HAVE_SWR_AVX2
noinst_LTLIBRARIES += libswrAVX2.la
libmesaswr_la_LIBADD += libswrAVX2.la
endif
if HAVE_SWR_KNL
noinst_LTLIBRARIES += libswrKNL.la
libmesaswr_la_LIBADD += libswrKNL.la
endif
if HAVE_SWR_SKX
noinst_LTLIBRARIES += libswrSKX.la
libmesaswr_la_LIBADD += libswrSKX.la
endif
else # !HAVE_SWR_BUILTIN
# gen_knobs.* included here to provide driver access to swr configuration
libmesaswr_la_SOURCES += \
       $(COMMON_CXX_SOURCES) \
       rasterizer/codegen/gen_knobs.cpp \
       rasterizer/codegen/gen_knobs.h
if HAVE_SWR_AVX
lib_LTLIBRARIES += libswrAVX.la
endif
if HAVE_SWR_AVX2
lib_LTLIBRARIES += libswrAVX2.la
endif
if HAVE_SWR_KNL
lib_LTLIBRARIES += libswrKNL.la
endif
if HAVE_SWR_SKX
lib_LTLIBRARIES += libswrSKX.la
endif
endif

include $(top_srcdir)/install-gallium-links.mk

# Generated gen_builder.hpp is not backwards compatible. So ship only one
# created with the oldest supported version of LLVM.
dist-hook:
if SWR_INVALID_LLVM_VERSION
	@echo "*******************************************************"
	@echo "LLVM 3.9.0 or LLVM 3.9.1 required to create the tarball"
	@echo "*******************************************************"
	@test
endif

EXTRA_DIST = \
	SConscript \
	meson.build \
	rasterizer/codegen/meson.build \
	rasterizer/archrast/events.proto \
	rasterizer/codegen/gen_llvm_ir_macros.py \
	rasterizer/codegen/gen_llvm_types.py \
	rasterizer/codegen/gen_archrast.py \
	rasterizer/codegen/gen_backends.py \
	rasterizer/codegen/gen_common.py \
	rasterizer/codegen/gen_knobs.py \
	rasterizer/codegen/knob_defs.py \
	rasterizer/codegen/templates/gen_ar_event.cpp \
	rasterizer/codegen/templates/gen_ar_event.hpp \
	rasterizer/codegen/templates/gen_ar_eventhandler.hpp \
	rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp \
	rasterizer/codegen/templates/gen_backend.cpp \
	rasterizer/codegen/templates/gen_builder.hpp \
	rasterizer/codegen/templates/gen_header_init.hpp \
	rasterizer/codegen/templates/gen_knobs.cpp \
	rasterizer/codegen/templates/gen_knobs.h \
	rasterizer/codegen/templates/gen_llvm.hpp \
	rasterizer/codegen/templates/gen_rasterizer.cpp