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 | |
34 }; | 25 }; |
35 | 26 |
36 // Return true if the given error code is an actual error. | 27 // Return true if the given error code is an actual error. |
37 inline bool IsError(Error error) { | 28 inline bool IsError(Error error) { |
38 switch (error) { | 29 return error != kNoError; |
39 case kNoError: | |
40 case kWaiting: | |
41 case kYield: | |
42 return false; | |
43 default: | |
44 return true; | |
45 } | |
46 } | 30 } |
47 } | 31 } |
48 | 32 |
49 // Invalid shared memory Id, returned by RegisterSharedMemory in case of | 33 // Invalid shared memory Id, returned by RegisterSharedMemory in case of |
50 // failure. | 34 // failure. |
51 const int32 kInvalidSharedMemoryId = -1; | 35 const int32 kInvalidSharedMemoryId = -1; |
52 | 36 |
53 // Common Command Buffer shared memory transfer buffer ID. | 37 // Common Command Buffer shared memory transfer buffer ID. |
54 const int32 kCommandBufferSharedMemoryId = 4; | 38 const int32 kCommandBufferSharedMemoryId = 4; |
55 | 39 |
56 // Common Latch shared memory transfer buffer ID. | 40 // Common Latch shared memory transfer buffer ID. |
57 const int32 kLatchSharedMemoryId = 5; | 41 const int32 kLatchSharedMemoryId = 5; |
58 | 42 |
59 // Invalid latch ID. | 43 // Invalid latch ID. |
60 const uint32 kInvalidLatchId = 0xffffffffu; | 44 const uint32 kInvalidLatchId = 0xffffffffu; |
61 | 45 |
62 } // namespace gpu | 46 } // namespace gpu |
63 | 47 |
64 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ | 48 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ |
OLD | NEW |