1 /* 2 * Copyright 2022 Alyssa Rosenzweig 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #pragma once 7 8 #include <stdbool.h> 9 #include <stdint.h> 10 #include "util/format/u_formats.h" 11 #include "nir.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 #define AGX_MAX_ATTRIBS (16) 18 #define AGX_MAX_VBUFS (16) 19 20 /* See pipe_vertex_element for justification on the sizes. This structure should 21 * be small so it can be embedded into a shader key. 22 */ 23 struct agx_attribute { 24 /* If instanced, Zero means all get the same value (Vulkan semantics). */ 25 uint32_t divisor; 26 uint32_t stride; 27 uint16_t src_offset; 28 29 /* pipe_format, all vertex formats should be <= 255 */ 30 uint8_t format; 31 32 unsigned buf : 7; 33 bool instanced : 1; 34 }; 35 36 enum agx_robustness_level { 37 /* No robustness */ 38 AGX_ROBUSTNESS_DISABLED, 39 40 /* Invalid load/store must not fault, but undefined value/effect */ 41 AGX_ROBUSTNESS_GLES, 42 43 /* Invalid load/store access something from the array (or 0) */ 44 AGX_ROBUSTNESS_GL, 45 46 /* Invalid loads return 0 and invalid stores are dropped */ 47 AGX_ROBUSTNESS_D3D, 48 }; 49 50 struct agx_robustness { 51 enum agx_robustness_level level; 52 53 /* Whether hardware "soft fault" is enabled. */ 54 bool soft_fault; 55 }; 56 57 bool agx_nir_lower_vbo(nir_shader *shader, struct agx_attribute *attribs, 58 struct agx_robustness rs); 59 60 bool agx_vbo_supports_format(enum pipe_format format); 61 62 #ifdef __cplusplus 63 } /* extern C */ 64 #endif 65