From ce4668a7ac6a2cd43e0081166f6d0b7c4b7c2cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6kull=20M=C3=A1ni=20Reynisson?= Date: Wed, 24 Feb 2021 21:37:05 +0000 Subject: [PATCH] const in ShaderStage that represents vertex and fragment access (#1229) * const in ShaderStage that represents vertex and fragment access We can store `ShaderStage`s as const values or members of const structs in all individual cases, but for example `ShaderStage::VERTEX | ShaderStage::FRAGMENT` cannot be stored in a const. This is not very elegant, but would be convenient. * Correct VERTEX_FRAGMENT definition VERTEX_FRAGMENT definition now follows directly from the bit representation of `ShaderStage::VERTEX` and `Shaderstage::FRAGMENT` such that it does not need to be independently maintained. --- wgpu-types/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 294b2bbc6..beeab5a95 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -566,6 +566,8 @@ bitflags::bitflags! { const VERTEX = 1; /// Binding is visible from the fragment shader of a render pipeline. const FRAGMENT = 2; + /// Binding is visible from the vertex and fragment shaders of a render pipeline. + const VERTEX_FRAGMENT = Self::VERTEX.bits | Self::FRAGMENT.bits; /// Binding is visible from the compute shader of a compute pipeline. const COMPUTE = 4; }