blob: 4cea05e47112c6c326fd7ba2cc84d9a8ae58ddfc [file] [log] [blame]
Martin Radev66fb8202016-07-28 11:45:20 +03001//
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 Radev66fb8202016-07-28 11:45:20 +03009#include "libANGLE/validationES31.h"
10
11#include "libANGLE/Context.h"
Geoff Lang2e43dbb2016-10-14 12:27:35 -040012#include "libANGLE/validationES.h"
13#include "libANGLE/validationES3.h"
Martin Radev66fb8202016-07-28 11:45:20 +030014
15using namespace angle;
16
17namespace gl
18{
19
20bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data)
21{
Geoff Langeb66a6e2016-10-31 13:06:12 -040022 if (context->getClientVersion() < ES_3_1)
Martin Radev66fb8202016-07-28 11:45:20 +030023 {
24 context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1"));
25 return false;
26 }
27
Geoff Lang2e43dbb2016-10-14 12:27:35 -040028 if (!ValidateIndexedStateQuery(context, target, index, nullptr))
29 {
30 return false;
31 }
32
33 return true;
34}
35
36bool ValidateGetBooleani_vRobustANGLE(Context *context,
37 GLenum target,
38 GLuint index,
39 GLsizei bufSize,
40 GLsizei *length,
41 GLboolean *data)
42{
Geoff Langeb66a6e2016-10-31 13:06:12 -040043 if (context->getClientVersion() < ES_3_1)
Geoff Lang2e43dbb2016-10-14 12:27:35 -040044 {
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 Radev66fb8202016-07-28 11:45:20 +030060 {
61 return false;
62 }
63
64 return true;
65}
66
67} // namespace gl