| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 // constructor. | 653 // constructor. |
| 654 explicit DecoderTextureState(const GpuDriverBugWorkarounds& workarounds) | 654 explicit DecoderTextureState(const GpuDriverBugWorkarounds& workarounds) |
| 655 : tex_image_failed(false), | 655 : tex_image_failed(false), |
| 656 texture_upload_count(0), | 656 texture_upload_count(0), |
| 657 texsubimage_faster_than_teximage( | 657 texsubimage_faster_than_teximage( |
| 658 workarounds.texsubimage_faster_than_teximage), | 658 workarounds.texsubimage_faster_than_teximage), |
| 659 force_cube_map_positive_x_allocation( | 659 force_cube_map_positive_x_allocation( |
| 660 workarounds.force_cube_map_positive_x_allocation), | 660 workarounds.force_cube_map_positive_x_allocation), |
| 661 force_cube_complete(workarounds.force_cube_complete), | 661 force_cube_complete(workarounds.force_cube_complete), |
| 662 unpack_alignment_workaround_with_unpack_buffer( | 662 unpack_alignment_workaround_with_unpack_buffer( |
| 663 workarounds.unpack_alignment_workaround_with_unpack_buffer) {} | 663 workarounds.unpack_alignment_workaround_with_unpack_buffer), |
| 664 unpack_overlapping_rows_separately_unpack_buffer( |
| 665 workarounds.unpack_overlapping_rows_separately_unpack_buffer) {} |
| 664 | 666 |
| 665 // This indicates all the following texSubImage*D calls that are part of the | 667 // This indicates all the following texSubImage*D calls that are part of the |
| 666 // failed texImage*D call should be ignored. The client calls have a lock | 668 // failed texImage*D call should be ignored. The client calls have a lock |
| 667 // around them, so it will affect only a single texImage*D + texSubImage*D | 669 // around them, so it will affect only a single texImage*D + texSubImage*D |
| 668 // group. | 670 // group. |
| 669 bool tex_image_failed; | 671 bool tex_image_failed; |
| 670 | 672 |
| 671 // Command buffer stats. | 673 // Command buffer stats. |
| 672 int texture_upload_count; | 674 int texture_upload_count; |
| 673 base::TimeDelta total_texture_upload_time; | 675 base::TimeDelta total_texture_upload_time; |
| 674 | 676 |
| 675 bool texsubimage_faster_than_teximage; | 677 bool texsubimage_faster_than_teximage; |
| 676 bool force_cube_map_positive_x_allocation; | 678 bool force_cube_map_positive_x_allocation; |
| 677 bool force_cube_complete; | 679 bool force_cube_complete; |
| 678 bool unpack_alignment_workaround_with_unpack_buffer; | 680 bool unpack_alignment_workaround_with_unpack_buffer; |
| 681 bool unpack_overlapping_rows_separately_unpack_buffer; |
| 679 }; | 682 }; |
| 680 | 683 |
| 681 // This class keeps track of the textures and their sizes so we can do NPOT and | 684 // This class keeps track of the textures and their sizes so we can do NPOT and |
| 682 // texture complete checking. | 685 // texture complete checking. |
| 683 // | 686 // |
| 684 // NOTE: To support shared resources an instance of this class will need to be | 687 // NOTE: To support shared resources an instance of this class will need to be |
| 685 // shared by multiple GLES2Decoders. | 688 // shared by multiple GLES2Decoders. |
| 686 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { | 689 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { |
| 687 public: | 690 public: |
| 688 class GPU_EXPORT DestructionObserver { | 691 class GPU_EXPORT DestructionObserver { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 GLuint* black_texture); | 1077 GLuint* black_texture); |
| 1075 | 1078 |
| 1076 void DoTexImage( | 1079 void DoTexImage( |
| 1077 DecoderTextureState* texture_state, | 1080 DecoderTextureState* texture_state, |
| 1078 ContextState* state, | 1081 ContextState* state, |
| 1079 DecoderFramebufferState* framebuffer_state, | 1082 DecoderFramebufferState* framebuffer_state, |
| 1080 const char* function_name, | 1083 const char* function_name, |
| 1081 TextureRef* texture_ref, | 1084 TextureRef* texture_ref, |
| 1082 const DoTexImageArguments& args); | 1085 const DoTexImageArguments& args); |
| 1083 | 1086 |
| 1087 // Reserve memory for the texture and set its attributes so it can be filled |
| 1088 // with TexSubImage. The image contents are undefined after this function, |
| 1089 // so make sure it's subsequently filled in its entirety. |
| 1090 void ReserveTexImageToBeFilled(DecoderTextureState* texture_state, |
| 1091 ContextState* state, |
| 1092 DecoderFramebufferState* framebuffer_state, |
| 1093 const char* function_name, |
| 1094 TextureRef* texture_ref, |
| 1095 const DoTexImageArguments& args); |
| 1096 |
| 1084 void DoTexSubImageWithAlignmentWorkaround( | 1097 void DoTexSubImageWithAlignmentWorkaround( |
| 1085 DecoderTextureState* texture_state, | 1098 DecoderTextureState* texture_state, |
| 1086 ContextState* state, | 1099 ContextState* state, |
| 1087 const DoTexSubImageArguments& args); | 1100 const DoTexSubImageArguments& args); |
| 1088 | 1101 |
| 1102 void DoTexSubImageRowByRowWorkaround(DecoderTextureState* texture_state, |
| 1103 ContextState* state, |
| 1104 const DoTexSubImageArguments& args, |
| 1105 const PixelStoreParams& unpack_params); |
| 1106 |
| 1089 void StartTracking(TextureRef* texture); | 1107 void StartTracking(TextureRef* texture); |
| 1090 void StopTracking(TextureRef* texture); | 1108 void StopTracking(TextureRef* texture); |
| 1091 | 1109 |
| 1092 void UpdateSafeToRenderFrom(int delta); | 1110 void UpdateSafeToRenderFrom(int delta); |
| 1093 void UpdateUnclearedMips(int delta); | 1111 void UpdateUnclearedMips(int delta); |
| 1094 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition, | 1112 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition, |
| 1095 Texture::CanRenderCondition new_condition); | 1113 Texture::CanRenderCondition new_condition); |
| 1096 void UpdateNumImages(int delta); | 1114 void UpdateNumImages(int delta); |
| 1097 void IncFramebufferStateChangeCount(); | 1115 void IncFramebufferStateChangeCount(); |
| 1098 | 1116 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 private: | 1175 private: |
| 1158 DecoderTextureState* texture_state_; | 1176 DecoderTextureState* texture_state_; |
| 1159 base::TimeTicks begin_time_; | 1177 base::TimeTicks begin_time_; |
| 1160 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1178 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 1161 }; | 1179 }; |
| 1162 | 1180 |
| 1163 } // namespace gles2 | 1181 } // namespace gles2 |
| 1164 } // namespace gpu | 1182 } // namespace gpu |
| 1165 | 1183 |
| 1166 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1184 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |