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 #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 "../common/types.h" | 8 #include "../common/types.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
11 | 11 |
12 typedef int32 CommandBufferOffset; | 12 typedef int32 CommandBufferOffset; |
13 const CommandBufferOffset kInvalidCommandBufferOffset = -1; | 13 const CommandBufferOffset kInvalidCommandBufferOffset = -1; |
14 | 14 |
15 // This enum must stay in sync with NPDeviceContext3DError. | 15 // This enum must stay in sync with NPDeviceContext3DError. |
16 namespace error { | 16 namespace error { |
17 enum Error { | 17 enum Error { |
18 kNoError, | 18 kNoError, |
19 kInvalidSize, | 19 kInvalidSize, |
20 kOutOfBounds, | 20 kOutOfBounds, |
21 kUnknownCommand, | 21 kUnknownCommand, |
22 kInvalidArguments, | 22 kInvalidArguments, |
23 kLostContext, | 23 kLostContext, |
24 kGenericError | 24 kGenericError, |
| 25 |
| 26 // This is not an error. It is returned by WaitLatch when it is blocked. |
| 27 // When blocked, the context will not reschedule itself until another |
| 28 // context executes a SetLatch command. |
| 29 kWaiting, |
| 30 |
| 31 // This is not an error either. It just hints the scheduler that it can exit |
| 32 // its loop, update state, and schedule other command buffers. |
| 33 kYield |
25 }; | 34 }; |
26 | 35 |
27 // Return true if the given error code is an actual error. | 36 // Return true if the given error code is an actual error. |
28 inline bool IsError(Error error) { | 37 inline bool IsError(Error error) { |
29 return error != kNoError; | 38 switch (error) { |
| 39 case kNoError: |
| 40 case kWaiting: |
| 41 case kYield: |
| 42 return false; |
| 43 default: |
| 44 return true; |
| 45 } |
30 } | 46 } |
31 | 47 |
32 // Provides finer grained information about why the context was lost. | 48 // Provides finer grained information about why the context was lost. |
33 enum ContextLostReason { | 49 enum ContextLostReason { |
34 // This context definitely provoked the loss of context. | 50 // This context definitely provoked the loss of context. |
35 kGuilty, | 51 kGuilty, |
36 | 52 |
37 // This context definitely did not provoke the loss of context. | 53 // This context definitely did not provoke the loss of context. |
38 kInnocent, | 54 kInnocent, |
39 | 55 |
(...skipping 11 matching lines...) Expand all Loading... |
51 | 67 |
52 // Common Latch shared memory transfer buffer ID. | 68 // Common Latch shared memory transfer buffer ID. |
53 const int32 kLatchSharedMemoryId = 5; | 69 const int32 kLatchSharedMemoryId = 5; |
54 | 70 |
55 // Invalid latch ID. | 71 // Invalid latch ID. |
56 const uint32 kInvalidLatchId = 0xffffffffu; | 72 const uint32 kInvalidLatchId = 0xffffffffu; |
57 | 73 |
58 } // namespace gpu | 74 } // namespace gpu |
59 | 75 |
60 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ | 76 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ |
OLD | NEW |