| 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 0c74c4b85057e97ac057420b9503bb45c1bb9ec4..6286fd85293876e3d79ed12888da4ab52596656c 100644
|
| --- a/gpu/command_buffer/service/texture_manager.h
|
| +++ b/gpu/command_buffer/service/texture_manager.h
|
| @@ -181,6 +181,7 @@ class GPU_EXPORT Texture {
|
| // set by the GLStreamTextureImage.
|
| void SetLevelImage(GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| gl::GLImage* image,
|
| ImageState state);
|
|
|
| @@ -191,25 +192,31 @@ class GPU_EXPORT Texture {
|
| // SetStreamTextureServiceId() for the details of how |service_id| is used.
|
| void SetLevelStreamTextureImage(GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| GLStreamTextureImage* image,
|
| ImageState state,
|
| GLuint service_id);
|
|
|
| // Set the ImageState for the image bound to the given level.
|
| - void SetLevelImageState(GLenum target, GLint level, ImageState state);
|
| + void SetLevelImageState(GLenum target,
|
| + GLint level,
|
| + GLint layer,
|
| + ImageState state);
|
|
|
|
|
| // Get the image associated with a particular level. Returns NULL if level
|
| // does not exist.
|
| gl::GLImage* GetLevelImage(GLint target,
|
| GLint level,
|
| + GLint layer,
|
| ImageState* state) const;
|
| - gl::GLImage* GetLevelImage(GLint target, GLint level) const;
|
| + gl::GLImage* GetLevelImage(GLint target, GLint level, GLint layer) const;
|
|
|
| // Like GetLevelImage, but will return NULL if the image wasn't set via
|
| // a call to SetLevelStreamTextureImage.
|
| GLStreamTextureImage* GetLevelStreamTextureImage(GLint target,
|
| - GLint level) const;
|
| + GLint level,
|
| + GLint layer) const;
|
|
|
| bool HasImages() const {
|
| return has_images_;
|
| @@ -257,12 +264,25 @@ class GPU_EXPORT Texture {
|
|
|
| // Get the cleared rectangle for a particular level. Returns an empty
|
| // rectangle if level does not exist.
|
| - gfx::Rect GetLevelClearedRect(GLenum target, GLint level) const;
|
| + gfx::Rect GetLevelClearedRect(GLenum target, GLint level, GLint layer) const;
|
| + // TODO(yunchao) Wrap the original GetLevelClearedRect on the basis of
|
| + // GetLayerClearedRect. The origianl GetLevelClearedRect for 2D texture
|
| + // Will be not aware of parameter layer.
|
| + // Do the same for SetLevelClearedRect, isLevelCleared, etc.
|
| + // gfx::Rect GetLevelClearedRect(GLenum target, GLint level) const {
|
| + // GetLayerClearedRect(target, level, 0);
|
| + // }
|
| + //
|
| + // gfx::Rect GetLayerClearedRect(GLenum target,
|
| + // GLint level,
|
| + // GLint layer) const;
|
|
|
| // Whether a particular level/face is cleared.
|
| - bool IsLevelCleared(GLenum target, GLint level) const;
|
| + bool IsLevelCleared(GLenum target, GLint level, GLint layer) const;
|
| // Whether a particular level/face is partially cleared.
|
| - bool IsLevelPartiallyCleared(GLenum target, GLint level) const;
|
| + bool IsLevelPartiallyCleared(GLenum target,
|
| + GLint level,
|
| + GLint layer) const;
|
|
|
| // Whether the texture has been defined
|
| bool IsDefined() const {
|
| @@ -306,12 +326,24 @@ class GPU_EXPORT Texture {
|
| CAN_RENDER_NEEDS_VALIDATION,
|
| };
|
|
|
| + struct LayerInfo {
|
| + LayerInfo();
|
| + LayerInfo(const LayerInfo& rhs);
|
| + ~LayerInfo();
|
| +
|
| + gfx::Rect cleared_rect;
|
| + scoped_refptr<gl::GLImage> image;
|
| + scoped_refptr<GLStreamTextureImage> stream_texture_image;
|
| + ImageState image_state;
|
| + // This variable may be not useful;
|
| + GLint layer;
|
| + };
|
| +
|
| struct LevelInfo {
|
| LevelInfo();
|
| LevelInfo(const LevelInfo& rhs);
|
| ~LevelInfo();
|
|
|
| - gfx::Rect cleared_rect;
|
| GLenum target;
|
| GLint level;
|
| GLenum internal_format;
|
| @@ -321,11 +353,11 @@ class GPU_EXPORT Texture {
|
| GLint border;
|
| GLenum format;
|
| GLenum type;
|
| - scoped_refptr<gl::GLImage> image;
|
| - scoped_refptr<GLStreamTextureImage> stream_texture_image;
|
| - ImageState image_state;
|
| uint32_t estimated_size;
|
| bool internal_workaround;
|
| + int num_uncleared_layers;
|
| +
|
| + std::vector<LayerInfo> layer_infos;
|
| };
|
|
|
| struct FaceInfo {
|
| @@ -342,6 +374,7 @@ class GPU_EXPORT Texture {
|
| // Helper for SetLevel*Image. |stream_texture_image| may be null.
|
| void SetLevelImageInternal(GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| gl::GLImage* image,
|
| GLStreamTextureImage* stream_texture_image,
|
| ImageState state);
|
| @@ -390,10 +423,11 @@ class GPU_EXPORT Texture {
|
| // Marks a |rect| of a particular level as cleared.
|
| void SetLevelClearedRect(GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| const gfx::Rect& cleared_rect);
|
|
|
| // Marks a particular level as cleared or uncleared.
|
| - void SetLevelCleared(GLenum target, GLint level, bool cleared);
|
| + void SetLevelCleared(GLenum target, GLint level, GLint layer, bool cleared);
|
|
|
| // Updates the cleared flag for this texture by inspecting all the mips.
|
| void UpdateCleared();
|
| @@ -404,7 +438,10 @@ class GPU_EXPORT Texture {
|
|
|
| // Clears the level.
|
| // Returns false if a GL error was generated.
|
| - bool ClearLevel(GLES2Decoder* decoder, GLenum target, GLint level);
|
| + bool ClearLevel(GLES2Decoder* decoder,
|
| + GLenum target,
|
| + GLint level,
|
| + GLint layer);
|
|
|
| // Sets a texture parameter.
|
| // TODO(gman): Expand to SetParameteriv,fv
|
| @@ -470,7 +507,7 @@ class GPU_EXPORT Texture {
|
| // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB
|
| // GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3)
|
| // max_levels: The maximum levels this type of target can have.
|
| - void SetTarget(GLenum target, GLint max_levels);
|
| + void SetTarget(GLenum target, GLint max_levels, GLint layers);
|
|
|
| // Update info about this texture.
|
| void Update();
|
| @@ -478,7 +515,7 @@ class GPU_EXPORT Texture {
|
| // Appends a signature for the given level.
|
| void AddToSignature(
|
| const FeatureInfo* feature_info,
|
| - GLenum target, GLint level, std::string* signature) const;
|
| + GLenum target, GLint level, GLint layer, std::string* signature) const;
|
|
|
| void SetMailboxManager(MailboxManager* mailbox_manager);
|
|
|
| @@ -486,12 +523,15 @@ class GPU_EXPORT Texture {
|
| // texture.
|
| void UpdateSafeToRenderFrom(bool cleared);
|
|
|
| + void UpdateMipClearedHelper(LevelInfo* info);
|
| +
|
| // Updates the uncleared mip count in all the managers referencing this
|
| // texture.
|
| void UpdateMipCleared(LevelInfo* info,
|
| GLsizei width,
|
| GLsizei height,
|
| - const gfx::Rect& cleared_rect);
|
| + const gfx::Rect& cleared_rect,
|
| + GLint layer);
|
|
|
| // Computes the CanRenderCondition flag.
|
| CanRenderCondition GetCanRenderCondition() const;
|
| @@ -776,6 +816,10 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| }
|
| }
|
|
|
| + GLsizei max_3d_texture_size() const {
|
| + return max_3d_texture_size_;
|
| + }
|
| +
|
| GLsizei max_array_texture_layers() const {
|
| return max_array_texture_layers_;
|
| }
|
| @@ -842,11 +886,12 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| void SetLevelClearedRect(TextureRef* ref,
|
| GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| const gfx::Rect& cleared_rect);
|
|
|
| // Sets a mip as cleared.
|
| void SetLevelCleared(TextureRef* ref, GLenum target,
|
| - GLint level, bool cleared);
|
| + GLint level, GLint layer, bool cleared);
|
|
|
| // Sets a texture parameter of a Texture
|
| // Returns GL_NO_ERROR on success. Otherwise the error to generate.
|
| @@ -940,12 +985,14 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| void SetLevelImage(TextureRef* ref,
|
| GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| gl::GLImage* image,
|
| Texture::ImageState state);
|
|
|
| void SetLevelStreamTextureImage(TextureRef* ref,
|
| GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| GLStreamTextureImage* image,
|
| Texture::ImageState state,
|
| GLuint service_id);
|
| @@ -953,6 +1000,7 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| void SetLevelImageState(TextureRef* ref,
|
| GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| Texture::ImageState state);
|
|
|
| size_t GetSignatureSize() const;
|
| @@ -961,6 +1009,7 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| TextureRef* ref,
|
| GLenum target,
|
| GLint level,
|
| + GLint layer,
|
| std::string* signature) const;
|
|
|
| void AddObserver(DestructionObserver* observer) {
|
|
|