Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: gpu/command_buffer/common/command_buffer.h

Issue 1345813002: Added a unique command buffer ID for command buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added gpu namespace for gles2_conform_support/egl/display.cc Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_COMMAND_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_
7 7
8 #include "base/logging.h"
8 #include "gpu/command_buffer/common/buffer.h" 9 #include "gpu/command_buffer/common/buffer.h"
9 #include "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
10 #include "gpu/gpu_export.h" 11 #include "gpu/gpu_export.h"
11 12
12 namespace base { 13 namespace base {
13 class SharedMemory; 14 class SharedMemory;
14 } 15 }
15 16
16 namespace gpu { 17 namespace gpu {
17 18
19 enum CommandBufferNamespace {
20 kCommandBufferNamespace_Invalid = -1,
21
22 kCommandBufferNamespace_GpuIO,
23 kCommandBufferNamespace_InProcess,
24
25 NUM_COMMAND_BUFFER_NAMESPACES
26 };
27
18 // Common interface for CommandBuffer implementations. 28 // Common interface for CommandBuffer implementations.
19 class GPU_EXPORT CommandBuffer { 29 class GPU_EXPORT CommandBuffer {
piman 2015/09/15 22:51:05 This is a virtual interface, it should not have me
David Yen 2015/09/15 23:09:03 Doesn't it makes sense to put it as part of the co
piman 2015/09/15 23:17:17 I'd strongly prefer CommandBuffer to only worry ab
David Yen 2015/09/16 00:02:50 Ok, I've moved it to GpuControl as you suggested.
20 public: 30 public:
21 struct State { 31 struct State {
22 State() 32 State()
23 : get_offset(0), 33 : get_offset(0),
24 token(-1), 34 token(-1),
25 error(error::kNoError), 35 error(error::kNoError),
26 context_lost_reason(error::kUnknown), 36 context_lost_reason(error::kUnknown),
27 generation(0) { 37 generation(0) {
28 } 38 }
29 39
(...skipping 19 matching lines...) Expand all
49 uint32 generation; 59 uint32 generation;
50 }; 60 };
51 61
52 struct ConsoleMessage { 62 struct ConsoleMessage {
53 // An user supplied id. 63 // An user supplied id.
54 int32 id; 64 int32 id;
55 // The message. 65 // The message.
56 std::string message; 66 std::string message;
57 }; 67 };
58 68
59 CommandBuffer() { 69 explicit CommandBuffer(CommandBufferNamespace namespace_id,
70 uint64_t command_buffer_id)
71 : namespace_id_(namespace_id),
72 command_buffer_id_(command_buffer_id) {
60 } 73 }
61 74
62 virtual ~CommandBuffer() { 75 virtual ~CommandBuffer() {
63 } 76 }
64 77
65 // Check if a value is between a start and end value, inclusive, allowing 78 // Check if a value is between a start and end value, inclusive, allowing
66 // for wrapping if start > end. 79 // for wrapping if start > end.
67 static bool InRange(int32 start, int32 end, int32 value) { 80 static bool InRange(int32 start, int32 end, int32 value) {
68 if (start <= end) 81 if (start <= end)
69 return start <= value && value <= end; 82 return start <= value && value <= end;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // GetLastError declared would mean we'd have to also define it, and pull more 132 // GetLastError declared would mean we'd have to also define it, and pull more
120 // of gpu in to the NaCl Win64 build. 133 // of gpu in to the NaCl Win64 build.
121 #if !defined(NACL_WIN64) 134 #if !defined(NACL_WIN64)
122 // TODO(apatrick): this is a temporary optimization while skia is calling 135 // TODO(apatrick): this is a temporary optimization while skia is calling
123 // RendererGLContext::MakeCurrent prior to every GL call. It saves returning 6 136 // RendererGLContext::MakeCurrent prior to every GL call. It saves returning 6
124 // ints redundantly when only the error is needed for the CommandBufferProxy 137 // ints redundantly when only the error is needed for the CommandBufferProxy
125 // implementation. 138 // implementation.
126 virtual error::Error GetLastError(); 139 virtual error::Error GetLastError();
127 #endif 140 #endif
128 141
142 // The namespace and command buffer ID forms a unique pair for all existing
143 // command buffers in a single process. Intermediate command buffers
144 // (such as CommandBufferService) should assign have an invalid namespace
145 // to signify that they should not be queried. Command Buffers that forward
146 // messages to other command buffers should identify as the command buffer
147 // which actually does the executions.
148 CommandBufferNamespace namespace_id() const {
149 DCHECK_NE(namespace_id_, kCommandBufferNamespace_Invalid);
150 return namespace_id_;
151 }
152
153 uint64_t command_buffer_id() const {
154 DCHECK_NE(namespace_id_, kCommandBufferNamespace_Invalid);
155 return command_buffer_id_;
156 }
157
129 private: 158 private:
159 const CommandBufferNamespace namespace_id_;
160 const uint64_t command_buffer_id_;
161
130 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); 162 DISALLOW_COPY_AND_ASSIGN(CommandBuffer);
131 }; 163 };
132 164
133 } // namespace gpu 165 } // namespace gpu
134 166
135 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ 167 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698