Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // validationES31.cpp: Validation functions for OpenGL ES 3.1 entry point parameters |
| 8 | |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 9 | #include "libANGLE/validationES31.h" |
| 10 | |
| 11 | #include "libANGLE/Context.h" |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 12 | #include "libANGLE/validationES.h" |
| 13 | #include "libANGLE/validationES3.h" |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 14 | |
| 15 | using namespace angle; |
| 16 | |
| 17 | namespace gl |
| 18 | { |
| 19 | |
| 20 | bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data) |
| 21 | { |
Geoff Lang | eb66a6e | 2016-10-31 13:06:12 -0400 | [diff] [blame^] | 22 | if (context->getClientVersion() < ES_3_1) |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 23 | { |
| 24 | context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1")); |
| 25 | return false; |
| 26 | } |
| 27 | |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 28 | if (!ValidateIndexedStateQuery(context, target, index, nullptr)) |
| 29 | { |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | bool ValidateGetBooleani_vRobustANGLE(Context *context, |
| 37 | GLenum target, |
| 38 | GLuint index, |
| 39 | GLsizei bufSize, |
| 40 | GLsizei *length, |
| 41 | GLboolean *data) |
| 42 | { |
Geoff Lang | eb66a6e | 2016-10-31 13:06:12 -0400 | [diff] [blame^] | 43 | if (context->getClientVersion() < ES_3_1) |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 44 | { |
| 45 | context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1")); |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | if (!ValidateRobustEntryPoint(context, bufSize)) |
| 50 | { |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | if (!ValidateIndexedStateQuery(context, target, index, length)) |
| 55 | { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | if (!ValidateRobustBufferSize(context, bufSize, *length)) |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 60 | { |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | } // namespace gl |