Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_validation.h

Issue 2689006: Refactor validation code so it can be modified at runtime.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Contains various validation functions for the GLES2 service. 5 // Contains various validation functions for the GLES2 service.
6 6
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_ 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_ 8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
9 9
10 #include <vector>
11 #define GLES2_GPU_SERVICE 1
10 #include "gpu/command_buffer/common/gles2_cmd_format.h" 12 #include "gpu/command_buffer/common/gles2_cmd_format.h"
11 13
12 namespace gpu { 14 namespace gpu {
13 namespace gles2 { 15 namespace gles2 {
14 16
17 // ValueValidator returns true if a value is valid.
18 template <typename T>
19 class ValueValidator {
20 public:
21 ValueValidator(const T* valid_values, int num_values) {
22 for (int ii = 0; ii < num_values; ++ii) {
23 AddValue(valid_values[ii]);
24 }
25 }
26
27 void AddValue(const T value) {
28 valid_values_.push_back(value);
29 }
30
31 bool IsValid(const T value) const {
32 return std::find(valid_values_.begin(), valid_values_.end(), value) !=
33 valid_values_.end();
34 }
35
36 private:
37 std::vector<T> valid_values_;
38 };
39
40 struct Validators {
41 Validators();
15 #include "gpu/command_buffer/service/gles2_cmd_validation_autogen.h" 42 #include "gpu/command_buffer/service/gles2_cmd_validation_autogen.h"
43 };
16 44
17 } // namespace gles2 45 } // namespace gles2
18 } // namespace gpu 46 } // namespace gpu
19 47
20 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_ 48 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
21 49
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_autogen.h ('k') | gpu/command_buffer/service/gles2_cmd_validation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698