| Index: gpu/command_buffer/service/texture_definition.h
|
| diff --git a/gpu/command_buffer/service/texture_definition.h b/gpu/command_buffer/service/texture_definition.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bdbeaf4181f1bdd9bfdcde73d771dc9dac12e454
|
| --- /dev/null
|
| +++ b/gpu/command_buffer/service/texture_definition.h
|
| @@ -0,0 +1,107 @@
|
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
|
| +#define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
|
| +
|
| +#include <vector>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "gpu/command_buffer/service/gl_utils.h"
|
| +
|
| +namespace gfx {
|
| +class GLFence;
|
| +}
|
| +
|
| +namespace gpu {
|
| +namespace gles2 {
|
| +
|
| +class Texture;
|
| +
|
| +class SharedGLFence : public base::RefCountedThreadSafe<SharedGLFence> {
|
| + public:
|
| + SharedGLFence();
|
| + void GpuWaitSync() const;
|
| +
|
| + private:
|
| + friend class base::RefCountedThreadSafe<SharedGLFence>;
|
| + virtual ~SharedGLFence();
|
| +
|
| + scoped_ptr<gfx::GLFence> fence_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SharedGLFence);
|
| +};
|
| +
|
| +class NativeImageBuffer : public base::RefCountedThreadSafe<NativeImageBuffer> {
|
| + public:
|
| + static NativeImageBuffer* Create(GLuint texture_id);
|
| + virtual void BindToTexture(GLenum target) = 0;
|
| +
|
| + protected:
|
| + friend class base::RefCountedThreadSafe<NativeImageBuffer>;
|
| + NativeImageBuffer() {}
|
| + virtual ~NativeImageBuffer() {}
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NativeImageBuffer);
|
| +};
|
| +
|
| +// An immutable description that can be used to create a texture that shares
|
| +// the underlying image buffer(s).
|
| +class TextureDefinition {
|
| + public:
|
| + TextureDefinition(GLenum target,
|
| + Texture* texture,
|
| + NativeImageBuffer* image,
|
| + const scoped_refptr<SharedGLFence>& fence);
|
| + virtual ~TextureDefinition();
|
| +
|
| + Texture* CreateTexture() const;
|
| + void UpdateTexture(Texture* texture) const;
|
| +
|
| + scoped_refptr<NativeImageBuffer> image() { return image_; }
|
| +
|
| + private:
|
| + struct LevelInfo {
|
| + LevelInfo(GLenum target,
|
| + GLenum internal_format,
|
| + GLsizei width,
|
| + GLsizei height,
|
| + GLsizei depth,
|
| + GLint border,
|
| + GLenum format,
|
| + GLenum type,
|
| + bool cleared);
|
| + ~LevelInfo();
|
| +
|
| + GLenum target;
|
| + GLenum internal_format;
|
| + GLsizei width;
|
| + GLsizei height;
|
| + GLsizei depth;
|
| + GLint border;
|
| + GLenum format;
|
| + GLenum type;
|
| + bool cleared;
|
| + };
|
| +
|
| + typedef std::vector<std::vector<LevelInfo> > LevelInfos;
|
| +
|
| + GLenum target_;
|
| + scoped_refptr<NativeImageBuffer> image_;
|
| + scoped_refptr<SharedGLFence> fence_;
|
| + GLenum min_filter_;
|
| + GLenum mag_filter_;
|
| + GLenum wrap_s_;
|
| + GLenum wrap_t_;
|
| + GLenum usage_;
|
| + bool immutable_;
|
| + LevelInfos level_infos_;
|
| +};
|
| +
|
| +} // namespage gles2
|
| +} // namespace gpu
|
| +
|
| +#endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
|
|
|