From dc0725e1048056ac5acaef4a44865cc9e384d614 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 23 Dec 2023 14:27:43 +0000 Subject: [PATCH] Avoid a wgpu SPIR-V warning about BitFieldUExtract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit premultiply-alpha-vert.glsl contains a function unpack() which, without this change, causes the following warnings: WARN wgpu_core::device: Failed to parse shader SPIR-V code for Some("premultiply-alpha-vert.glsl …"): UnsupportedInstruction(Function, BitFieldUExtract) WARN wgpu_core::device: Proceeding unsafely without validation This avoids that warning (and removes now-unnecessary type conversions). --- assets/voxygen/shaders/premultiply-alpha-vert.glsl | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/assets/voxygen/shaders/premultiply-alpha-vert.glsl b/assets/voxygen/shaders/premultiply-alpha-vert.glsl index 646582ee3f..e8737f9e9b 100644 --- a/assets/voxygen/shaders/premultiply-alpha-vert.glsl +++ b/assets/voxygen/shaders/premultiply-alpha-vert.glsl @@ -13,17 +13,14 @@ layout(push_constant) uniform Params { layout(location = 0) out vec2 source_coords; -uvec2 unpack(uint xy) { - return uvec2( - bitfieldExtract(xy, 0, 16), - bitfieldExtract(xy, 16, 16) - ); +vec2 unpack(uint xy) { + return vec2(xy & 0xFFFF, (xy >> 16) & 0xFFFF); } void main() { - vec2 source_size = vec2(unpack(source_size_xy)); - vec2 target_offset = vec2(unpack(target_offset_xy)); - vec2 target_size = vec2(unpack(target_size_xy)); + vec2 source_size = unpack(source_size_xy); + vec2 target_offset = unpack(target_offset_xy); + vec2 target_size = unpack(target_size_xy); // Generate rectangle (counter clockwise triangles) //