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": "src/compiler/translator/ImmutableString_ESSL_autogen.cpp":
"1dc22b75034ae56cbe544263242033b0", "fe602324a31c982cdd7c107181236ec6",
"src/compiler/translator/ImmutableString_autogen.cpp": "src/compiler/translator/ImmutableString_autogen.cpp":
"491c2b20494968ab4e6b6a4e479db102", "0d631780ea7308d873cbd587b054be02",
"src/compiler/translator/ParseContext_ESSL_autogen.h": "src/compiler/translator/ParseContext_ESSL_autogen.h":
"f718200775523d610410e06c52e23358", "bffca635252a71dac27b3afa7d875499",
"src/compiler/translator/ParseContext_complete_autogen.h": "src/compiler/translator/ParseContext_complete_autogen.h":
"a4209c68899e9cf3bcce81be2cb5f39f", "31ab3cdbb91558934da68789b5258711",
"src/compiler/translator/SymbolTable_ESSL_autogen.cpp": "src/compiler/translator/SymbolTable_ESSL_autogen.cpp":
"b600cc2afc658f552dbf32fc97dc5dce", "ee18e53f2f0dad48d8e9fe00d986030f",
"src/compiler/translator/SymbolTable_autogen.cpp": "src/compiler/translator/SymbolTable_autogen.cpp":
"ef50067f90578a8f46914603ebd4070b", "98a0921714b262a60e9156addd85f68a",
"src/compiler/translator/SymbolTable_autogen.h": "src/compiler/translator/SymbolTable_autogen.h":
"3ce7740b6ad93a86d198c3937b70c17e", "3ce7740b6ad93a86d198c3937b70c17e",
"src/compiler/translator/builtin_function_declarations.txt": "src/compiler/translator/builtin_function_declarations.txt":
"fc9b0b050448d015482c9f13cab1df67", "3b43d33d9ff2bbf15169e5e525e474c9",
"src/compiler/translator/builtin_variables.json": "src/compiler/translator/builtin_variables.json":
"1b71075ff2644fd32b12bb53dce50062", "1b71075ff2644fd32b12bb53dce50062",
"src/compiler/translator/gen_builtin_symbols.py": "src/compiler/translator/gen_builtin_symbols.py":
"1034aa779dc2f10458779b28863ec6e2", "d10962278862f28e8f559430f8f43dc9",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h": "src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"f62b9c5fe1e3eb67bddab00e2a5e3dca", "61f5b6be97331bb4c05ea36ab4ab3724",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h": "src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
"d86d7b7d493f1ed9b3311f858ec95447", "17aa7b01dcf253700edfad7e9e584241",
"src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp": "src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp":
"14c7b4bfba01cf0a38f274f53460177a", "e014f0e867acd76080574c6d87c94a2d",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp": "src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
"a92937de7152da9dc582f4b88f6af39a" "ae68e2145cbf31af7cbbd61fa25b8a0c"
} }
\ No newline at end of file
...@@ -152,6 +152,7 @@ bool CanFoldAggregateBuiltInOp(TOperator op) ...@@ -152,6 +152,7 @@ bool CanFoldAggregateBuiltInOp(TOperator op)
case EOpMix: case EOpMix:
case EOpStep: case EOpStep:
case EOpSmoothstep: case EOpSmoothstep:
case EOpFma:
case EOpLdexp: case EOpLdexp:
case EOpMulMatrixComponentWise: case EOpMulMatrixComponentWise:
case EOpOuterProduct: case EOpOuterProduct:
...@@ -3618,6 +3619,22 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg ...@@ -3618,6 +3619,22 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
break; 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: case EOpLdexp:
{ {
resultArray = new TConstantUnion[maxObjectSize]; resultArray = new TConstantUnion[maxObjectSize];
......
...@@ -190,6 +190,8 @@ const char *GetOperatorString(TOperator op) ...@@ -190,6 +190,8 @@ const char *GetOperatorString(TOperator op)
return "isnan"; return "isnan";
case EOpIsinf: case EOpIsinf:
return "isinf"; return "isinf";
case EOpFma:
return "fma";
case EOpFloatBitsToInt: case EOpFloatBitsToInt:
return "floatBitsToInt"; return "floatBitsToInt";
......
...@@ -139,6 +139,7 @@ enum TOperator ...@@ -139,6 +139,7 @@ enum TOperator
EOpSmoothstep, EOpSmoothstep,
EOpIsnan, EOpIsnan,
EOpIsinf, EOpIsinf,
EOpFma,
EOpFloatBitsToInt, EOpFloatBitsToInt,
EOpFloatBitsToUint, EOpFloatBitsToUint,
...@@ -257,7 +258,6 @@ enum TOperator ...@@ -257,7 +258,6 @@ enum TOperator
// Desktop GLSL functions // Desktop GLSL functions
EOpFTransform, EOpFTransform,
EOpFma,
EOpPackDouble2x32, EOpPackDouble2x32,
EOpUnpackDouble2x32, EOpUnpackDouble2x32,
}; };
......
...@@ -1035,6 +1035,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1035,6 +1035,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpMix: case EOpMix:
case EOpStep: case EOpStep:
case EOpSmoothstep: case EOpSmoothstep:
case EOpFma:
case EOpFrexp: case EOpFrexp:
case EOpLdexp: case EOpLdexp:
case EOpDistance: case EOpDistance:
......
...@@ -2493,6 +2493,9 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -2493,6 +2493,9 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpSmoothstep: case EOpSmoothstep:
outputTriplet(out, visit, "smoothstep(", ", ", ")"); outputTriplet(out, visit, "smoothstep(", ", ", ")");
break; break;
case EOpFma:
outputTriplet(out, visit, "mad(", ", ", ")");
break;
case EOpFrexp: case EOpFrexp:
case EOpLdexp: case EOpLdexp:
ASSERT(node->getUseEmulatedFunction()); ASSERT(node->getUseEmulatedFunction());
......
...@@ -21,42 +21,42 @@ namespace BuiltInGroup ...@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func) bool isTextureOffsetNoBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3017 && id <= 3086; return id >= 3029 && id <= 3098;
} }
bool isTextureOffsetBias(const TFunction *func) bool isTextureOffsetBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3087 && id <= 3106; return id >= 3099 && id <= 3118;
} }
bool isTextureGatherOffset(const TFunction *func) bool isTextureGatherOffset(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3144 && id <= 3157; return id >= 3156 && id <= 3169;
} }
bool isTextureGather(const TFunction *func) bool isTextureGather(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3120 && id <= 3157; return id >= 3132 && id <= 3169;
} }
bool isAtomicMemory(const TFunction *func) bool isAtomicMemory(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3174 && id <= 3191; return id >= 3186 && id <= 3203;
} }
bool isImageLoad(const TFunction *func) bool isImageLoad(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3216 && id <= 3227; return id >= 3228 && id <= 3239;
} }
bool isImageStore(const TFunction *func) bool isImageStore(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3228 && id <= 3239; return id >= 3240 && id <= 3251;
} }
bool isImage(const TFunction *func) bool isImage(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3192 && id <= 3239; return id >= 3204 && id <= 3251;
} }
} // namespace BuiltInGroup } // namespace BuiltInGroup
......
...@@ -21,42 +21,42 @@ namespace BuiltInGroup ...@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func) bool isTextureOffsetNoBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1113 && id <= 1259; return id >= 1117 && id <= 1263;
} }
bool isTextureOffsetBias(const TFunction *func) bool isTextureOffsetBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1260 && id <= 1294; return id >= 1264 && id <= 1298;
} }
bool isTextureGatherOffset(const TFunction *func) bool isTextureGatherOffset(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1346 && id <= 1388; return id >= 1350 && id <= 1392;
} }
bool isTextureGather(const TFunction *func) bool isTextureGather(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1308 && id <= 1388; return id >= 1312 && id <= 1392;
} }
bool isAtomicMemory(const TFunction *func) bool isAtomicMemory(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1450 && id <= 1467; return id >= 1454 && id <= 1471;
} }
bool isImageLoad(const TFunction *func) bool isImageLoad(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 2104 && id <= 2136; return id >= 2108 && id <= 2140;
} }
bool isImageStore(const TFunction *func) bool isImageStore(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 2137 && id <= 2169; return id >= 2141 && id <= 2173;
} }
bool isImage(const TFunction *func) bool isImage(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1468 && id <= 2169; return id >= 1472 && id <= 2173;
} }
} // namespace BuiltInGroup } // namespace BuiltInGroup
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
// //
// Supported function metadata properties are: // Supported function metadata properties are:
// "essl_level" // "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" // "glsl_level"
// string, one of COMMON_BUILTINS, COMMON_BUILTINS, GLSL1_2_BUILTINS, GLSL1_3_BUILTINS, // 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, // GLSL1_4_BUILTINS, GLSL1_5_BUILTINS, GLSL3_3_BUILTINS, GLSL4_BUILTINS, GLSL4_1_BUILTINS,
...@@ -201,8 +202,11 @@ GROUP BEGIN Common ...@@ -201,8 +202,11 @@ GROUP BEGIN Common
genUType floatBitsToUint(genType); genUType floatBitsToUint(genType);
genType intBitsToFloat(genIType); genType intBitsToFloat(genIType);
genType uintBitsToFloat(genUType); 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); genType fma(genType, genType, genType);
DEFAULT METADATA {"glsl_level": "GLSL4_BUILTINS", "op": "auto"}
genType fma(genDType, genDType, genDType); genType fma(genDType, genDType, genDType);
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "glsl_level": "GLSL4_BUILTINS", "op": "auto"} DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "glsl_level": "GLSL4_BUILTINS", "op": "auto"}
genType frexp(genType, out genIType); genType frexp(genType, out genIType);
...@@ -1078,4 +1082,4 @@ GROUP BEGIN ShaderInvocationGroup ...@@ -1078,4 +1082,4 @@ GROUP BEGIN ShaderInvocationGroup
bool anyInvocation(bool); bool anyInvocation(bool);
bool allInvocations(bool); bool allInvocations(bool);
bool allInvocationsEqual(bool); bool allInvocationsEqual(bool);
GROUP END ShaderInvocationGroup GROUP END ShaderInvocationGroup
\ No newline at end of file
...@@ -528,7 +528,9 @@ def get_basic_mangled_name(basic): ...@@ -528,7 +528,9 @@ def get_basic_mangled_name(basic):
return '1' + chr(ord('a') + index - 78) 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 = [ glsl_levels = [
'GLSL4_6_BUILTINS', 'GLSL4_5_BUILTINS', 'GLSL4_4_BUILTINS', 'GLSL4_3_BUILTINS', 'GLSL4_6_BUILTINS', 'GLSL4_5_BUILTINS', 'GLSL4_4_BUILTINS', 'GLSL4_3_BUILTINS',
...@@ -541,6 +543,8 @@ glsl_levels = [ ...@@ -541,6 +543,8 @@ glsl_levels = [
def get_essl_shader_version_for_level(level): def get_essl_shader_version_for_level(level):
if level == None: if level == None:
return '-1' return '-1'
elif level == 'ESSL3_2_BUILTINS':
return '320'
elif level == 'ESSL3_1_BUILTINS': elif level == 'ESSL3_1_BUILTINS':
return '310' return '310'
elif level == 'ESSL3_BUILTINS': 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 @@ ...@@ -710,12 +710,6 @@
// EXT_gpu_shader5: Note: this extension is not yet fully implemented, so should be disabled in the // 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. // 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.*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.*fragment* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*compute* = 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