1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can 5 * be found in the LICENSE file. 6 * 7 */ 8 9 #pragma once 10 11 // 12 // 13 // 14 15 #include <stdint.h> 16 17 #include "common/macros.h" 18 19 // 20 // This structure packages all of the parameters and SPIR-V kernels 21 // for a target architecture. 22 // 23 24 struct hs_vk_target_config 25 { 26 struct { 27 uint8_t threads_log2; 28 uint8_t width_log2; 29 uint8_t height; 30 } slab; 31 32 struct { 33 uint8_t key; 34 uint8_t val; 35 } words; 36 37 struct { 38 uint8_t slabs; 39 } block; 40 41 struct { 42 struct { 43 uint8_t scale_min; 44 uint8_t scale_max; 45 } fm; 46 struct { 47 uint8_t scale_min; 48 uint8_t scale_max; 49 } hm; 50 } merge; 51 52 uint8_t pad[2]; 53 }; 54 55 STATIC_ASSERT_MACRO(sizeof(struct hs_vk_target_config) == 12, 56 "modules.bytes[] must start on a 32-bit boundary"); 57 58 // 59 // For now, kernels are appended end-to-end with a leading big-endian 60 // length followed by a SPIR-V binary. 61 // 62 // The entry point for each kernel is "main". 63 // 64 // When the tools support packaging multiple named compute shaders in 65 // one SPIR-V module then reevaluate this encoding. 66 // 67 68 struct hs_vk_target 69 { 70 struct hs_vk_target_config config; 71 uint8_t modules[]; 72 }; 73 74 // 75 // 76 // 77