Commit 9af3e137 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: EXT_gpu_shader5 support: fma

Add the fma() builtin function to ESSL. Bug: angleproject:3569 Change-Id: Ic8419b4c117ecdd8b47aa733bf7aff9ee7579bbf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1954484Reviewed-by: 's avatarJiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 351307eb
{
"src/compiler/translator/ImmutableString_ESSL_autogen.cpp":
"1dc22b75034ae56cbe544263242033b0",
"fe602324a31c982cdd7c107181236ec6",
"src/compiler/translator/ImmutableString_autogen.cpp":
"491c2b20494968ab4e6b6a4e479db102",
"0d631780ea7308d873cbd587b054be02",
"src/compiler/translator/ParseContext_ESSL_autogen.h":
"f718200775523d610410e06c52e23358",
"bffca635252a71dac27b3afa7d875499",
"src/compiler/translator/ParseContext_complete_autogen.h":
"a4209c68899e9cf3bcce81be2cb5f39f",
"31ab3cdbb91558934da68789b5258711",
"src/compiler/translator/SymbolTable_ESSL_autogen.cpp":
"b600cc2afc658f552dbf32fc97dc5dce",
"ee18e53f2f0dad48d8e9fe00d986030f",
"src/compiler/translator/SymbolTable_autogen.cpp":
"ef50067f90578a8f46914603ebd4070b",
"98a0921714b262a60e9156addd85f68a",
"src/compiler/translator/SymbolTable_autogen.h":
"3ce7740b6ad93a86d198c3937b70c17e",
"src/compiler/translator/builtin_function_declarations.txt":
"fc9b0b050448d015482c9f13cab1df67",
"3b43d33d9ff2bbf15169e5e525e474c9",
"src/compiler/translator/builtin_variables.json":
"1b71075ff2644fd32b12bb53dce50062",
"src/compiler/translator/gen_builtin_symbols.py":
"1034aa779dc2f10458779b28863ec6e2",
"d10962278862f28e8f559430f8f43dc9",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"f62b9c5fe1e3eb67bddab00e2a5e3dca",
"61f5b6be97331bb4c05ea36ab4ab3724",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
"d86d7b7d493f1ed9b3311f858ec95447",
"17aa7b01dcf253700edfad7e9e584241",
"src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp":
"14c7b4bfba01cf0a38f274f53460177a",
"e014f0e867acd76080574c6d87c94a2d",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
"a92937de7152da9dc582f4b88f6af39a"
"ae68e2145cbf31af7cbbd61fa25b8a0c"
}
\ No newline at end of file
......@@ -152,6 +152,7 @@ bool CanFoldAggregateBuiltInOp(TOperator op)
case EOpMix:
case EOpStep:
case EOpSmoothstep:
case EOpFma:
case EOpLdexp:
case EOpMulMatrixComponentWise:
case EOpOuterProduct:
......@@ -3618,6 +3619,22 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
break;
}
case EOpFma:
{
ASSERT(basicType == EbtFloat);
resultArray = new TConstantUnion[maxObjectSize];
for (size_t i = 0; i < maxObjectSize; i++)
{
float a = unionArrays[0][i].getFConst();
float b = unionArrays[1][i].getFConst();
float c = unionArrays[2][i].getFConst();
// Returns a * b + c.
resultArray[i].setFConst(a * b + c);
}
break;
}
case EOpLdexp:
{
resultArray = new TConstantUnion[maxObjectSize];
......
......@@ -190,6 +190,8 @@ const char *GetOperatorString(TOperator op)
return "isnan";
case EOpIsinf:
return "isinf";
case EOpFma:
return "fma";
case EOpFloatBitsToInt:
return "floatBitsToInt";
......
......@@ -139,6 +139,7 @@ enum TOperator
EOpSmoothstep,
EOpIsnan,
EOpIsinf,
EOpFma,
EOpFloatBitsToInt,
EOpFloatBitsToUint,
......@@ -257,7 +258,6 @@ enum TOperator
// Desktop GLSL functions
EOpFTransform,
EOpFma,
EOpPackDouble2x32,
EOpUnpackDouble2x32,
};
......
......@@ -1035,6 +1035,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpMix:
case EOpStep:
case EOpSmoothstep:
case EOpFma:
case EOpFrexp:
case EOpLdexp:
case EOpDistance:
......
......@@ -2493,6 +2493,9 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpSmoothstep:
outputTriplet(out, visit, "smoothstep(", ", ", ")");
break;
case EOpFma:
outputTriplet(out, visit, "mad(", ", ", ")");
break;
case EOpFrexp:
case EOpLdexp:
ASSERT(node->getUseEmulatedFunction());
......
......@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3017 && id <= 3086;
return id >= 3029 && id <= 3098;
}
bool isTextureOffsetBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3087 && id <= 3106;
return id >= 3099 && id <= 3118;
}
bool isTextureGatherOffset(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3144 && id <= 3157;
return id >= 3156 && id <= 3169;
}
bool isTextureGather(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3120 && id <= 3157;
return id >= 3132 && id <= 3169;
}
bool isAtomicMemory(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3174 && id <= 3191;
return id >= 3186 && id <= 3203;
}
bool isImageLoad(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3216 && id <= 3227;
return id >= 3228 && id <= 3239;
}
bool isImageStore(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3228 && id <= 3239;
return id >= 3240 && id <= 3251;
}
bool isImage(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3192 && id <= 3239;
return id >= 3204 && id <= 3251;
}
} // namespace BuiltInGroup
......
......@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 1113 && id <= 1259;
return id >= 1117 && id <= 1263;
}
bool isTextureOffsetBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 1260 && id <= 1294;
return id >= 1264 && id <= 1298;
}
bool isTextureGatherOffset(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 1346 && id <= 1388;
return id >= 1350 && id <= 1392;
}
bool isTextureGather(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 1308 && id <= 1388;
return id >= 1312 && id <= 1392;
}
bool isAtomicMemory(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 1450 && id <= 1467;
return id >= 1454 && id <= 1471;
}
bool isImageLoad(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 2104 && id <= 2136;
return id >= 2108 && id <= 2140;
}
bool isImageStore(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 2137 && id <= 2169;
return id >= 2141 && id <= 2173;
}
bool isImage(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 1468 && id <= 2169;
return id >= 1472 && id <= 2173;
}
} // namespace BuiltInGroup
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,7 +19,8 @@
//
// Supported function metadata properties are:
// "essl_level"
// string, one of COMMON_BUILTINS, ESSL1_BUILTINS, ESSL3_BUILTINS and ESSL3_1_BUILTINS.
// string, one of COMMON_BUILTINS, ESSL1_BUILTINS, ESSL3_BUILTINS and ESSL3_1_BUILTINS,
// ESSL3_2_BUILTINS.
// "glsl_level"
// string, one of COMMON_BUILTINS, COMMON_BUILTINS, GLSL1_2_BUILTINS, GLSL1_3_BUILTINS,
// GLSL1_4_BUILTINS, GLSL1_5_BUILTINS, GLSL3_3_BUILTINS, GLSL4_BUILTINS, GLSL4_1_BUILTINS,
......@@ -201,8 +202,11 @@ GROUP BEGIN Common
genUType floatBitsToUint(genType);
genType intBitsToFloat(genIType);
genType uintBitsToFloat(genUType);
DEFAULT METADATA {"glsl_level": "GLSL4_BUILTINS", "op": "auto"}
DEFAULT METADATA {"essl_level": "ESSL3_2_BUILTINS", "glsl_level": "GLSL4_BUILTINS", "op": "auto"}
genType fma(genType, genType, genType);
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "op": "auto", "essl_extension": "EXT_gpu_shader5", "suffix": "Ext"}
genType fma(genType, genType, genType);
DEFAULT METADATA {"glsl_level": "GLSL4_BUILTINS", "op": "auto"}
genType fma(genDType, genDType, genDType);
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "glsl_level": "GLSL4_BUILTINS", "op": "auto"}
genType frexp(genType, out genIType);
......
......@@ -528,7 +528,9 @@ def get_basic_mangled_name(basic):
return '1' + chr(ord('a') + index - 78)
essl_levels = ['ESSL3_1_BUILTINS', 'ESSL3_BUILTINS', 'ESSL1_BUILTINS', 'COMMON_BUILTINS']
essl_levels = [
'ESSL3_2_BUILTINS', 'ESSL3_1_BUILTINS', 'ESSL3_BUILTINS', 'ESSL1_BUILTINS', 'COMMON_BUILTINS'
]
glsl_levels = [
'GLSL4_6_BUILTINS', 'GLSL4_5_BUILTINS', 'GLSL4_4_BUILTINS', 'GLSL4_3_BUILTINS',
......@@ -541,6 +543,8 @@ glsl_levels = [
def get_essl_shader_version_for_level(level):
if level == None:
return '-1'
elif level == 'ESSL3_2_BUILTINS':
return '320'
elif level == 'ESSL3_1_BUILTINS':
return '310'
elif level == 'ESSL3_BUILTINS':
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -710,12 +710,6 @@
// EXT_gpu_shader5: Note: this extension is not yet fully implemented, so should be disabled in the
// Vulkan backend for the ES 3.1 conformance run.
3569 VULKAN : dEQP-GLES31.functional.shaders.builtin_functions.common.fma.*vertex = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.builtin_functions.common.fma.*fragment = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.builtin_functions.common.fma.*compute = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.builtin_functions.precision.fma*vertex* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.builtin_functions.precision.fma*fragment* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.builtin_functions.precision.fma*compute* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*vertex* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*fragment* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*compute* = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment