Commit 80147d11 by Yi Xu Committed by Commit Bot

Add support for dynamically allocate initial stack for Angle

By updating YYLTYPE_IS_TRIVIAL to true, YYSTACK_RELOCATE can be enabled, so we can dynamically allocate stack size based on needs. BUG=angleproject:3028 Change-Id: I1b9cc0768cd0c6955589695e703595c56d43f24a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1593954 Commit-Queue: Yi Xu <yiyix@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 467f174f
...@@ -58,6 +58,7 @@ using namespace sh; ...@@ -58,6 +58,7 @@ using namespace sh;
%code requires { %code requires {
#define YYLTYPE TSourceLoc #define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1 #define YYLTYPE_IS_DECLARED 1
#define YYLTYPE_IS_TRIVIAL 1
} }
%union { %union {
......
...@@ -129,6 +129,7 @@ extern int yydebug; ...@@ -129,6 +129,7 @@ extern int yydebug;
#define YYLTYPE TSourceLoc #define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1 #define YYLTYPE_IS_DECLARED 1
#define YYLTYPE_IS_TRIVIAL 1
......
...@@ -508,6 +508,22 @@ class GLSLTest_ES31 : public GLSLTest ...@@ -508,6 +508,22 @@ class GLSLTest_ES31 : public GLSLTest
void SetUp() override { ANGLETest::SetUp(); } void SetUp() override { ANGLETest::SetUp(); }
}; };
std::string BuillBigInitialStackShader(int length)
{
std::string result;
result += "void main() { \n";
for (int i = 0; i < length; i++)
{
result += " if (true) { \n";
}
result += " int temp; \n";
for (int i = 0; i <= length; i++)
{
result += "} \n";
}
return result;
}
TEST_P(GLSLTest, NamelessScopedStructs) TEST_P(GLSLTest, NamelessScopedStructs)
{ {
constexpr char kFS[] = R"(precision mediump float; constexpr char kFS[] = R"(precision mediump float;
...@@ -5518,6 +5534,15 @@ TEST_P(GLSLTest, FragData) ...@@ -5518,6 +5534,15 @@ TEST_P(GLSLTest, FragData)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
} }
// Test angle can handle big initial stack size with dynamic stack allocation.
TEST_P(GLSLTest, MemoryExhaustedTest)
{
ANGLE_SKIP_TEST_IF(IsD3D11_FL93());
GLuint program =
CompileProgram(essl1_shaders::vs::Simple(), BuillBigInitialStackShader(36).c_str());
EXPECT_NE(0u, program);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. // tests should be run against.
ANGLE_INSTANTIATE_TEST(GLSLTest, ANGLE_INSTANTIATE_TEST(GLSLTest,
......
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