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 22 include Makefile.sources 23 include $(top_srcdir)/src/gallium/Automake.inc 24 25 AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) $(CXX11_CXXFLAGS) 26 27 noinst_LTLIBRARIES = libmesaswr.la 28 29 libmesaswr_la_SOURCES = \ 30 $(CXX_SOURCES) \ 31 $(JITTER_CXX_SOURCES) \ 32 $(LOADER_SOURCES) 33 34 COMMON_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 50 libmesaswr_la_CXXFLAGS = \ 51 $(SWR_AVX_CXXFLAGS) \ 52 $(COMMON_CXXFLAGS) 53 54 if HAVE_SWR_AVX 55 libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX 56 endif 57 58 if HAVE_SWR_AVX2 59 libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX2 60 endif 61 62 if HAVE_SWR_KNL 63 libmesaswr_la_CXXFLAGS += -DHAVE_SWR_KNL 64 endif 65 66 if HAVE_SWR_SKX 67 libmesaswr_la_CXXFLAGS += -DHAVE_SWR_SKX 68 endif 69 70 COMMON_SOURCES = \ 71 $(ARCHRAST_CXX_SOURCES) \ 72 $(COMMON_CXX_SOURCES) \ 73 $(CORE_CXX_SOURCES) \ 74 $(MEMORY_CXX_SOURCES) \ 75 $(BUILT_SOURCES) 76 77 BUILT_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 99 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D) 100 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) 101 gen_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 107 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 108 $(MKDIR_GEN) 109 $(PYTHON_GEN) \ 110 $(srcdir)/rasterizer/codegen/gen_knobs.py \ 111 --output rasterizer/codegen/gen_knobs.cpp \ 112 --gen_cpp 113 114 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 115 $(MKDIR_GEN) 116 $(PYTHON_GEN) \ 117 $(srcdir)/rasterizer/codegen/gen_knobs.py \ 118 --output rasterizer/codegen/gen_knobs.h \ 119 --gen_h 120 121 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 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 128 rasterizer/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 136 rasterizer/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 143 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 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 151 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 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 159 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 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 167 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 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 175 rasterizer/core/backends/gen_BackendPixelRate0.cpp \ 176 rasterizer/core/backends/gen_BackendPixelRate1.cpp \ 177 rasterizer/core/backends/gen_BackendPixelRate2.cpp \ 178 rasterizer/core/backends/gen_BackendPixelRate3.cpp \ 179 rasterizer/core/backends/gen_BackendPixelRate.hpp: \ 180 backend.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 193 backend.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 203 rasterizer/core/backends/gen_rasterizer0.cpp \ 204 rasterizer/core/backends/gen_rasterizer1.cpp \ 205 rasterizer/core/backends/gen_rasterizer2.cpp \ 206 rasterizer/core/backends/gen_rasterizer3.cpp \ 207 rasterizer/core/backends/gen_rasterizer.hpp: \ 208 rasterizer.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 221 rasterizer.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 232 COMMON_LDFLAGS = \ 233 -shared \ 234 -module \ 235 -no-undefined \ 236 $(GC_SECTIONS) \ 237 $(LD_NO_UNDEFINED) 238 239 lib_LTLIBRARIES = 240 241 if HAVE_SWR_AVX 242 libswrAVX_la_CXXFLAGS = \ 243 $(PTHREAD_CFLAGS) \ 244 $(SWR_AVX_CXXFLAGS) \ 245 -DKNOB_ARCH=KNOB_ARCH_AVX \ 246 $(COMMON_CXXFLAGS) 247 248 libswrAVX_la_SOURCES = \ 249 $(COMMON_SOURCES) 250 251 libswrAVX_la_LIBADD = \ 252 $(PTHREAD_LIBS) 253 254 libswrAVX_la_LDFLAGS = \ 255 $(COMMON_LDFLAGS) 256 endif 257 258 if HAVE_SWR_AVX2 259 libswrAVX2_la_CXXFLAGS = \ 260 $(PTHREAD_CFLAGS) \ 261 $(SWR_AVX2_CXXFLAGS) \ 262 -DKNOB_ARCH=KNOB_ARCH_AVX2 \ 263 $(COMMON_CXXFLAGS) 264 265 libswrAVX2_la_SOURCES = \ 266 $(COMMON_SOURCES) 267 268 libswrAVX2_la_LIBADD = \ 269 $(PTHREAD_LIBS) 270 271 libswrAVX2_la_LDFLAGS = \ 272 $(COMMON_LDFLAGS) 273 endif 274 275 if HAVE_SWR_KNL 276 libswrKNL_la_CXXFLAGS = \ 277 $(PTHREAD_CFLAGS) \ 278 $(SWR_KNL_CXXFLAGS) \ 279 -DKNOB_ARCH=KNOB_ARCH_AVX512 -DSIMD_ARCH_KNIGHTS \ 280 $(COMMON_CXXFLAGS) 281 282 libswrKNL_la_SOURCES = \ 283 $(COMMON_SOURCES) 284 285 libswrKNL_la_LIBADD = \ 286 $(PTHREAD_LIBS) 287 288 libswrKNL_la_LDFLAGS = \ 289 $(COMMON_LDFLAGS) 290 endif 291 292 if HAVE_SWR_SKX 293 libswrSKX_la_CXXFLAGS = \ 294 $(PTHREAD_CFLAGS) \ 295 $(SWR_SKX_CXXFLAGS) \ 296 -DKNOB_ARCH=KNOB_ARCH_AVX512 \ 297 $(COMMON_CXXFLAGS) 298 299 libswrSKX_la_SOURCES = \ 300 $(COMMON_SOURCES) 301 302 libswrSKX_la_LIBADD = \ 303 $(PTHREAD_LIBS) 304 305 libswrSKX_la_LDFLAGS = \ 306 $(COMMON_LDFLAGS) 307 endif 308 309 if HAVE_SWR_BUILTIN 310 libmesaswr_la_CXXFLAGS += -DHAVE_SWR_BUILTIN 311 libmesaswr_la_LIBADD = 312 if HAVE_SWR_AVX 313 noinst_LTLIBRARIES += libswrAVX.la 314 libmesaswr_la_LIBADD += libswrAVX.la 315 endif 316 if HAVE_SWR_AVX2 317 noinst_LTLIBRARIES += libswrAVX2.la 318 libmesaswr_la_LIBADD += libswrAVX2.la 319 endif 320 if HAVE_SWR_KNL 321 noinst_LTLIBRARIES += libswrKNL.la 322 libmesaswr_la_LIBADD += libswrKNL.la 323 endif 324 if HAVE_SWR_SKX 325 noinst_LTLIBRARIES += libswrSKX.la 326 libmesaswr_la_LIBADD += libswrSKX.la 327 endif 328 else # !HAVE_SWR_BUILTIN 329 # gen_knobs.* included here to provide driver access to swr configuration 330 libmesaswr_la_SOURCES += \ 331 $(COMMON_CXX_SOURCES) \ 332 rasterizer/codegen/gen_knobs.cpp \ 333 rasterizer/codegen/gen_knobs.h 334 if HAVE_SWR_AVX 335 lib_LTLIBRARIES += libswrAVX.la 336 endif 337 if HAVE_SWR_AVX2 338 lib_LTLIBRARIES += libswrAVX2.la 339 endif 340 if HAVE_SWR_KNL 341 lib_LTLIBRARIES += libswrKNL.la 342 endif 343 if HAVE_SWR_SKX 344 lib_LTLIBRARIES += libswrSKX.la 345 endif 346 endif 347 348 include $(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. 352 dist-hook: 353 if 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 358 endif 359 360 EXTRA_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