Skip to content

Rename Feature/Limit to DeviceFeature/DeviceLimit #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 70 additions & 4 deletions gen/cheader.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# define WGPU_EXPORT
#endif // defined(WGPU_SHARED_LIBRARY)

#if !defined(WGPU_DISABLE_DEPRECATED_ALIASES)
#define WGPU_DISABLE_DEPRECATED_ALIASES 0
#endif

#if !defined(WGPU_OBJECT_ATTRIBUTE)
#define WGPU_OBJECT_ATTRIBUTE
#endif
Expand Down Expand Up @@ -81,7 +85,7 @@
*
* @{
*/

{{ if eq .Name "webgpu"}}
/**
* 'True' value of @ref WGPUBool.
*
Expand All @@ -96,13 +100,75 @@
* `stdbool.h` or C++) casts to the same value.
*/
#define WGPU_FALSE (UINT32_C(0))
{{- range .Constants}}
{{- MComment .Doc 0}}
{{- end }}
{{- range .Constants}}
{{- MComment .Doc 0}}
#define WGPU_{{ConstantCaseName .Base}} ({{.Value | CValue}})
{{- end}}
{{- end}}

/** @} */

{{ if eq .Name "webgpu" -}}
/**
* \defgroup Aliases Aliases
* \brief Deprecated aliases for other definitions.
*
* @{
*/
#if !WGPU_DISABLE_DEPRECATED_ALIASES

/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName WGPUDeviceFeatureName
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_DepthClipControl WGPUDeviceFeatureName_DepthClipControl
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_Depth32FloatStencil8 WGPUDeviceFeatureName_Depth32FloatStencil8
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_TimestampQuery WGPUDeviceFeatureName_TimestampQuery
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_TextureCompressionBC WGPUDeviceFeatureName_TextureCompressionBC
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_TextureCompressionBCSliced3D WGPUDeviceFeatureName_TextureCompressionBCSliced3D
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_TextureCompressionETC2 WGPUDeviceFeatureName_TextureCompressionETC2
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_TextureCompressionASTC WGPUDeviceFeatureName_TextureCompressionASTC
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_TextureCompressionASTCSliced3D WGPUDeviceFeatureName_TextureCompressionASTCSliced3D
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_IndirectFirstInstance WGPUDeviceFeatureName_IndirectFirstInstance
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_ShaderF16 WGPUDeviceFeatureName_ShaderF16
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_RG11B10UfloatRenderable WGPUDeviceFeatureName_RG11B10UfloatRenderable
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_BGRA8UnormStorage WGPUDeviceFeatureName_BGRA8UnormStorage
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_Float32Filterable WGPUDeviceFeatureName_Float32Filterable
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_Float32Blendable WGPUDeviceFeatureName_Float32Blendable
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_ClipDistances WGPUDeviceFeatureName_ClipDistances
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_DualSourceBlending WGPUDeviceFeatureName_DualSourceBlending
/** @deprecated alias for the new, more specific enum name. */
#define WGPUFeatureName_Subgroups WGPUDeviceFeatureName_Subgroups

/** @deprecated alias for the new, more specific struct name. */
#define WGPULimits WGPUDeviceLimits
/** @deprecated alias for the new, more specific struct init macro name. */
#define WGPU_LIMITS_INIT WGPU_DEVICE_LIMITS_INIT

/** @deprecated alias for the new, more specific struct name. */
#define WGPUSupportedFeatures WGPUSupportedDeviceFeatures
/** @deprecated alias for the new, more specific struct init macro name. */
#define WGPU_SUPPORTED_FEATURES_INIT WGPU_SUPPORTED_DEVICE_FEATURES_INIT

#endif // !WGPU_DISABLE_DEPRECATED_ALIASES
/** @} */

{{ end -}}

/**
* \defgroup UtilityTypes Utility Types
*
Expand Down
16 changes: 16 additions & 0 deletions tests/compile/main.inl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ int main(void) {
uint32_t x = a.maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED;
uint64_t y = a.maxBufferSize = WGPU_LIMIT_U64_UNDEFINED;
}
{
WGPUDeviceLimits a;
uint32_t x = a.maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED;
uint64_t y = a.maxBufferSize = WGPU_LIMIT_U64_UNDEFINED;
}
{
WGPUPassTimestampWrites a;
a.beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED;
Expand Down Expand Up @@ -75,6 +80,7 @@ int main(void) {
{ WGPURequestAdapterCallbackInfo x = WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT; }
{ WGPURequestDeviceCallbackInfo x = WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT; }
{ WGPUUncapturedErrorCallbackInfo x = WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT; }

{ WGPUAdapterInfo x = WGPU_ADAPTER_INFO_INIT; }
{ WGPUBindGroupEntry x = WGPU_BIND_GROUP_ENTRY_INIT; }
{ WGPUBlendComponent x = WGPU_BLEND_COMPONENT_INIT; }
Expand All @@ -85,6 +91,7 @@ int main(void) {
{ WGPUCommandEncoderDescriptor x = WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT; }
{ WGPUCompilationMessage x = WGPU_COMPILATION_MESSAGE_INIT; }
{ WGPUConstantEntry x = WGPU_CONSTANT_ENTRY_INIT; }
{ WGPUDeviceLimits x = WGPU_DEVICE_LIMITS_INIT; }
{ WGPUFuture x = WGPU_FUTURE_INIT; }
{ WGPUInstanceLimits x = WGPU_INSTANCE_LIMITS_INIT; }
{ WGPULimits x = WGPU_LIMITS_INIT; }
Expand All @@ -106,6 +113,7 @@ int main(void) {
{ WGPUShaderSourceWGSL x = WGPU_SHADER_SOURCE_WGSL_INIT; }
{ WGPUStencilFaceState x = WGPU_STENCIL_FACE_STATE_INIT; }
{ WGPUStorageTextureBindingLayout x = WGPU_STORAGE_TEXTURE_BINDING_LAYOUT_INIT; }
{ WGPUSupportedDeviceFeatures x = WGPU_SUPPORTED_DEVICE_FEATURES_INIT; }
{ WGPUSupportedFeatures x = WGPU_SUPPORTED_FEATURES_INIT; }
{ WGPUSupportedInstanceFeatures x = WGPU_SUPPORTED_INSTANCE_FEATURES_INIT; }
{ WGPUSupportedWGSLLanguageFeatures x = WGPU_SUPPORTED_WGSL_LANGUAGE_FEATURES_INIT; }
Expand Down Expand Up @@ -145,4 +153,12 @@ int main(void) {
{ WGPUVertexState x = WGPU_VERTEX_STATE_INIT; }
{ WGPUFragmentState x = WGPU_FRAGMENT_STATE_INIT; }
{ WGPURenderPipelineDescriptor x = WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT; }

// Tests for deprecations
{ WGPUFeatureName x = WGPUDeviceFeatureName_ShaderF16; }
{ WGPUDeviceFeatureName x = WGPUFeatureName_ShaderF16; }
{ WGPULimits x = WGPU_DEVICE_LIMITS_INIT; }
{ WGPUDeviceLimits x = WGPU_LIMITS_INIT; }
{ WGPUSupportedFeatures x = WGPU_SUPPORTED_DEVICE_FEATURES_INIT; }
{ WGPUSupportedDeviceFeatures x = WGPU_SUPPORTED_FEATURES_INIT; }
}
14 changes: 0 additions & 14 deletions tests/extensions/webgpu_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@
* @{
*/

/**
* 'True' value of @ref WGPUBool.
*
* @remark It's not usually necessary to use this, as `true` (from
* `stdbool.h` or C++) casts to the same value.
*/
#define WGPU_TRUE (UINT32_C(1))
/**
* 'False' value of @ref WGPUBool.
*
* @remark It's not usually necessary to use this, as `false` (from
* `stdbool.h` or C++) casts to the same value.
*/
#define WGPU_FALSE (UINT32_C(0))
/**
* New constant should have the namespace prefix in the name by default.
*/
Expand Down
Loading