From 8f5338b1d1cabb8ebce2465e6bde1e662edb8de6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 29 Apr 2019 13:47:15 +0200 Subject: [PATCH] [spirv] Add constvec2f32 helper We should probably replace this with a proper template at some point. --- src/spirv/spirv_module.cpp | 14 ++++++++++++++ src/spirv/spirv_module.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/spirv/spirv_module.cpp b/src/spirv/spirv_module.cpp index 48179271b..c8acddc0f 100644 --- a/src/spirv/spirv_module.cpp +++ b/src/spirv/spirv_module.cpp @@ -297,6 +297,20 @@ namespace dxvk { } + uint32_t SpirvModule::constvec2f32( + float x, + float y) { + std::array args = {{ + this->constf32(x), this->constf32(y), + }}; + + uint32_t scalarTypeId = this->defFloatType(32); + uint32_t vectorTypeId = this->defVectorType(scalarTypeId, 2); + + return this->constComposite(vectorTypeId, args.size(), args.data()); + } + + uint32_t SpirvModule::constvec3f32( float x, float y, diff --git a/src/spirv/spirv_module.h b/src/spirv/spirv_module.h index a72a772e7..fe049c67a 100644 --- a/src/spirv/spirv_module.h +++ b/src/spirv/spirv_module.h @@ -144,6 +144,10 @@ namespace dxvk { uint32_t z, uint32_t w); + uint32_t constvec2f32( + float x, + float y); + uint32_t constvec3f32( float x, float y,