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

Side by Side Diff: gpu/command_buffer/service/common_decoder.h

Issue 9581018: GPU: Build most of the gpu as a single DLL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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_SERVICE_COMMON_DECODER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <stack> 9 #include <stack>
10 #include <string> 10 #include <string>
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "gpu/command_buffer/service/cmd_parser.h" 13 #include "gpu/command_buffer/service/cmd_parser.h"
14 #include "gpu/gpu_export.h"
14 15
15 namespace gpu { 16 namespace gpu {
16 17
17 class CommandBufferEngine; 18 class CommandBufferEngine;
18 19
19 // This class is a helper base class for implementing the common parts of the 20 // This class is a helper base class for implementing the common parts of the
20 // o3d/gl2 command buffer decoder. 21 // o3d/gl2 command buffer decoder.
21 class CommonDecoder : public AsyncAPIInterface { 22 class GPU_EXPORT CommonDecoder : NON_EXPORTED_BASE(public AsyncAPIInterface) {
22 public: 23 public:
23 typedef error::Error Error; 24 typedef error::Error Error;
24 25
25 static const unsigned int kMaxStackDepth = 32; 26 static const unsigned int kMaxStackDepth = 32;
26 27
27 // A bucket is a buffer to help collect memory across a command buffer. When 28 // A bucket is a buffer to help collect memory across a command buffer. When
28 // creating a command buffer implementation of an existing API, sometimes that 29 // creating a command buffer implementation of an existing API, sometimes that
29 // API has functions that take a pointer to data. A good example is OpenGL's 30 // API has functions that take a pointer to data. A good example is OpenGL's
30 // glBufferData. Because the data is separated between client and service, 31 // glBufferData. Because the data is separated between client and service,
31 // there are 2 ways to get this data across. 1 is to put all the data in 32 // there are 2 ways to get this data across. 1 is to put all the data in
32 // shared memory. The problem with this is the data can be arbitarily large 33 // shared memory. The problem with this is the data can be arbitarily large
33 // and the host OS may not support that much shared memory. Another solution 34 // and the host OS may not support that much shared memory. Another solution
34 // is to shuffle memory across a little bit at a time, collecting it on the 35 // is to shuffle memory across a little bit at a time, collecting it on the
35 // service side and when it is all there then call glBufferData. Buckets 36 // service side and when it is all there then call glBufferData. Buckets
36 // implement this second solution. Using the common commands, SetBucketSize, 37 // implement this second solution. Using the common commands, SetBucketSize,
37 // SetBucketData, SetBucketDataImmediate the client can fill a bucket. It can 38 // SetBucketData, SetBucketDataImmediate the client can fill a bucket. It can
38 // then call a command that uses that bucket (like BufferDataBucket in the 39 // then call a command that uses that bucket (like BufferDataBucket in the
39 // GLES2 command buffer implementation). 40 // GLES2 command buffer implementation).
40 // 41 //
41 // If you are designing an API from scratch you can avoid this need for 42 // If you are designing an API from scratch you can avoid this need for
42 // Buckets by making your API always take an offset and a size 43 // Buckets by making your API always take an offset and a size
43 // similar to glBufferSubData. 44 // similar to glBufferSubData.
44 // 45 //
45 // Buckets also help pass strings to/from the service. To return a string of 46 // Buckets also help pass strings to/from the service. To return a string of
46 // arbitary size, the service puts the string in a bucket. The client can 47 // arbitary size, the service puts the string in a bucket. The client can
47 // then query the size of a bucket and request sections of the bucket to 48 // then query the size of a bucket and request sections of the bucket to
48 // be passed across shared memory. 49 // be passed across shared memory.
49 class Bucket { 50 class GPU_EXPORT Bucket {
50 public: 51 public:
51 Bucket(); 52 Bucket();
52 ~Bucket(); 53 ~Bucket();
53 54
54 size_t size() const { 55 size_t size() const {
55 return size_; 56 return size_;
56 } 57 }
57 58
58 // Gets a pointer to a section the bucket. Returns NULL if offset or size is 59 // Gets a pointer to a section the bucket. Returns NULL if offset or size is
59 // out of range. 60 // out of range.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 174
174 uint32 offset; 175 uint32 offset;
175 }; 176 };
176 std::stack<CommandAddress> call_stack_; 177 std::stack<CommandAddress> call_stack_;
177 }; 178 };
178 179
179 } // namespace gpu 180 } // namespace gpu
180 181
181 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ 182 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_
182 183
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/context_group.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698