Commit 5a7356ae by Shahbaz Youssefi Committed by Commit Bot

Add support for non-float mix

The non-float variations of the mix builtin were conditioned to desktop GLSL, but they are present in ESSL 3.1+. This change also implements constant folding of these builtins as exercised by dEQP. Bug: angleproject:4300 Change-Id: Iec34de4cf370e00d67fd605148cd7848f9e122f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2006809 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent a8614528
{ {
"src/compiler/translator/ImmutableString_ESSL_autogen.cpp": "src/compiler/translator/ImmutableString_ESSL_autogen.cpp":
"ddecd9cf66f0215a7948ac89cd1d3385", "5eb552ee4f89b9dbc96891afdc27f524",
"src/compiler/translator/ImmutableString_autogen.cpp": "src/compiler/translator/ImmutableString_autogen.cpp":
"9f2ee71527ac7f4ec6a03d5c53b804f0", "f1530bc05f6b3117861b66e18510f931",
"src/compiler/translator/ParseContext_ESSL_autogen.h": "src/compiler/translator/ParseContext_ESSL_autogen.h":
"082e0de86e1d4aa7ce38e8721f7e9e7a", "d97fc9835e8ad4d5ed0391a863c6b0ca",
"src/compiler/translator/ParseContext_complete_autogen.h": "src/compiler/translator/ParseContext_complete_autogen.h":
"2781c026f8561561963609f41dc3d19b", "dc88a43c877a9955c909e73c4da34176",
"src/compiler/translator/SymbolTable_ESSL_autogen.cpp": "src/compiler/translator/SymbolTable_ESSL_autogen.cpp":
"afe64a7aaabec38d0f18cd97ff2636a2", "6e0251384060afcb12d76de4293e1309",
"src/compiler/translator/SymbolTable_autogen.cpp": "src/compiler/translator/SymbolTable_autogen.cpp":
"0472960960684ef6f11640fee05ed744", "c11d46507c1f32bbbf7930ab72f4ad46",
"src/compiler/translator/SymbolTable_autogen.h": "src/compiler/translator/SymbolTable_autogen.h":
"3ce7740b6ad93a86d198c3937b70c17e", "c4f6b75374c22851df2cff40c5c7c877",
"src/compiler/translator/builtin_function_declarations.txt": "src/compiler/translator/builtin_function_declarations.txt":
"ef7425b5ef3b95c14ad32ea676f9eb92", "e4a0add049ebbaa8dc5b6c630816b7f8",
"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":
"ef6fde209ca86ffb1752fc3a5b9d72d7", "ef6fde209ca86ffb1752fc3a5b9d72d7",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h": "src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"9794433d4227bf48d3f992179aa39c5f", "18c483560bd804bf4f55418a5bd4f946",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h": "src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
"037b26042f27c30f875a438e14d00f8b", "526af7b92fe6a1056c7aacd810d2e8a9",
"src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp": "src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp":
"2ef94949a7d307a9637be33721963013", "8bd6d3d4cad8c4f788c006f973a8de09",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp": "src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
"bbadb3d43954e107a88b8af5a9585000" "177eb26e8ddda67aef008a1b3d1e0cf9"
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Generated by gen_builtin_symbols.py using data from builtin_variables.json and // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
// builtin_function_declarations.txt. // builtin_function_declarations.txt.
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
......
...@@ -3566,15 +3566,16 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg ...@@ -3566,15 +3566,16 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
case EOpMix: case EOpMix:
{ {
ASSERT(basicType == EbtFloat);
resultArray = new TConstantUnion[maxObjectSize]; resultArray = new TConstantUnion[maxObjectSize];
for (size_t i = 0; i < maxObjectSize; i++) for (size_t i = 0; i < maxObjectSize; i++)
{ {
float x = unionArrays[0][i].getFConst();
float y = unionArrays[1][i].getFConst();
TBasicType type = (*arguments)[2]->getAsTyped()->getType().getBasicType(); TBasicType type = (*arguments)[2]->getAsTyped()->getType().getBasicType();
if (type == EbtFloat) if (type == EbtFloat)
{ {
ASSERT(basicType == EbtFloat);
float x = unionArrays[0][i].getFConst();
float y = unionArrays[1][i].getFConst();
// Returns the linear blend of x and y, i.e., x * (1 - a) + y * a. // Returns the linear blend of x and y, i.e., x * (1 - a) + y * a.
float a = unionArrays[2][i].getFConst(); float a = unionArrays[2][i].getFConst();
resultArray[i].setFConst(x * (1.0f - a) + y * a); resultArray[i].setFConst(x * (1.0f - a) + y * a);
...@@ -3588,7 +3589,40 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg ...@@ -3588,7 +3589,40 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
// For a component of a that is true, the corresponding component of y is // For a component of a that is true, the corresponding component of y is
// returned. // returned.
bool a = unionArrays[2][i].getBConst(); bool a = unionArrays[2][i].getBConst();
resultArray[i].setFConst(a ? y : x); switch (basicType)
{
case EbtFloat:
{
float x = unionArrays[0][i].getFConst();
float y = unionArrays[1][i].getFConst();
resultArray[i].setFConst(a ? y : x);
}
break;
case EbtInt:
{
int x = unionArrays[0][i].getIConst();
int y = unionArrays[1][i].getIConst();
resultArray[i].setIConst(a ? y : x);
}
break;
case EbtUInt:
{
unsigned int x = unionArrays[0][i].getUConst();
unsigned int y = unionArrays[1][i].getUConst();
resultArray[i].setUConst(a ? y : x);
}
break;
case EbtBool:
{
bool x = unionArrays[0][i].getBConst();
bool y = unionArrays[1][i].getBConst();
resultArray[i].setBConst(a ? y : x);
}
break;
default:
UNREACHABLE();
break;
}
} }
} }
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Generated by gen_builtin_symbols.py using data from builtin_variables.json and // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
// builtin_function_declarations.txt. // builtin_function_declarations.txt.
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -21,67 +21,67 @@ namespace BuiltInGroup ...@@ -21,67 +21,67 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func) bool isTextureOffsetNoBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3046 && id <= 3115; return id >= 3058 && id <= 3127;
} }
bool isTextureOffsetBias(const TFunction *func) bool isTextureOffsetBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3116 && id <= 3135; return id >= 3128 && id <= 3147;
} }
bool isTextureGatherOffsetsComp(const TFunction *func) bool isTextureGatherOffsetsComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3173 && id <= 3185; return id >= 3185 && id <= 3197;
} }
bool isTextureGatherOffsetsNoComp(const TFunction *func) bool isTextureGatherOffsetsNoComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3186 && id <= 3201; return id >= 3198 && id <= 3213;
} }
bool isTextureGatherOffsets(const TFunction *func) bool isTextureGatherOffsets(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3173 && id <= 3201; return id >= 3185 && id <= 3213;
} }
bool isTextureGatherOffsetComp(const TFunction *func) bool isTextureGatherOffsetComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3202 && id <= 3207; return id >= 3214 && id <= 3219;
} }
bool isTextureGatherOffsetNoComp(const TFunction *func) bool isTextureGatherOffsetNoComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3208 && id <= 3215; return id >= 3220 && id <= 3227;
} }
bool isTextureGatherOffset(const TFunction *func) bool isTextureGatherOffset(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3202 && id <= 3215; return id >= 3214 && id <= 3227;
} }
bool isTextureGather(const TFunction *func) bool isTextureGather(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3149 && id <= 3215; return id >= 3161 && id <= 3227;
} }
bool isAtomicMemory(const TFunction *func) bool isAtomicMemory(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3232 && id <= 3249; return id >= 3244 && id <= 3261;
} }
bool isImageLoad(const TFunction *func) bool isImageLoad(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3274 && id <= 3285; return id >= 3286 && id <= 3297;
} }
bool isImageStore(const TFunction *func) bool isImageStore(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3286 && id <= 3297; return id >= 3298 && id <= 3309;
} }
bool isImage(const TFunction *func) bool isImage(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3250 && id <= 3297; return id >= 3262 && id <= 3309;
} }
} // namespace BuiltInGroup } // namespace BuiltInGroup
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Generated by gen_builtin_symbols.py using data from builtin_variables.json and // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
// builtin_function_declarations.txt. // builtin_function_declarations.txt.
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
......
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.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Generated by gen_builtin_symbols.py using data from builtin_variables.json and // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
// builtin_function_declarations.txt. // builtin_function_declarations.txt.
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
......
...@@ -169,7 +169,7 @@ GROUP BEGIN Common ...@@ -169,7 +169,7 @@ GROUP BEGIN Common
genType mix(genType, genType, genBType); genType mix(genType, genType, genBType);
DEFAULT METADATA {"glsl_level": "GLSL4_BUILTINS", "op": "auto"} DEFAULT METADATA {"glsl_level": "GLSL4_BUILTINS", "op": "auto"}
genDType mix(genDType, genDType, genBType); genDType mix(genDType, genDType, genBType);
DEFAULT METADATA {"glsl_level": "GLSL4_5_BUILTINS", "op": "auto"} DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "glsl_level": "GLSL4_5_BUILTINS", "op": "auto"}
genIType mix(genIType, genIType, genBType); genIType mix(genIType, genIType, genBType);
genUType mix(genUType, genUType, genBType); genUType mix(genUType, genUType, genBType);
genBType mix(genBType, genBType, genBType); genBType mix(genBType, genBType, genBType);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Generated by gen_builtin_symbols.py using data from builtin_variables.json and // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
// builtin_function_declarations.txt. // builtin_function_declarations.txt.
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
......
This source diff could not be displayed because it is too large. You can view the blob instead.
// GENERATED FILE - DO NOT EDIT. // GENERATED FILE - DO NOT EDIT.
// Generated by gen_builtin_symbols.py using data from builtin_function_declarations.txt. // Generated by gen_builtin_symbols.py using data from builtin_function_declarations.txt.
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
......
...@@ -69,9 +69,6 @@ ...@@ -69,9 +69,6 @@
4315 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-memory-order-vsfs = FAIL 4315 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-memory-order-vsfs = FAIL
4108 VULKAN : KHR-GLES31.core.shader_image_size.*-nonMS-* = SKIP 4108 VULKAN : KHR-GLES31.core.shader_image_size.*-nonMS-* = SKIP
// Shader support:
4300 : KHR-GLES31.core.shader_integer_mix.* = FAIL
// Unimplemented glValidateCreateShaderProgramv: // Unimplemented glValidateCreateShaderProgramv:
4146 : KHR-GLES31.core.shader_storage_buffer_object.basic-syntaxSSO = FAIL 4146 : KHR-GLES31.core.shader_storage_buffer_object.basic-syntaxSSO = FAIL
4146 : KHR-GLES31.core.vertex_attrib_binding.advanced-bindingUpdate = FAIL 4146 : KHR-GLES31.core.vertex_attrib_binding.advanced-bindingUpdate = 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