OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <algorithm> | 10 #include <algorithm> |
(...skipping 19 matching lines...) Expand all Loading... |
30 valid_values_.push_back(value); | 30 valid_values_.push_back(value); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 void AddValues(const T* valid_values, int num_values) { | 34 void AddValues(const T* valid_values, int num_values) { |
35 for (int ii = 0; ii < num_values; ++ii) { | 35 for (int ii = 0; ii < num_values; ++ii) { |
36 AddValue(valid_values[ii]); | 36 AddValue(valid_values[ii]); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
| 40 void RemoveValues(const T* invalid_values, int num_values) { |
| 41 for (int ii = 0; ii < num_values; ++ii) { |
| 42 auto iter = std::find( |
| 43 valid_values_.begin(), valid_values_.end(), invalid_values[ii]); |
| 44 if (iter != valid_values_.end()) { |
| 45 valid_values_.erase(iter); |
| 46 DCHECK(!IsValid(invalid_values[ii])); |
| 47 } |
| 48 } |
| 49 } |
| 50 |
40 bool IsValid(const T value) const { | 51 bool IsValid(const T value) const { |
41 return std::find(valid_values_.begin(), valid_values_.end(), value) != | 52 return std::find(valid_values_.begin(), valid_values_.end(), value) != |
42 valid_values_.end(); | 53 valid_values_.end(); |
43 } | 54 } |
44 | 55 |
45 const std::vector<T>& GetValues() const { | 56 const std::vector<T>& GetValues() const { |
46 return valid_values_; | 57 return valid_values_; |
47 } | 58 } |
48 | 59 |
49 private: | 60 private: |
50 std::vector<T> valid_values_; | 61 std::vector<T> valid_values_; |
51 }; | 62 }; |
52 | 63 |
53 struct Validators { | 64 struct Validators { |
54 Validators(); | 65 Validators(); |
55 | 66 |
56 void AddES3Values(); | 67 void UpdateValuesES3(); |
57 | 68 |
58 #include "gpu/command_buffer/service/gles2_cmd_validation_autogen.h" | 69 #include "gpu/command_buffer/service/gles2_cmd_validation_autogen.h" |
59 }; | 70 }; |
60 | 71 |
61 } // namespace gles2 | 72 } // namespace gles2 |
62 } // namespace gpu | 73 } // namespace gpu |
63 | 74 |
64 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_ | 75 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_ |
65 | 76 |
OLD | NEW |