From 5b73214223d6fe6e92cd6fb815d06833f86449c5 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 27 Aug 2015 14:20:19 -0400 Subject: [PATCH] Add GLSL std450 extended instruction 72-80. --- source/ext_inst.cpp | 14 +++++++++++++- test/ExtInstGLSLstd450.cpp | 13 +++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/source/ext_inst.cpp b/source/ext_inst.cpp index 717b3b0..ca2a197 100644 --- a/source/ext_inst.cpp +++ b/source/ext_inst.cpp @@ -93,7 +93,19 @@ static const spv_ext_inst_desc_t glslStd450Entries[] = { // clang-format on {GLSL450Inst2(Reflect)}, {GLSL450Inst3(Refract)}, - // TODO: Add remaining GLSL.std.450 instructions + // clang-format off + {"FindILsb", GLSLstd450::GLSLstd450FindILSB, {SPV_OPERAND_TYPE_ID}}, + {"FindSMsb", GLSLstd450::GLSLstd450FindSMSB, {SPV_OPERAND_TYPE_ID}}, + {"FindUMsb", GLSLstd450::GLSLstd450FindUMSB, {SPV_OPERAND_TYPE_ID}}, + // clang-format on + {GLSL450Inst1(InterpolateAtCentroid)}, + {GLSL450Inst2(InterpolateAtSample)}, + {GLSL450Inst2(InterpolateAtOffset)}, + // clang-format off + {"UaddCarry", GLSLstd450::GLSLstd450AddCarry, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}}, + {"UsubBorrow", GLSLstd450::GLSLstd450SubBorrow, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}}, + {"UmulExtended", GLSLstd450::GLSLstd450MulExtended, { SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}}, + // clang-format on }; static const spv_ext_inst_desc_t openclStd12Entries[] = { diff --git a/test/ExtInstGLSLstd450.cpp b/test/ExtInstGLSLstd450.cpp index 574ff6c..31cb4f6 100644 --- a/test/ExtInstGLSLstd450.cpp +++ b/test/ExtInstGLSLstd450.cpp @@ -208,4 +208,17 @@ INSTANTIATE_TEST_CASE_P( // clang-format on {kF32Type, kF32Const, "%4", "Reflect", "%5 %5", 70, 7, {5, 5}}, {kF32Type, kF32Const, "%4", "Refract", "%5 %5 %5", 71, 8, {5, 5, 5}}, + {kS32Type, kI32Const, "%4", "FindILsb", "%5", 72, 6, {5}}, + {kS32Type, kI32Const, "%4", "FindSMsb", "%5", 73, 6, {5}}, + {kU32Type, kI32Const, "%4", "FindUMsb", "%5", 74, 6, {5}}, + {kF32Type, kF32Const, "%4", "InterpolateAtCentroid", "%5", 75, 6, {5}}, + // clang-format off + {kF32Type, kF32Const, "%4", "InterpolateAtSample", "%5 %5", 76, 7, {5, 5}}, + {kF32Type, kF32Const, "%4", "InterpolateAtOffset", "%5 %5", 77, 7, {5, 5}}, + // clang-format on + {kU32Type, kI32Const, "%4", "UaddCarry", "%5 %5 %5", 78, 8, {5, 5, 5}}, + {kU32Type, kI32Const, "%4", "UsubBorrow", "%5 %5 %5", 79, 8, {5, 5, 5}}, + // clang-format off + {kU32Type, kI32Const, "%4", "UmulExtended", "%5 %5 %5 %5", 80, 9, {5, 5, 5, 5}}, + // clang-format on }))); -- 2.7.4