- add sources.
[platform/framework/web/crosswalk.git] / src / gpu / command_buffer / common / constants.h
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
3 // found in the LICENSE file.
4
5 #ifndef GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_
6 #define GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_
7
8 #include "gpu/command_buffer/common/types.h"
9
10 namespace gpu {
11
12 typedef int32 CommandBufferOffset;
13 const CommandBufferOffset kInvalidCommandBufferOffset = -1;
14
15 // This enum must stay in sync with NPDeviceContext3DError.
16 namespace error {
17   enum Error {
18     kNoError,
19     kInvalidSize,
20     kOutOfBounds,
21     kUnknownCommand,
22     kInvalidArguments,
23     kLostContext,
24     kGenericError,
25     kDeferCommandUntilLater
26   };
27
28   // Return true if the given error code is an actual error.
29   inline bool IsError(Error error) {
30     return error != kNoError && error != kDeferCommandUntilLater;
31   }
32
33   // Provides finer grained information about why the context was lost.
34   enum ContextLostReason {
35     // This context definitely provoked the loss of context.
36     kGuilty,
37
38     // This context definitely did not provoke the loss of context.
39     kInnocent,
40
41     // It is unknown whether this context provoked the loss of context.
42     kUnknown
43   };
44 }
45
46 // Invalid shared memory Id, returned by RegisterSharedMemory in case of
47 // failure.
48 const int32 kInvalidSharedMemoryId = -1;
49
50 // Common Command Buffer shared memory transfer buffer ID.
51 const int32 kCommandBufferSharedMemoryId = 4;
52
53 // The size to set for the program cache.
54 const size_t kDefaultMaxProgramCacheMemoryBytes = 6 * 1024 * 1024;
55
56 }  // namespace gpu
57
58 #endif  // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_