| 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 #include "gpu/command_buffer/service/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // are initialized in the constructor, it should never be modified later. | 265 // are initialized in the constructor, it should never be modified later. |
| 266 std::set<FormatType, FormatTypeCompare> supported_combinations_; | 266 std::set<FormatType, FormatTypeCompare> supported_combinations_; |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 static const Texture::CompatibilitySwizzle kSwizzledFormats[] = { | 269 static const Texture::CompatibilitySwizzle kSwizzledFormats[] = { |
| 270 {GL_ALPHA, GL_RED, GL_ZERO, GL_ZERO, GL_ZERO, GL_RED}, | 270 {GL_ALPHA, GL_RED, GL_ZERO, GL_ZERO, GL_ZERO, GL_RED}, |
| 271 {GL_LUMINANCE, GL_RED, GL_RED, GL_RED, GL_RED, GL_ONE}, | 271 {GL_LUMINANCE, GL_RED, GL_RED, GL_RED, GL_RED, GL_ONE}, |
| 272 {GL_LUMINANCE_ALPHA, GL_RG, GL_RED, GL_RED, GL_RED, GL_GREEN}, | 272 {GL_LUMINANCE_ALPHA, GL_RG, GL_RED, GL_RED, GL_RED, GL_GREEN}, |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 // static |
| 275 const Texture::CompatibilitySwizzle* GetCompatibilitySwizzle(GLenum format) { | 276 const Texture::CompatibilitySwizzle* GetCompatibilitySwizzle(GLenum format) { |
| 276 size_t count = arraysize(kSwizzledFormats); | 277 size_t count = arraysize(kSwizzledFormats); |
| 277 for (size_t i = 0; i < count; ++i) { | 278 for (size_t i = 0; i < count; ++i) { |
| 278 if (kSwizzledFormats[i].format == format) | 279 if (kSwizzledFormats[i].format == format) |
| 279 return &kSwizzledFormats[i]; | 280 return &kSwizzledFormats[i]; |
| 280 } | 281 } |
| 281 return nullptr; | 282 return nullptr; |
| 282 } | 283 } |
| 283 | 284 |
| 284 GLenum GetSwizzleForChannel(GLenum channel, | 285 GLenum GetSwizzleForChannel(GLenum channel, |
| (...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 if (full_image && !texture_state->texsubimage_faster_than_teximage && | 2669 if (full_image && !texture_state->texsubimage_faster_than_teximage && |
| 2669 !texture->IsImmutable() && !texture->HasImages()) { | 2670 !texture->IsImmutable() && !texture->HasImages()) { |
| 2670 ScopedTextureUploadTimer timer(texture_state); | 2671 ScopedTextureUploadTimer timer(texture_state); |
| 2671 GLenum internal_format; | 2672 GLenum internal_format; |
| 2672 GLenum tex_type; | 2673 GLenum tex_type; |
| 2673 texture->GetLevelType(args.target, args.level, &tex_type, &internal_format); | 2674 texture->GetLevelType(args.target, args.level, &tex_type, &internal_format); |
| 2674 // NOTE: In OpenGL ES 2/3 border is always zero. If that changes we'll need | 2675 // NOTE: In OpenGL ES 2/3 border is always zero. If that changes we'll need |
| 2675 // to look it up. | 2676 // to look it up. |
| 2676 if (args.command_type == DoTexSubImageArguments::kTexSubImage3D) { | 2677 if (args.command_type == DoTexSubImageArguments::kTexSubImage3D) { |
| 2677 glTexImage3D(args.target, args.level, internal_format, args.width, | 2678 glTexImage3D(args.target, args.level, internal_format, args.width, |
| 2678 args.height, args.depth, 0, AdjustTexFormat(args.format), | 2679 args.height, args.depth, 0, |
| 2679 args.type, args.pixels); | 2680 AdjustTexFormat(feature_info_.get(), args.format), args.type, |
| 2681 args.pixels); |
| 2680 } else { | 2682 } else { |
| 2681 glTexImage2D(args.target, args.level, | 2683 glTexImage2D( |
| 2682 AdjustTexInternalFormat(internal_format), args.width, | 2684 args.target, args.level, |
| 2683 args.height, 0, AdjustTexFormat(args.format), args.type, | 2685 AdjustTexInternalFormat(feature_info_.get(), internal_format), |
| 2684 args.pixels); | 2686 args.width, args.height, 0, |
| 2687 AdjustTexFormat(feature_info_.get(), args.format), args.type, |
| 2688 args.pixels); |
| 2685 } | 2689 } |
| 2686 } else { | 2690 } else { |
| 2687 ScopedTextureUploadTimer timer(texture_state); | 2691 ScopedTextureUploadTimer timer(texture_state); |
| 2688 if (args.command_type == DoTexSubImageArguments::kTexSubImage3D) { | 2692 if (args.command_type == DoTexSubImageArguments::kTexSubImage3D) { |
| 2689 glTexSubImage3D(args.target, args.level, args.xoffset, args.yoffset, | 2693 glTexSubImage3D(args.target, args.level, args.xoffset, args.yoffset, |
| 2690 args.zoffset, args.width, args.height, args.depth, | 2694 args.zoffset, args.width, args.height, args.depth, |
| 2691 AdjustTexFormat(args.format), args.type, args.pixels); | 2695 AdjustTexFormat(feature_info_.get(), args.format), |
| 2696 args.type, args.pixels); |
| 2692 } else { | 2697 } else { |
| 2693 glTexSubImage2D(args.target, args.level, args.xoffset, args.yoffset, | 2698 glTexSubImage2D(args.target, args.level, args.xoffset, args.yoffset, |
| 2694 args.width, args.height, AdjustTexFormat(args.format), | 2699 args.width, args.height, |
| 2700 AdjustTexFormat(feature_info_.get(), args.format), |
| 2695 args.type, args.pixels); | 2701 args.type, args.pixels); |
| 2696 } | 2702 } |
| 2697 } | 2703 } |
| 2698 } | 2704 } |
| 2699 | 2705 |
| 2700 void TextureManager::DoTexSubImageWithAlignmentWorkaround( | 2706 void TextureManager::DoTexSubImageWithAlignmentWorkaround( |
| 2701 DecoderTextureState* texture_state, | 2707 DecoderTextureState* texture_state, |
| 2702 ContextState* state, | 2708 ContextState* state, |
| 2703 const DoTexSubImageArguments& args) { | 2709 const DoTexSubImageArguments& args) { |
| 2704 DCHECK(state->bound_pixel_unpack_buffer.get()); | 2710 DCHECK(state->bound_pixel_unpack_buffer.get()); |
| 2705 DCHECK(args.width > 0 && args.height > 0 && args.depth > 0); | 2711 DCHECK(args.width > 0 && args.height > 0 && args.depth > 0); |
| 2706 | 2712 |
| 2707 ScopedTextureUploadTimer timer(texture_state); | 2713 ScopedTextureUploadTimer timer(texture_state); |
| 2708 uint32_t offset = ToGLuint(args.pixels); | 2714 uint32_t offset = ToGLuint(args.pixels); |
| 2709 if (args.command_type == DoTexSubImageArguments::kTexSubImage2D) { | 2715 if (args.command_type == DoTexSubImageArguments::kTexSubImage2D) { |
| 2710 PixelStoreParams params = state->GetUnpackParams(ContextState::k2D); | 2716 PixelStoreParams params = state->GetUnpackParams(ContextState::k2D); |
| 2711 if (args.height > 1) { | 2717 if (args.height > 1) { |
| 2712 glTexSubImage2D(args.target, args.level, args.xoffset, args.yoffset, | 2718 glTexSubImage2D(args.target, args.level, args.xoffset, args.yoffset, |
| 2713 args.width, args.height - 1, | 2719 args.width, args.height - 1, |
| 2714 AdjustTexFormat(args.format), args.type, args.pixels); | 2720 AdjustTexFormat(feature_info_.get(), args.format), |
| 2721 args.type, args.pixels); |
| 2715 GLint actual_width = state->unpack_row_length > 0 ? | 2722 GLint actual_width = state->unpack_row_length > 0 ? |
| 2716 state->unpack_row_length : args.width; | 2723 state->unpack_row_length : args.width; |
| 2717 uint32_t size; | 2724 uint32_t size; |
| 2718 uint32_t padding; | 2725 uint32_t padding; |
| 2719 // No need to worry about integer overflow here. | 2726 // No need to worry about integer overflow here. |
| 2720 GLES2Util::ComputeImageDataSizesES3(actual_width, args.height - 1, 1, | 2727 GLES2Util::ComputeImageDataSizesES3(actual_width, args.height - 1, 1, |
| 2721 args.format, args.type, | 2728 args.format, args.type, |
| 2722 params, | 2729 params, |
| 2723 &size, | 2730 &size, |
| 2724 nullptr, nullptr, nullptr, | 2731 nullptr, nullptr, nullptr, |
| 2725 &padding); | 2732 &padding); |
| 2726 DCHECK_EQ(args.padding, padding); | 2733 DCHECK_EQ(args.padding, padding); |
| 2727 // Last row should be padded, not unpadded. | 2734 // Last row should be padded, not unpadded. |
| 2728 offset += size + padding; | 2735 offset += size + padding; |
| 2729 } | 2736 } |
| 2730 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | 2737 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 2731 glTexSubImage2D(args.target, args.level, args.xoffset, | 2738 glTexSubImage2D(args.target, args.level, args.xoffset, |
| 2732 args.yoffset + args.height - 1, | 2739 args.yoffset + args.height - 1, args.width, 1, |
| 2733 args.width, 1, AdjustTexFormat(args.format), args.type, | 2740 AdjustTexFormat(feature_info_.get(), args.format), |
| 2734 reinterpret_cast<const void *>(offset)); | 2741 args.type, reinterpret_cast<const void*>(offset)); |
| 2735 glPixelStorei(GL_UNPACK_ALIGNMENT, state->unpack_alignment); | 2742 glPixelStorei(GL_UNPACK_ALIGNMENT, state->unpack_alignment); |
| 2736 { | 2743 { |
| 2737 uint32_t size; | 2744 uint32_t size; |
| 2738 GLES2Util::ComputeImageDataSizesES3(args.width, 1, 1, | 2745 GLES2Util::ComputeImageDataSizesES3(args.width, 1, 1, |
| 2739 args.format, args.type, | 2746 args.format, args.type, |
| 2740 params, | 2747 params, |
| 2741 &size, | 2748 &size, |
| 2742 nullptr, nullptr, nullptr, nullptr); | 2749 nullptr, nullptr, nullptr, nullptr); |
| 2743 offset += size; | 2750 offset += size; |
| 2744 } | 2751 } |
| 2745 } else { // kTexSubImage3D | 2752 } else { // kTexSubImage3D |
| 2746 PixelStoreParams params = state->GetUnpackParams(ContextState::k3D); | 2753 PixelStoreParams params = state->GetUnpackParams(ContextState::k3D); |
| 2747 GLint actual_width = state->unpack_row_length > 0 ? | 2754 GLint actual_width = state->unpack_row_length > 0 ? |
| 2748 state->unpack_row_length : args.width; | 2755 state->unpack_row_length : args.width; |
| 2749 if (args.depth > 1) { | 2756 if (args.depth > 1) { |
| 2750 glTexSubImage3D(args.target, args.level, args.xoffset, args.yoffset, | 2757 glTexSubImage3D(args.target, args.level, args.xoffset, args.yoffset, |
| 2751 args.zoffset, args.width, args.height, args.depth - 1, | 2758 args.zoffset, args.width, args.height, args.depth - 1, |
| 2752 AdjustTexFormat(args.format), args.type, args.pixels); | 2759 AdjustTexFormat(feature_info_.get(), args.format), |
| 2760 args.type, args.pixels); |
| 2753 GLint actual_height = state->unpack_image_height > 0 ? | 2761 GLint actual_height = state->unpack_image_height > 0 ? |
| 2754 state->unpack_image_height : args.height; | 2762 state->unpack_image_height : args.height; |
| 2755 uint32_t size; | 2763 uint32_t size; |
| 2756 uint32_t padding; | 2764 uint32_t padding; |
| 2757 // No need to worry about integer overflow here. | 2765 // No need to worry about integer overflow here. |
| 2758 GLES2Util::ComputeImageDataSizesES3(actual_width, actual_height, | 2766 GLES2Util::ComputeImageDataSizesES3(actual_width, actual_height, |
| 2759 args.depth - 1, | 2767 args.depth - 1, |
| 2760 args.format, args.type, | 2768 args.format, args.type, |
| 2761 params, | 2769 params, |
| 2762 &size, | 2770 &size, |
| 2763 nullptr, nullptr, nullptr, | 2771 nullptr, nullptr, nullptr, |
| 2764 &padding); | 2772 &padding); |
| 2765 DCHECK_EQ(args.padding, padding); | 2773 DCHECK_EQ(args.padding, padding); |
| 2766 // Last row should be padded, not unpadded. | 2774 // Last row should be padded, not unpadded. |
| 2767 offset += size + padding; | 2775 offset += size + padding; |
| 2768 } | 2776 } |
| 2769 if (args.height > 1) { | 2777 if (args.height > 1) { |
| 2770 glTexSubImage3D(args.target, args.level, args.xoffset, args.yoffset, | 2778 glTexSubImage3D(args.target, args.level, args.xoffset, args.yoffset, |
| 2771 args.zoffset + args.depth - 1, args.width, | 2779 args.zoffset + args.depth - 1, args.width, |
| 2772 args.height - 1, 1, AdjustTexFormat(args.format), | 2780 args.height - 1, 1, |
| 2781 AdjustTexFormat(feature_info_.get(), args.format), |
| 2773 args.type, reinterpret_cast<const void*>(offset)); | 2782 args.type, reinterpret_cast<const void*>(offset)); |
| 2774 uint32_t size; | 2783 uint32_t size; |
| 2775 uint32_t padding; | 2784 uint32_t padding; |
| 2776 // No need to worry about integer overflow here. | 2785 // No need to worry about integer overflow here. |
| 2777 GLES2Util::ComputeImageDataSizesES3(actual_width, args.height - 1, 1, | 2786 GLES2Util::ComputeImageDataSizesES3(actual_width, args.height - 1, 1, |
| 2778 args.format, args.type, | 2787 args.format, args.type, |
| 2779 params, | 2788 params, |
| 2780 &size, | 2789 &size, |
| 2781 nullptr, nullptr, nullptr, | 2790 nullptr, nullptr, nullptr, |
| 2782 &padding); | 2791 &padding); |
| 2783 DCHECK_EQ(args.padding, padding); | 2792 DCHECK_EQ(args.padding, padding); |
| 2784 // Last row should be padded, not unpadded. | 2793 // Last row should be padded, not unpadded. |
| 2785 offset += size + padding; | 2794 offset += size + padding; |
| 2786 } | 2795 } |
| 2787 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | 2796 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 2788 glTexSubImage3D(args.target, args.level, args.xoffset, | 2797 glTexSubImage3D(args.target, args.level, args.xoffset, |
| 2789 args.yoffset + args.height - 1, | 2798 args.yoffset + args.height - 1, |
| 2790 args.zoffset + args.depth - 1, | 2799 args.zoffset + args.depth - 1, args.width, 1, 1, |
| 2791 args.width, 1, 1, AdjustTexFormat(args.format), args.type, | 2800 AdjustTexFormat(feature_info_.get(), args.format), |
| 2792 reinterpret_cast<const void *>(offset)); | 2801 args.type, reinterpret_cast<const void*>(offset)); |
| 2793 glPixelStorei(GL_UNPACK_ALIGNMENT, state->unpack_alignment); | 2802 glPixelStorei(GL_UNPACK_ALIGNMENT, state->unpack_alignment); |
| 2794 { | 2803 { |
| 2795 uint32_t size; | 2804 uint32_t size; |
| 2796 GLES2Util::ComputeImageDataSizesES3(args.width, 1, 1, | 2805 GLES2Util::ComputeImageDataSizesES3(args.width, 1, 1, |
| 2797 args.format, args.type, | 2806 args.format, args.type, |
| 2798 params, | 2807 params, |
| 2799 &size, | 2808 &size, |
| 2800 nullptr, nullptr, nullptr, nullptr); | 2809 nullptr, nullptr, nullptr, nullptr); |
| 2801 offset += size; | 2810 offset += size; |
| 2802 } | 2811 } |
| 2803 } | 2812 } |
| 2804 DCHECK_EQ(ToGLuint(args.pixels) + args.pixels_size, offset); | 2813 DCHECK_EQ(ToGLuint(args.pixels) + args.pixels_size, offset); |
| 2805 } | 2814 } |
| 2806 | 2815 |
| 2807 void TextureManager::DoTexSubImageRowByRowWorkaround( | 2816 void TextureManager::DoTexSubImageRowByRowWorkaround( |
| 2808 DecoderTextureState* texture_state, | 2817 DecoderTextureState* texture_state, |
| 2809 ContextState* state, | 2818 ContextState* state, |
| 2810 const DoTexSubImageArguments& args, | 2819 const DoTexSubImageArguments& args, |
| 2811 const PixelStoreParams& unpack_params) { | 2820 const PixelStoreParams& unpack_params) { |
| 2812 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | 2821 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 2813 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); | 2822 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
| 2814 DCHECK_EQ(0, state->unpack_skip_pixels); | 2823 DCHECK_EQ(0, state->unpack_skip_pixels); |
| 2815 DCHECK_EQ(0, state->unpack_skip_rows); | 2824 DCHECK_EQ(0, state->unpack_skip_rows); |
| 2816 DCHECK_EQ(0, state->unpack_skip_images); | 2825 DCHECK_EQ(0, state->unpack_skip_images); |
| 2817 | 2826 |
| 2818 GLenum format = AdjustTexFormat(args.format); | 2827 GLenum format = AdjustTexFormat(feature_info_.get(), args.format); |
| 2819 | 2828 |
| 2820 GLsizei row_bytes = unpack_params.row_length * | 2829 GLsizei row_bytes = unpack_params.row_length * |
| 2821 GLES2Util::ComputeImageGroupSize(format, args.type); | 2830 GLES2Util::ComputeImageGroupSize(format, args.type); |
| 2822 GLsizei alignment_diff = row_bytes % unpack_params.alignment; | 2831 GLsizei alignment_diff = row_bytes % unpack_params.alignment; |
| 2823 if (alignment_diff != 0) { | 2832 if (alignment_diff != 0) { |
| 2824 row_bytes += unpack_params.alignment - alignment_diff; | 2833 row_bytes += unpack_params.alignment - alignment_diff; |
| 2825 } | 2834 } |
| 2826 DCHECK_EQ(0, row_bytes % unpack_params.alignment); | 2835 DCHECK_EQ(0, row_bytes % unpack_params.alignment); |
| 2827 if (args.command_type == DoTexSubImageArguments::kTexSubImage3D) { | 2836 if (args.command_type == DoTexSubImageArguments::kTexSubImage3D) { |
| 2828 GLsizei image_height = args.height; | 2837 GLsizei image_height = args.height; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2849 glTexSubImage2D(args.target, args.level, args.xoffset, row + args.yoffset, | 2858 glTexSubImage2D(args.target, args.level, args.xoffset, row + args.yoffset, |
| 2850 args.width, 1, format, args.type, row_pixels); | 2859 args.width, 1, format, args.type, row_pixels); |
| 2851 } | 2860 } |
| 2852 } | 2861 } |
| 2853 | 2862 |
| 2854 // Restore unpack state | 2863 // Restore unpack state |
| 2855 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_params.alignment); | 2864 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_params.alignment); |
| 2856 glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_params.row_length); | 2865 glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_params.row_length); |
| 2857 } | 2866 } |
| 2858 | 2867 |
| 2859 GLenum TextureManager::AdjustTexInternalFormat(GLenum format) const { | 2868 // static |
| 2860 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 2869 GLenum TextureManager::AdjustTexInternalFormat( |
| 2870 const gles2::FeatureInfo* feature_info, |
| 2871 GLenum format) { |
| 2872 if (feature_info->gl_version_info().is_desktop_core_profile) { |
| 2861 const Texture::CompatibilitySwizzle* swizzle = | 2873 const Texture::CompatibilitySwizzle* swizzle = |
| 2862 GetCompatibilitySwizzle(format); | 2874 GetCompatibilitySwizzle(format); |
| 2863 if (swizzle) | 2875 if (swizzle) |
| 2864 return swizzle->dest_format; | 2876 return swizzle->dest_format; |
| 2865 } | 2877 } |
| 2866 return format; | 2878 return format; |
| 2867 } | 2879 } |
| 2868 | 2880 |
| 2869 GLenum TextureManager::AdjustTexFormat(GLenum format) const { | 2881 // static |
| 2882 GLenum TextureManager::AdjustTexFormat(const gles2::FeatureInfo* feature_info, |
| 2883 GLenum format) { |
| 2870 // TODO(bajones): GLES 3 allows for internal format and format to differ. | 2884 // TODO(bajones): GLES 3 allows for internal format and format to differ. |
| 2871 // This logic may need to change as a result. | 2885 // This logic may need to change as a result. |
| 2872 if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGL) { | 2886 if (!feature_info->gl_version_info().is_es) { |
| 2873 if (format == GL_SRGB_EXT) | 2887 if (format == GL_SRGB_EXT) |
| 2874 return GL_RGB; | 2888 return GL_RGB; |
| 2875 if (format == GL_SRGB_ALPHA_EXT) | 2889 if (format == GL_SRGB_ALPHA_EXT) |
| 2876 return GL_RGBA; | 2890 return GL_RGBA; |
| 2877 } | 2891 } |
| 2878 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 2892 if (feature_info->gl_version_info().is_desktop_core_profile) { |
| 2879 const Texture::CompatibilitySwizzle* swizzle = | 2893 const Texture::CompatibilitySwizzle* swizzle = |
| 2880 GetCompatibilitySwizzle(format); | 2894 GetCompatibilitySwizzle(format); |
| 2881 if (swizzle) | 2895 if (swizzle) |
| 2882 return swizzle->dest_format; | 2896 return swizzle->dest_format; |
| 2883 } | 2897 } |
| 2884 return format; | 2898 return format; |
| 2885 } | 2899 } |
| 2886 | 2900 |
| 2887 void TextureManager::DoTexImage( | 2901 void TextureManager::DoTexImage( |
| 2888 DecoderTextureState* texture_state, | 2902 DecoderTextureState* texture_state, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2927 if (texture_state->texsubimage_faster_than_teximage && | 2941 if (texture_state->texsubimage_faster_than_teximage && |
| 2928 level_is_same && args.pixels && !unpack_buffer_bound) { | 2942 level_is_same && args.pixels && !unpack_buffer_bound) { |
| 2929 { | 2943 { |
| 2930 ScopedTextureUploadTimer timer(texture_state); | 2944 ScopedTextureUploadTimer timer(texture_state); |
| 2931 if (args.command_type == DoTexImageArguments::kTexImage3D) { | 2945 if (args.command_type == DoTexImageArguments::kTexImage3D) { |
| 2932 glTexSubImage3D(args.target, args.level, 0, 0, 0, | 2946 glTexSubImage3D(args.target, args.level, 0, 0, 0, |
| 2933 args.width, args.height, args.depth, | 2947 args.width, args.height, args.depth, |
| 2934 args.format, args.type, args.pixels); | 2948 args.format, args.type, args.pixels); |
| 2935 } else { | 2949 } else { |
| 2936 glTexSubImage2D(args.target, args.level, 0, 0, args.width, args.height, | 2950 glTexSubImage2D(args.target, args.level, 0, 0, args.width, args.height, |
| 2937 AdjustTexFormat(args.format), args.type, args.pixels); | 2951 AdjustTexFormat(feature_info_.get(), args.format), |
| 2952 args.type, args.pixels); |
| 2938 } | 2953 } |
| 2939 } | 2954 } |
| 2940 SetLevelInfo(texture_ref, args.target, args.level, args.internal_format, | 2955 SetLevelInfo(texture_ref, args.target, args.level, args.internal_format, |
| 2941 args.width, args.height, args.depth, args.border, args.format, | 2956 args.width, args.height, args.depth, args.border, args.format, |
| 2942 args.type, gfx::Rect(args.width, args.height)); | 2957 args.type, gfx::Rect(args.width, args.height)); |
| 2943 texture_state->tex_image_failed = false; | 2958 texture_state->tex_image_failed = false; |
| 2944 return; | 2959 return; |
| 2945 } | 2960 } |
| 2946 | 2961 |
| 2947 ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name); | 2962 ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name); |
| 2948 { | 2963 { |
| 2949 ScopedTextureUploadTimer timer(texture_state); | 2964 ScopedTextureUploadTimer timer(texture_state); |
| 2950 if (args.command_type == DoTexImageArguments::kTexImage3D) { | 2965 if (args.command_type == DoTexImageArguments::kTexImage3D) { |
| 2951 glTexImage3D(args.target, args.level, args.internal_format, args.width, | 2966 glTexImage3D(args.target, args.level, args.internal_format, args.width, |
| 2952 args.height, args.depth, args.border, args.format, | 2967 args.height, args.depth, args.border, args.format, |
| 2953 args.type, args.pixels); | 2968 args.type, args.pixels); |
| 2954 } else { | 2969 } else { |
| 2955 glTexImage2D(args.target, args.level, | 2970 glTexImage2D( |
| 2956 AdjustTexInternalFormat(args.internal_format), args.width, | 2971 args.target, args.level, |
| 2957 args.height, args.border, AdjustTexFormat(args.format), | 2972 AdjustTexInternalFormat(feature_info_.get(), args.internal_format), |
| 2958 args.type, args.pixels); | 2973 args.width, args.height, args.border, |
| 2974 AdjustTexFormat(feature_info_.get(), args.format), args.type, |
| 2975 args.pixels); |
| 2959 } | 2976 } |
| 2960 } | 2977 } |
| 2961 GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); | 2978 GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); |
| 2962 if (args.command_type == DoTexImageArguments::kTexImage3D) { | 2979 if (args.command_type == DoTexImageArguments::kTexImage3D) { |
| 2963 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage3D", error, | 2980 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage3D", error, |
| 2964 GetAllGLErrors()); | 2981 GetAllGLErrors()); |
| 2965 } else { | 2982 } else { |
| 2966 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage2D", error, | 2983 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage2D", error, |
| 2967 GetAllGLErrors()); | 2984 GetAllGLErrors()); |
| 2968 } | 2985 } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3335 uint32_t TextureManager::GetServiceIdGeneration() const { | 3352 uint32_t TextureManager::GetServiceIdGeneration() const { |
| 3336 return current_service_id_generation_; | 3353 return current_service_id_generation_; |
| 3337 } | 3354 } |
| 3338 | 3355 |
| 3339 void TextureManager::IncrementServiceIdGeneration() { | 3356 void TextureManager::IncrementServiceIdGeneration() { |
| 3340 current_service_id_generation_++; | 3357 current_service_id_generation_++; |
| 3341 } | 3358 } |
| 3342 | 3359 |
| 3343 } // namespace gles2 | 3360 } // namespace gles2 |
| 3344 } // namespace gpu | 3361 } // namespace gpu |
| OLD | NEW |