/* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package { // See: http://go/android-license-faq default_applicable_licenses: ["external_mesa3d_license"], } filegroup { name: "mesa_spirv_grammar", srcs: ["spirv.core.grammar.json"], } filegroup { name: "mesa_spirv_xml", srcs: ["spir-v.xml"], } python_binary_host { name: "vtn_gather_types_gen", main: "vtn_gather_types_c.py", srcs: ["vtn_gather_types_c.py"], libs: [ "mako", ], } python_binary_host { name: "spirv_info_gen", main: "spirv_info_gen.py", srcs: ["spirv_info_gen.py"], libs: [ "mako", ], } python_binary_host { name: "vtn_generator_ids_gen", main: "vtn_generator_ids_h.py", srcs: ["vtn_generator_ids_h.py"], libs: [ "mako", ], } genrule { name: "vtn_gather_types_impl", srcs: [":mesa_spirv_grammar"], out: ["vtn_gather_types.c"], tools: ["vtn_gather_types_gen"], cmd: "python3 $(location vtn_gather_types_gen) " + "$(location :mesa_spirv_grammar) " + "$(location vtn_gather_types.c)", } genrule { name: "spirv_info_header", srcs: [":mesa_spirv_grammar"], out: ["src/compiler/spirv/spirv_info.h"], tools: ["spirv_info_gen"], export_include_dirs: [ "src/compiler/spirv", "src/", ], cmd: "python3 $(location spirv_info_gen) " + "--json $(location :mesa_spirv_grammar) " + "--out-h $(location src/compiler/spirv/spirv_info.h) " + "--out-c $(genDir)/placeholder.c", } genrule { name: "spirv_info_impl", srcs: [":mesa_spirv_grammar"], out: ["spirv_info.c"], tools: ["spirv_info_gen"], cmd: "python3 $(location spirv_info_gen) " + "--json $(location :mesa_spirv_grammar) " + "--out-h $(genDir)/placeholder.h " + "--out-c $(location spirv_info.c)", } genrule { name: "vtn_generator_ids_header", srcs: [":mesa_spirv_xml"], out: ["vtn_generator_ids.h"], tools: ["vtn_generator_ids_gen"], cmd: "python3 $(location vtn_generator_ids_gen) " + "$(location :mesa_spirv_xml) " + "$(location vtn_generator_ids.h)", } cc_library_static { name: "mesa_spirv", vendor: true, host_supported: true, defaults: [ "mesa_common_defaults", ], generated_headers: [ "vtn_generator_ids_header", "nir_builder_opcodes_header", "nir_opcodes_header", "nir_intrinsics_header", "nir_intrinsics_indices_header", "spirv_info_header", "u_format_gen_header", "builtin_types_header", ], header_libs: [ "mesa_gallium_auxiliary_headers", "mesa_gallium_headers", "mesa_src_headers", "mesa_compiler_headers", "mesa_nir_headers", "mesa_common_headers", ], generated_sources: [ "spirv_info_impl", "vtn_gather_types_impl", ], srcs: [ "spirv_to_nir.c", "vtn_alu.c", "vtn_amd.c", "vtn_cfg.c", "vtn_glsl450.c", "vtn_opencl.c", "vtn_subgroup.c", "vtn_variables.c", ], }