| 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 // Provides finer grained information about why the context was lost. | 32 // Provides finer grained information about why the context was lost. |
| 49 enum ContextLostReason { | 33 enum ContextLostReason { |
| 50 // This context definitely provoked the loss of context. | 34 // This context definitely provoked the loss of context. |
| 51 kGuilty, | 35 kGuilty, |
| 52 | 36 |
| 53 // This context definitely did not provoke the loss of context. | 37 // This context definitely did not provoke the loss of context. |
| 54 kInnocent, | 38 kInnocent, |
| 55 | 39 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 | 51 |
| 68 // Common Latch shared memory transfer buffer ID. | 52 // Common Latch shared memory transfer buffer ID. |
| 69 const int32 kLatchSharedMemoryId = 5; | 53 const int32 kLatchSharedMemoryId = 5; |
| 70 | 54 |
| 71 // Invalid latch ID. | 55 // Invalid latch ID. |
| 72 const uint32 kInvalidLatchId = 0xffffffffu; | 56 const uint32 kInvalidLatchId = 0xffffffffu; |
| 73 | 57 |
| 74 } // namespace gpu | 58 } // namespace gpu |
| 75 | 59 |
| 76 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ | 60 #endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_ |
| OLD | NEW |