Add ability to generate constants from dawn.json
The "constant" category has two keys:
- `"type"`: a string, the name of the base data type
- `"value"`: a string, the value is defined with preprocessor macro
Remove deprecated constant InputStepMode.
BUG=dawn:1201, dawn:1023
Change-Id: If4308bd5b25dddd9453514ce362bebe4fd771a57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70704
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
diff --git a/generator/templates/api.h b/generator/templates/api.h
index f03dbae..48e629c 100644
--- a/generator/templates/api.h
+++ b/generator/templates/api.h
@@ -75,17 +75,9 @@
#include <stddef.h>
#include <stdbool.h>
-#define WGPU_WHOLE_SIZE (0xffffffffffffffffULL)
-#define WGPU_WHOLE_MAP_SIZE SIZE_MAX
-{% if 'deprecated' in enabled_tags %}
- // TODO(crbug.com/dawn/520): Remove WGPU_STRIDE_UNDEFINED in favor of WGPU_COPY_STRIDE_UNDEFINED.
- #define WGPU_STRIDE_UNDEFINED (0xffffffffUL)
-{% endif %}
-#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL)
-#define WGPU_LIMIT_U32_UNDEFINED (0xffffffffUL)
-#define WGPU_LIMIT_U64_UNDEFINED (0xffffffffffffffffULL)
-#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED (0xffffffffUL)
-#define WGPU_MIP_LEVEL_COUNT_UNDEFINED (0xffffffffUL)
+{% for constant in by_category["constant"] %}
+ #define {{c_prefix}}_{{constant.name.SNAKE_CASE()}} {{constant.value}}
+{% endfor %}
typedef uint32_t {{c_prefix}}Flags;
@@ -138,13 +130,6 @@
typedef {{as_cType(typeDef.type.name)}} {{as_cType(typeDef.name)}};
{% endfor %}
-{% if 'deprecated' in enabled_tags %}
- // TODO(crbug.com/dawn/1023): Remove after the deprecation period.
- #define WGPUInputStepMode_Vertex WGPUVertexStepMode_Vertex
- #define WGPUInputStepMode_Instance WGPUVertexStepMode_Instance
- #define WGPUInputStepMode_Force32 WGPUVertexStepMode_Force32
-
-{% endif %}
#ifdef __cplusplus
extern "C" {
#endif