| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TEXTURE_DEFINITION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 NativeImageBuffer() {} | 33 NativeImageBuffer() {} |
| 34 virtual ~NativeImageBuffer() {} | 34 virtual ~NativeImageBuffer() {} |
| 35 | 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(NativeImageBuffer); | 36 DISALLOW_COPY_AND_ASSIGN(NativeImageBuffer); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // An immutable description that can be used to create a texture that shares | 39 // An immutable description that can be used to create a texture that shares |
| 40 // the underlying image buffer(s). | 40 // the underlying image buffer(s). |
| 41 class TextureDefinition { | 41 class TextureDefinition { |
| 42 public: | 42 public: |
| 43 static void AvoidEGLTargetTextureReuse(); |
| 44 |
| 43 TextureDefinition(); | 45 TextureDefinition(); |
| 44 TextureDefinition(Texture* texture, | 46 TextureDefinition(Texture* texture, |
| 45 unsigned int version, | 47 unsigned int version, |
| 46 const scoped_refptr<NativeImageBuffer>& image); | 48 const scoped_refptr<NativeImageBuffer>& image); |
| 47 virtual ~TextureDefinition(); | 49 virtual ~TextureDefinition(); |
| 48 | 50 |
| 49 Texture* CreateTexture() const; | 51 Texture* CreateTexture() const; |
| 50 void UpdateTexture(Texture* texture) const; | 52 void UpdateTexture(Texture* texture) const; |
| 51 | 53 |
| 52 unsigned int version() const { return version_; } | 54 unsigned int version() const { return version_; } |
| 53 bool IsOlderThan(unsigned int version) const { | 55 bool IsOlderThan(unsigned int version) const { |
| 54 return (version - version_) < 0x80000000; | 56 return (version - version_) < 0x80000000; |
| 55 } | 57 } |
| 56 bool Matches(const Texture* texture) const; | 58 bool Matches(const Texture* texture) const; |
| 57 | 59 |
| 58 scoped_refptr<NativeImageBuffer> image() const { return image_buffer_; } | 60 scoped_refptr<NativeImageBuffer> image() const { return image_buffer_; } |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 bool SafeToRenderFrom() const; | 63 bool SafeToRenderFrom() const; |
| 64 void UpdateTextureInternal(Texture* texture) const; |
| 62 | 65 |
| 63 struct LevelInfo { | 66 struct LevelInfo { |
| 64 LevelInfo(); | 67 LevelInfo(); |
| 65 LevelInfo(GLenum target, | 68 LevelInfo(GLenum target, |
| 66 GLenum internal_format, | 69 GLenum internal_format, |
| 67 GLsizei width, | 70 GLsizei width, |
| 68 GLsizei height, | 71 GLsizei height, |
| 69 GLsizei depth, | 72 GLsizei depth, |
| 70 GLint border, | 73 GLint border, |
| 71 GLenum format, | 74 GLenum format, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 96 bool defined_; | 99 bool defined_; |
| 97 | 100 |
| 98 // Only support textures with one face and one level. | 101 // Only support textures with one face and one level. |
| 99 LevelInfo level_info_; | 102 LevelInfo level_info_; |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespage gles2 | 105 } // namespage gles2 |
| 103 } // namespace gpu | 106 } // namespace gpu |
| 104 | 107 |
| 105 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | 108 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ |
| OLD | NEW |