• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2015 Intel Corporation.   All Rights Reserved.
2#
3# Permission is hereby granted, free of charge, to any person obtaining a
4# copy of this software and associated documentation files (the "Software"),
5# to deal in the Software without restriction, including without limitation
6# the rights to use, copy, modify, merge, publish, distribute, sublicense,
7# and/or sell copies of the Software, and to permit persons to whom the
8# Software is furnished to do so, subject to the following conditions:
9#
10# The above copyright notice and this permission notice (including the next
11# paragraph) shall be included in all copies or substantial portions of the
12# Software.
13#
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20# IN THE SOFTWARE.
21
22include Makefile.sources
23include $(top_srcdir)/src/gallium/Automake.inc
24
25AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) $(CXX11_CXXFLAGS)
26
27noinst_LTLIBRARIES = libmesaswr.la
28
29libmesaswr_la_SOURCES = \
30	$(CXX_SOURCES) \
31	$(JITTER_CXX_SOURCES) \
32	$(LOADER_SOURCES)
33
34COMMON_CXXFLAGS = \
35	-fno-strict-aliasing \
36	$(GALLIUM_DRIVER_CFLAGS) \
37	$(LLVM_CXXFLAGS) \
38	$(CXX11_CXXFLAGS) \
39	-I$(builddir)/rasterizer/codegen \
40	-I$(builddir)/rasterizer/core \
41	-I$(builddir)/rasterizer/jitter \
42	-I$(builddir)/rasterizer/archrast \
43	-I$(srcdir)/rasterizer \
44	-I$(srcdir)/rasterizer/core \
45	-I$(srcdir)/rasterizer/codegen \
46	-I$(srcdir)/rasterizer/jitter \
47	-I$(srcdir)/rasterizer/archrast
48
49# SWR_AVX_CXXFLAGS needed for intrinsic usage in swr api headers
50libmesaswr_la_CXXFLAGS = \
51	$(SWR_AVX_CXXFLAGS) \
52	$(COMMON_CXXFLAGS)
53
54if HAVE_SWR_AVX
55libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX
56endif
57
58if HAVE_SWR_AVX2
59libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX2
60endif
61
62if HAVE_SWR_KNL
63libmesaswr_la_CXXFLAGS += -DHAVE_SWR_KNL
64endif
65
66if HAVE_SWR_SKX
67libmesaswr_la_CXXFLAGS += -DHAVE_SWR_SKX
68endif
69
70COMMON_SOURCES = \
71	$(ARCHRAST_CXX_SOURCES) \
72	$(COMMON_CXX_SOURCES) \
73	$(CORE_CXX_SOURCES) \
74	$(MEMORY_CXX_SOURCES) \
75	$(BUILT_SOURCES)
76
77BUILT_SOURCES = \
78	gen_swr_context_llvm.h \
79	rasterizer/codegen/gen_knobs.cpp \
80	rasterizer/codegen/gen_knobs.h \
81	rasterizer/jitter/gen_state_llvm.h \
82	rasterizer/jitter/gen_builder.hpp \
83	rasterizer/jitter/gen_builder_x86.hpp \
84	rasterizer/archrast/gen_ar_event.hpp \
85	rasterizer/archrast/gen_ar_event.cpp \
86	rasterizer/archrast/gen_ar_eventhandler.hpp \
87	rasterizer/archrast/gen_ar_eventhandlerfile.hpp \
88	rasterizer/core/backends/gen_BackendPixelRate0.cpp \
89	rasterizer/core/backends/gen_BackendPixelRate1.cpp \
90	rasterizer/core/backends/gen_BackendPixelRate2.cpp \
91	rasterizer/core/backends/gen_BackendPixelRate3.cpp \
92	rasterizer/core/backends/gen_BackendPixelRate.hpp \
93	rasterizer/core/backends/gen_rasterizer0.cpp \
94	rasterizer/core/backends/gen_rasterizer1.cpp \
95	rasterizer/core/backends/gen_rasterizer2.cpp \
96	rasterizer/core/backends/gen_rasterizer3.cpp \
97	rasterizer/core/backends/gen_rasterizer.hpp
98
99MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
100PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
101gen_swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp swr_context.h
102	$(PYTHON_GEN) \
103		$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
104		--input $(srcdir)/swr_context.h \
105		--output ./gen_swr_context_llvm.h
106
107rasterizer/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
108	$(MKDIR_GEN)
109	$(PYTHON_GEN) \
110		$(srcdir)/rasterizer/codegen/gen_knobs.py \
111		--output rasterizer/codegen/gen_knobs.cpp \
112		--gen_cpp
113
114rasterizer/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
115	$(MKDIR_GEN)
116	$(PYTHON_GEN) \
117		$(srcdir)/rasterizer/codegen/gen_knobs.py \
118		--output rasterizer/codegen/gen_knobs.h \
119		--gen_h
120
121rasterizer/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
122	$(MKDIR_GEN)
123	$(PYTHON_GEN) \
124		$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
125		--input $(srcdir)/rasterizer/core/state.h \
126		--output rasterizer/jitter/gen_state_llvm.h
127
128rasterizer/jitter/gen_builder.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp rasterizer/codegen/gen_common.py
129	$(MKDIR_GEN)
130	$(PYTHON_GEN) \
131		$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
132		--input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
133		--output rasterizer/jitter \
134		--gen_h
135
136rasterizer/jitter/gen_builder_x86.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp rasterizer/codegen/gen_common.py
137	$(MKDIR_GEN)
138	$(PYTHON_GEN) \
139		$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
140		--output rasterizer/jitter \
141		--gen_x86_h
142
143rasterizer/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
144	$(MKDIR_GEN)
145	$(PYTHON_GEN) \
146		$(srcdir)/rasterizer/codegen/gen_archrast.py \
147		--proto $(srcdir)/rasterizer/archrast/events.proto \
148		--output rasterizer/archrast/gen_ar_event.hpp \
149		--gen_event_h
150
151rasterizer/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
152	$(MKDIR_GEN)
153	$(PYTHON_GEN) \
154		$(srcdir)/rasterizer/codegen/gen_archrast.py \
155		--proto $(srcdir)/rasterizer/archrast/events.proto \
156		--output rasterizer/archrast/gen_ar_event.cpp \
157		--gen_event_cpp
158
159rasterizer/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
160	$(MKDIR_GEN)
161	$(PYTHON_GEN) \
162		$(srcdir)/rasterizer/codegen/gen_archrast.py \
163		--proto $(srcdir)/rasterizer/archrast/events.proto \
164		--output rasterizer/archrast/gen_ar_eventhandler.hpp \
165		--gen_eventhandler_h
166
167rasterizer/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
168	$(MKDIR_GEN)
169	$(PYTHON_GEN) \
170		$(srcdir)/rasterizer/codegen/gen_archrast.py \
171		--proto $(srcdir)/rasterizer/archrast/events.proto \
172		--output rasterizer/archrast/gen_ar_eventhandlerfile.hpp \
173		--gen_eventhandlerfile_h
174
175rasterizer/core/backends/gen_BackendPixelRate0.cpp \
176rasterizer/core/backends/gen_BackendPixelRate1.cpp \
177rasterizer/core/backends/gen_BackendPixelRate2.cpp \
178rasterizer/core/backends/gen_BackendPixelRate3.cpp \
179rasterizer/core/backends/gen_BackendPixelRate.hpp: \
180backend.intermediate
181
182# 5 SWR_MULTISAMPLE_TYPE_COUNT
183# 2 SWR_MSAA_SAMPLE_PATTERN_COUNT
184# 3 SWR_INPUT_COVERAGE_COUNT
185# 2 centroid
186# 2 forcedSampleCount
187# 2 canEarlyZ
188
189# use intermediate rule to tell make that all files can be
190# generated in one invocation of gen_backends.py (prevents
191# parallel make race condition)
192.INTERMEDIATE: backend.intermediate
193backend.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/gen_backend.cpp rasterizer/codegen/templates/gen_header_init.hpp
194	$(MKDIR_GEN)
195	$(PYTHON_GEN) \
196		$(srcdir)/rasterizer/codegen/gen_backends.py \
197		--outdir rasterizer/core/backends \
198		--dim 5 2 3 2 2 2 \
199		--numfiles 4 \
200		--cpp \
201		--hpp
202
203rasterizer/core/backends/gen_rasterizer0.cpp \
204rasterizer/core/backends/gen_rasterizer1.cpp \
205rasterizer/core/backends/gen_rasterizer2.cpp \
206rasterizer/core/backends/gen_rasterizer3.cpp \
207rasterizer/core/backends/gen_rasterizer.hpp: \
208rasterizer.intermediate
209
210# 5 SWR_MULTISAMPLE_TYPE_COUNT
211# 2 CenterPattern
212# 2 Conservative
213# 3 SWR_INPUT_COVERAGE_COUNT
214# 5 STATE_VALID_TRI_EDGE_COUNT
215# 2 RasterScissorEdges
216
217# use intermediate rule to tell make that all files can be
218# generated in one invocation of gen_backends.py (prevents
219# parallel make race condition)
220.INTERMEDIATE: rasterizer.intermediate
221rasterizer.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/gen_rasterizer.cpp rasterizer/codegen/templates/gen_header_init.hpp
222	$(MKDIR_GEN)
223	$(PYTHON_GEN) \
224		$(srcdir)/rasterizer/codegen/gen_backends.py \
225		--outdir rasterizer/core/backends \
226		--rast \
227		--dim 5 2 2 3 5 2 \
228		--numfiles 4 \
229		--cpp \
230		--hpp
231
232COMMON_LDFLAGS = \
233	-shared \
234	-module \
235	-no-undefined \
236	$(GC_SECTIONS) \
237	$(LD_NO_UNDEFINED)
238
239lib_LTLIBRARIES =
240
241if HAVE_SWR_AVX
242libswrAVX_la_CXXFLAGS = \
243	$(PTHREAD_CFLAGS) \
244	$(SWR_AVX_CXXFLAGS) \
245	-DKNOB_ARCH=KNOB_ARCH_AVX \
246	$(COMMON_CXXFLAGS)
247
248libswrAVX_la_SOURCES = \
249	$(COMMON_SOURCES)
250
251libswrAVX_la_LIBADD = \
252	$(PTHREAD_LIBS)
253
254libswrAVX_la_LDFLAGS = \
255	$(COMMON_LDFLAGS)
256endif
257
258if HAVE_SWR_AVX2
259libswrAVX2_la_CXXFLAGS = \
260	$(PTHREAD_CFLAGS) \
261	$(SWR_AVX2_CXXFLAGS) \
262	-DKNOB_ARCH=KNOB_ARCH_AVX2 \
263	$(COMMON_CXXFLAGS)
264
265libswrAVX2_la_SOURCES = \
266	$(COMMON_SOURCES)
267
268libswrAVX2_la_LIBADD = \
269	$(PTHREAD_LIBS)
270
271libswrAVX2_la_LDFLAGS = \
272	$(COMMON_LDFLAGS)
273endif
274
275if HAVE_SWR_KNL
276libswrKNL_la_CXXFLAGS = \
277	$(PTHREAD_CFLAGS) \
278	$(SWR_KNL_CXXFLAGS) \
279	-DKNOB_ARCH=KNOB_ARCH_AVX512 -DSIMD_ARCH_KNIGHTS \
280	$(COMMON_CXXFLAGS)
281
282libswrKNL_la_SOURCES = \
283	$(COMMON_SOURCES)
284
285libswrKNL_la_LIBADD = \
286	$(PTHREAD_LIBS)
287
288libswrKNL_la_LDFLAGS = \
289	$(COMMON_LDFLAGS)
290endif
291
292if HAVE_SWR_SKX
293libswrSKX_la_CXXFLAGS = \
294	$(PTHREAD_CFLAGS) \
295	$(SWR_SKX_CXXFLAGS) \
296	-DKNOB_ARCH=KNOB_ARCH_AVX512 \
297	$(COMMON_CXXFLAGS)
298
299libswrSKX_la_SOURCES = \
300	$(COMMON_SOURCES)
301
302libswrSKX_la_LIBADD = \
303	$(PTHREAD_LIBS)
304
305libswrSKX_la_LDFLAGS = \
306	$(COMMON_LDFLAGS)
307endif
308
309if HAVE_SWR_BUILTIN
310libmesaswr_la_CXXFLAGS += -DHAVE_SWR_BUILTIN
311libmesaswr_la_LIBADD =
312if HAVE_SWR_AVX
313noinst_LTLIBRARIES += libswrAVX.la
314libmesaswr_la_LIBADD += libswrAVX.la
315endif
316if HAVE_SWR_AVX2
317noinst_LTLIBRARIES += libswrAVX2.la
318libmesaswr_la_LIBADD += libswrAVX2.la
319endif
320if HAVE_SWR_KNL
321noinst_LTLIBRARIES += libswrKNL.la
322libmesaswr_la_LIBADD += libswrKNL.la
323endif
324if HAVE_SWR_SKX
325noinst_LTLIBRARIES += libswrSKX.la
326libmesaswr_la_LIBADD += libswrSKX.la
327endif
328else # !HAVE_SWR_BUILTIN
329# gen_knobs.* included here to provide driver access to swr configuration
330libmesaswr_la_SOURCES += \
331       $(COMMON_CXX_SOURCES) \
332       rasterizer/codegen/gen_knobs.cpp \
333       rasterizer/codegen/gen_knobs.h
334if HAVE_SWR_AVX
335lib_LTLIBRARIES += libswrAVX.la
336endif
337if HAVE_SWR_AVX2
338lib_LTLIBRARIES += libswrAVX2.la
339endif
340if HAVE_SWR_KNL
341lib_LTLIBRARIES += libswrKNL.la
342endif
343if HAVE_SWR_SKX
344lib_LTLIBRARIES += libswrSKX.la
345endif
346endif
347
348include $(top_srcdir)/install-gallium-links.mk
349
350# Generated gen_builder.hpp is not backwards compatible. So ship only one
351# created with the oldest supported version of LLVM.
352dist-hook:
353if SWR_INVALID_LLVM_VERSION
354	@echo "*******************************************************"
355	@echo "LLVM 3.9.0 or LLVM 3.9.1 required to create the tarball"
356	@echo "*******************************************************"
357	@test
358endif
359
360EXTRA_DIST = \
361	SConscript \
362	meson.build \
363	rasterizer/jitter/meson.build \
364	rasterizer/codegen/meson.build \
365	rasterizer/core/backends/meson.build \
366	rasterizer/archrast/events.proto \
367	rasterizer/codegen/gen_llvm_ir_macros.py \
368	rasterizer/codegen/gen_llvm_types.py \
369	rasterizer/codegen/gen_archrast.py \
370	rasterizer/codegen/gen_backends.py \
371	rasterizer/codegen/gen_common.py \
372	rasterizer/codegen/gen_knobs.py \
373	rasterizer/codegen/knob_defs.py \
374	rasterizer/codegen/templates/gen_ar_event.cpp \
375	rasterizer/codegen/templates/gen_ar_event.hpp \
376	rasterizer/codegen/templates/gen_ar_eventhandler.hpp \
377	rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp \
378	rasterizer/codegen/templates/gen_backend.cpp \
379	rasterizer/codegen/templates/gen_builder.hpp \
380	rasterizer/codegen/templates/gen_header_init.hpp \
381	rasterizer/codegen/templates/gen_knobs.cpp \
382	rasterizer/codegen/templates/gen_knobs.h \
383	rasterizer/codegen/templates/gen_llvm.hpp \
384	rasterizer/codegen/templates/gen_rasterizer.cpp
385