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

Unified Diff: gpu/command_buffer/client/gles2_implementation.h

Issue 434063: Merged in recent changes to command buffer code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/gles2_demo_cc.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_implementation.h
===================================================================
--- gpu/command_buffer/client/gles2_implementation.h (revision 33021)
+++ gpu/command_buffer/client/gles2_implementation.h (working copy)
@@ -9,43 +9,11 @@
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/id_allocator.h"
+#include "gpu/command_buffer/client/fenced_allocator.h"
namespace command_buffer {
namespace gles2 {
-// A class to help with shared memory.
-class SharedMemoryHelper {
- public:
- SharedMemoryHelper(void* address, int id)
- : address_(address),
- id_(id) {
- }
-
- unsigned int GetOffset(void* address) const {
- return static_cast<int8*>(address) -
- static_cast<int8*>(address_);
- }
-
- void* GetAddress(unsigned int offset) const {
- return static_cast<int8*>(address_) + offset;
- }
-
- template <typename T>
- T GetAddressAs(unsigned int offset) const {
- return static_cast<T>(GetAddress(offset));
- }
-
- unsigned int GetId() const {
- return id_;
- }
-
- private:
- void* address_;
- int id_;
-
- DISALLOW_COPY_AND_ASSIGN(SharedMemoryHelper);
-};
-
// This class emulates GLES2 over command buffers. It can be used by a client
// program so that the program does not need deal with shared memory and command
// buffer management. See gl2_lib.h. Note that there is a performance gain to
@@ -56,8 +24,9 @@
public:
GLES2Implementation(
GLES2CmdHelper* helper,
+ size_t transfer_buffer_size,
void* transfer_buffer,
- int transfer_buffer_id); // TODO: add size.
+ int32 transfer_buffer_id);
// Include the auto-generated part of this class. We split this because
// it means we can easily edit the non-auto generated parts right here in
@@ -71,10 +40,35 @@
// Frees a set of Ids for glDelete___ functions.
void FreeIds(GLsizei n, const GLuint* ids);
+ // Gets the shared memory id for the result buffer.
+ uint32 result_shm_id() const {
+ return transfer_buffer_id_;
+ }
+
+ // Gets the shared memory offset for the result buffer.
+ uint32 result_shm_offset() const {
+ return result_shm_offset_;
+ }
+
+ // Gets the value of the result.
+ template <typename T>
+ T GetResultAs() const {
+ return *static_cast<T*>(result_buffer_);
+ }
+
+ // Waits for all commands to execute.
+ void WaitForCmd();
+
+ // The maxiumum result size from simple GL get commands.
+ static const size_t kMaxSizeOfSimpleResult = 4 * sizeof(uint32); // NOLINT.
+
GLES2Util util_;
GLES2CmdHelper* helper_;
IdAllocator id_allocator_;
- SharedMemoryHelper shared_memory_; // TODO(gman): rename transfer_buffer_.
+ FencedAllocatorWrapper transfer_buffer_;
+ int transfer_buffer_id_;
+ void* result_buffer_;
+ uint32 result_shm_offset_;
// pack alignment as last set by glPixelStorei
GLint pack_alignment_;
« no previous file with comments | « gpu/command_buffer/client/gles2_demo_cc.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698