OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 namespace gpu { | 11 namespace gpu { |
12 | 12 |
13 typedef int32_t CommandBufferOffset; | 13 typedef int32_t CommandBufferOffset; |
14 const CommandBufferOffset kInvalidCommandBufferOffset = -1; | 14 const CommandBufferOffset kInvalidCommandBufferOffset = -1; |
15 | 15 |
16 // This enum must stay in sync with NPDeviceContext3DError. | 16 // This enum must stay in sync with NPDeviceContext3DError. |
17 namespace error { | 17 namespace error { |
18 enum Error { | 18 enum Error { |
19 kNoError, | 19 kNoError, |
20 kInvalidSize, | 20 kInvalidSize, |
21 kOutOfBounds, | 21 kOutOfBounds, |
22 kUnknownCommand, | 22 kUnknownCommand, |
23 kInvalidArguments, | 23 kInvalidArguments, |
24 kLostContext, | 24 kLostContext, |
25 kGenericError, | 25 kGenericError, |
26 kDeferCommandUntilLater | 26 kDeferCommandUntilLater, |
| 27 kErrorLast = kDeferCommandUntilLater, |
27 }; | 28 }; |
28 | 29 |
29 // Return true if the given error code is an actual error. | 30 // Return true if the given error code is an actual error. |
30 inline bool IsError(Error error) { | 31 inline bool IsError(Error error) { |
31 return error != kNoError && error != kDeferCommandUntilLater; | 32 return error != kNoError && error != kDeferCommandUntilLater; |
32 } | 33 } |
33 | 34 |
34 // Provides finer grained information about why the context was lost. | 35 // Provides finer grained information about why the context was lost. |
35 enum ContextLostReason { | 36 enum ContextLostReason { |
36 // This context definitely provoked the loss of context. | 37 // This context definitely provoked the loss of context. |
37 kGuilty, | 38 kGuilty, |
38 | 39 |
39 // This context definitely did not provoke the loss of context. | 40 // This context definitely did not provoke the loss of context. |
40 kInnocent, | 41 kInnocent, |
41 | 42 |
42 // It is unknown whether this context provoked the loss of context. | 43 // It is unknown whether this context provoked the loss of context. |
43 kUnknown, | 44 kUnknown, |
44 kContextLostReasonLast = kUnknown | 45 |
| 46 // GL_OUT_OF_MEMORY caused this context to be lost. |
| 47 kOutOfMemory, |
| 48 |
| 49 // A failure to make the context current caused it to be lost. |
| 50 kMakeCurrentFailed, |
| 51 |
| 52 // The GPU channel was lost. This error is set client-side. |
| 53 kGpuChannelLost, |
| 54 |
| 55 kContextLostReasonLast = kGpuChannelLost |
45 }; | 56 }; |
46 } | 57 } |
47 | 58 |
48 // Invalid shared memory Id, returned by RegisterSharedMemory in case of | 59 // Invalid shared memory Id, returned by RegisterSharedMemory in case of |
49 // failure. | 60 // failure. |
50 const int32_t kInvalidSharedMemoryId = -1; | 61 const int32_t kInvalidSharedMemoryId = -1; |
51 | 62 |
52 // Common Command Buffer shared memory transfer buffer ID. | 63 // Common Command Buffer shared memory transfer buffer ID. |
53 const int32_t kCommandBufferSharedMemoryId = 4; | 64 const int32_t kCommandBufferSharedMemoryId = 4; |
54 | 65 |
55 // The size to set for the program cache. | 66 // The size to set for the program cache. |
56 const size_t kDefaultMaxProgramCacheMemoryBytes = 6 * 1024 * 1024; | 67 const size_t kDefaultMaxProgramCacheMemoryBytes = 6 * 1024 * 1024; |
57 | 68 |
58 } // namespace gpu | 69 } // namespace gpu |
59 | 70 |
60 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ | 71 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ |
OLD | NEW |