Hash :
b1b6a171
Author :
Date :
2020-03-10T14:20:36
Vulkan: Disable robustness support Swiftshader does not currently have the ability to behave in a way for ANGLE to support KHR_robustness. Disable for now until that functionality is available. Bug: angleproject:3058 Bug: swiftshader:145 Change-Id: I1c1b8147f6b9cf6f8d0da633dfe0f61ebfab5175 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2097053 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// BindGeneratesResourceTest.cpp : Tests of the GL_CHROMIUM_bind_generates_resource extension.
#include "test_utils/ANGLETest.h"
namespace angle
{
class ContextLostTest : public ANGLETest
{
protected:
ContextLostTest() { setContextResetStrategy(EGL_LOSE_CONTEXT_ON_RESET_EXT); }
};
// GL_CHROMIUM_lose_context is implemented in the frontend
TEST_P(ContextLostTest, ExtensionStringExposed)
{
EXPECT_TRUE(EnsureGLExtensionEnabled("GL_CHROMIUM_lose_context"));
}
// Use GL_CHROMIUM_lose_context to lose a context and verify
TEST_P(ContextLostTest, BasicUsage)
{
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_CHROMIUM_lose_context"));
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_EXT_robustness"));
glLoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET, GL_INNOCENT_CONTEXT_RESET);
EXPECT_GL_NO_ERROR();
EXPECT_GLENUM_EQ(glGetGraphicsResetStatusEXT(), GL_GUILTY_CONTEXT_RESET);
glBindTexture(GL_TEXTURE_2D, 0);
EXPECT_GL_ERROR(GL_OUT_OF_MEMORY);
}
// When context is lost, polling queries such as glGetSynciv with GL_SYNC_STATUS should always
// return GL_SIGNALED
TEST_P(ContextLostTest, PollingQuery)
{
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_CHROMIUM_lose_context"));
ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3);
GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
EXPECT_GL_NO_ERROR();
glLoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET, GL_INNOCENT_CONTEXT_RESET);
EXPECT_GL_NO_ERROR();
GLint syncStatus = 0;
glGetSynciv(sync, GL_SYNC_STATUS, 1, nullptr, &syncStatus);
EXPECT_GL_ERROR(GL_CONTEXT_LOST);
EXPECT_GLENUM_EQ(syncStatus, GL_SIGNALED);
// Check that the query fails and the result is unmodified for other queries
GLint syncCondition = 0xBADF00D;
glGetSynciv(sync, GL_SYNC_CONDITION, 1, nullptr, &syncCondition);
EXPECT_GL_ERROR(GL_CONTEXT_LOST);
EXPECT_GLENUM_EQ(syncCondition, 0xBADF00D);
}
// When context is lost, polling queries such as glGetSynciv with GL_SYNC_STATUS should always
// return GL_SIGNALED
TEST_P(ContextLostTest, ParallelCompileReadyQuery)
{
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_CHROMIUM_lose_context"));
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_KHR_parallel_shader_compile"));
GLuint vs = CompileShader(GL_VERTEX_SHADER, essl1_shaders::vs::Simple());
GLuint fs = CompileShader(GL_FRAGMENT_SHADER, essl1_shaders::fs::UniformColor());
GLuint program = glCreateProgram();
glAttachShader(program, vs);
glAttachShader(program, fs);
glLinkProgram(program);
EXPECT_GL_NO_ERROR();
glLoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET, GL_INNOCENT_CONTEXT_RESET);
EXPECT_GL_NO_ERROR();
GLint shaderCompletionStatus = 0;
glGetShaderiv(vs, GL_COMPLETION_STATUS_KHR, &shaderCompletionStatus);
EXPECT_GL_ERROR(GL_CONTEXT_LOST);
EXPECT_GLENUM_EQ(shaderCompletionStatus, GL_TRUE);
GLint programCompletionStatus = 0;
glGetProgramiv(program, GL_COMPLETION_STATUS_KHR, &programCompletionStatus);
EXPECT_GL_ERROR(GL_CONTEXT_LOST);
EXPECT_GLENUM_EQ(programCompletionStatus, GL_TRUE);
// Check that the query fails and the result is unmodified for other queries
GLint shaderType = 0xBADF00D;
glGetShaderiv(vs, GL_SHADER_TYPE, &shaderType);
EXPECT_GL_ERROR(GL_CONTEXT_LOST);
EXPECT_GLENUM_EQ(shaderType, 0xBADF00D);
GLint linkStatus = 0xBADF00D;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
EXPECT_GL_ERROR(GL_CONTEXT_LOST);
EXPECT_GLENUM_EQ(linkStatus, 0xBADF00D);
}
class ContextLostSkipValidationTest : public ANGLETest
{
protected:
ContextLostSkipValidationTest()
{
setContextResetStrategy(EGL_LOSE_CONTEXT_ON_RESET_EXT);
setNoErrorEnabled(true);
}
};
// Use GL_CHROMIUM_lose_context to lose a context and verify
TEST_P(ContextLostSkipValidationTest, LostNoErrorGetProgram)
{
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_CHROMIUM_lose_context"));
GLuint program = glCreateProgram();
glLoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET, GL_INNOCENT_CONTEXT_RESET);
GLint val = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &val); // Should not crash.
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(ContextLostTest,
WithRobustness(ES2_NULL()),
WithRobustness(ES2_D3D9()),
WithRobustness(ES2_D3D11()),
WithRobustness(ES3_D3D11()),
WithRobustness(ES2_VULKAN()),
WithRobustness(ES3_VULKAN()));
ANGLE_INSTANTIATE_TEST(ContextLostSkipValidationTest,
WithRobustness(ES2_NULL()),
WithRobustness(ES2_D3D9()),
WithRobustness(ES2_D3D11()),
WithRobustness(ES3_D3D11()),
WithRobustness(ES2_VULKAN()),
WithRobustness(ES3_VULKAN()));
} // namespace angle