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

Unified Diff: gpu/command_buffer/service/texture_manager.h

Issue 11428140: gpu: Add async pixel transfer interface, stub and tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address Feedback. Created 8 years 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/service/query_manager.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_manager.h
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index dc1cd7f3bff7866958977aade630604219f0b04d..f0f5b6ad8ffebf70fc0ff79220aca4f7fb8f82fd 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -5,6 +5,7 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
#define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
+#include <list>
#include <string>
#include <vector>
#include "base/basictypes.h"
@@ -15,6 +16,7 @@
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/gpu_export.h"
+#include "ui/gl/async_pixel_transfer_delegate.h"
#include "ui/gl/gl_image.h"
namespace gpu {
@@ -178,6 +180,17 @@ class GPU_EXPORT TextureManager {
return stream_texture_;
}
+ gfx::AsyncPixelTransferState* GetAsyncTransferState() const {
+ return async_transfer_state_.get();
+ }
+ void SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState> state) {
+ async_transfer_state_ = state.Pass();
+ }
+ bool AsyncTransferIsInProgress() {
+ return async_transfer_state_ &&
+ async_transfer_state_->TransferIsInProgress();
+ }
+
void SetImmutable(bool immutable) {
immutable_ = immutable;
}
@@ -189,6 +202,11 @@ class GPU_EXPORT TextureManager {
// Whether a particular level/face is cleared.
bool IsLevelCleared(GLenum target, GLint level);
+ // Whether the texture has been defined
+ bool IsDefined() {
+ return estimated_size() > 0;
+ }
+
private:
friend class TextureManager;
friend class base::RefCounted<TextureInfo>;
@@ -341,6 +359,9 @@ class GPU_EXPORT TextureManager {
// Whether this is a special streaming texture.
bool stream_texture_;
+ // State to facilitate async transfers on this texture.
+ scoped_ptr<gfx::AsyncPixelTransferState> async_transfer_state_;
+
// Whether the texture is immutable and no further changes to the format
// or dimensions of the texture object can be made.
bool immutable_;
@@ -530,6 +551,13 @@ class GPU_EXPORT TextureManager {
GLint level,
std::string* signature) const;
+ // Transfers added will get their TextureInfo updated at the same time
+ // the async transfer is bound to the real texture.
+ void AddPendingAsyncPixelTransfer(
+ base::WeakPtr<gfx::AsyncPixelTransferState> state, TextureInfo* info);
+ void BindFinishedAsyncPixelTransfers(bool* texture_dirty,
+ bool* framebuffer_dirty);
+
private:
// Helper for Initialize().
TextureInfo::Ref CreateDefaultAndBlackTextures(
@@ -572,6 +600,14 @@ class GPU_EXPORT TextureManager {
// The default textures for each target (texture name = 0)
TextureInfo::Ref default_textures_[kNumDefaultTextures];
+ // Async texture allocations which haven't been bound to their textures
+ // yet. This facilitates updating the TextureInfo at the same time the
+ // real texture data is bound.
+ typedef std::pair<base::WeakPtr<gfx::AsyncPixelTransferState>,
+ TextureInfo*> PendingAsyncTransfer;
+ typedef std::list<PendingAsyncTransfer> PendingAsyncTransferList;
+ PendingAsyncTransferList pending_async_transfers_;
+
DISALLOW_COPY_AND_ASSIGN(TextureManager);
};
« no previous file with comments | « gpu/command_buffer/service/query_manager.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698