1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Contains various validation functions for the GLES2 service.
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
12 #define GLES2_GPU_SERVICE 1
13 #include "gpu/command_buffer/common/gles2_cmd_format.h"
18 // ValueValidator returns true if a value is valid.
20 class ValueValidator
{
24 ValueValidator(const T
* valid_values
, int num_values
) {
25 for (int ii
= 0; ii
< num_values
; ++ii
) {
26 AddValue(valid_values
[ii
]);
30 void AddValue(const T value
) {
31 if (!IsValid(value
)) {
32 valid_values_
.push_back(value
);
36 bool IsValid(const T value
) const {
37 return std::find(valid_values_
.begin(), valid_values_
.end(), value
) !=
41 const std::vector
<T
>& GetValues() const {
46 std::vector
<T
> valid_values_
;
51 #include "gpu/command_buffer/service/gles2_cmd_validation_autogen.h"
57 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_