OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 Float4 result = { | 78 Float4 result = { |
79 {SkColorGetR(color) * factor * alpha, SkColorGetG(color) * factor * alpha, | 79 {SkColorGetR(color) * factor * alpha, SkColorGetG(color) * factor * alpha, |
80 SkColorGetB(color) * factor * alpha, alpha}}; | 80 SkColorGetB(color) * factor * alpha, alpha}}; |
81 return result; | 81 return result; |
82 } | 82 } |
83 | 83 |
84 SamplerType SamplerTypeFromTextureTarget(GLenum target) { | 84 SamplerType SamplerTypeFromTextureTarget(GLenum target) { |
85 switch (target) { | 85 switch (target) { |
86 case GL_TEXTURE_2D: | 86 case GL_TEXTURE_2D: |
87 return SAMPLER_TYPE_2D; | 87 return SamplerType2D; |
88 case GL_TEXTURE_RECTANGLE_ARB: | 88 case GL_TEXTURE_RECTANGLE_ARB: |
89 return SAMPLER_TYPE_2D_RECT; | 89 return SamplerType2DRect; |
90 case GL_TEXTURE_EXTERNAL_OES: | 90 case GL_TEXTURE_EXTERNAL_OES: |
91 return SAMPLER_TYPE_EXTERNAL_OES; | 91 return SamplerTypeExternalOES; |
92 default: | 92 default: |
93 NOTREACHED(); | 93 NOTREACHED(); |
94 return SAMPLER_TYPE_2D; | 94 return SamplerType2D; |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 BlendMode BlendModeFromSkXfermode(SkXfermode::Mode mode) { | 98 BlendMode BlendModeFromSkXfermode(SkXfermode::Mode mode) { |
99 switch (mode) { | 99 switch (mode) { |
100 case SkXfermode::kSrcOver_Mode: | 100 case SkXfermode::kSrcOver_Mode: |
101 return BLEND_MODE_NORMAL; | 101 return BlendModeNormal; |
102 case SkXfermode::kScreen_Mode: | 102 case SkXfermode::kScreen_Mode: |
103 return BLEND_MODE_SCREEN; | 103 return BlendModeScreen; |
104 case SkXfermode::kOverlay_Mode: | 104 case SkXfermode::kOverlay_Mode: |
105 return BLEND_MODE_OVERLAY; | 105 return BlendModeOverlay; |
106 case SkXfermode::kDarken_Mode: | 106 case SkXfermode::kDarken_Mode: |
107 return BLEND_MODE_DARKEN; | 107 return BlendModeDarken; |
108 case SkXfermode::kLighten_Mode: | 108 case SkXfermode::kLighten_Mode: |
109 return BLEND_MODE_LIGHTEN; | 109 return BlendModeLighten; |
110 case SkXfermode::kColorDodge_Mode: | 110 case SkXfermode::kColorDodge_Mode: |
111 return BLEND_MODE_COLOR_DODGE; | 111 return BlendModeColorDodge; |
112 case SkXfermode::kColorBurn_Mode: | 112 case SkXfermode::kColorBurn_Mode: |
113 return BLEND_MODE_COLOR_BURN; | 113 return BlendModeColorBurn; |
114 case SkXfermode::kHardLight_Mode: | 114 case SkXfermode::kHardLight_Mode: |
115 return BLEND_MODE_HARD_LIGHT; | 115 return BlendModeHardLight; |
116 case SkXfermode::kSoftLight_Mode: | 116 case SkXfermode::kSoftLight_Mode: |
117 return BLEND_MODE_SOFT_LIGHT; | 117 return BlendModeSoftLight; |
118 case SkXfermode::kDifference_Mode: | 118 case SkXfermode::kDifference_Mode: |
119 return BLEND_MODE_DIFFERENCE; | 119 return BlendModeDifference; |
120 case SkXfermode::kExclusion_Mode: | 120 case SkXfermode::kExclusion_Mode: |
121 return BLEND_MODE_EXCLUSION; | 121 return BlendModeExclusion; |
122 case SkXfermode::kMultiply_Mode: | 122 case SkXfermode::kMultiply_Mode: |
123 return BLEND_MODE_MULTIPLY; | 123 return BlendModeMultiply; |
124 case SkXfermode::kHue_Mode: | 124 case SkXfermode::kHue_Mode: |
125 return BLEND_MODE_HUE; | 125 return BlendModeHue; |
126 case SkXfermode::kSaturation_Mode: | 126 case SkXfermode::kSaturation_Mode: |
127 return BLEND_MODE_SATURATION; | 127 return BlendModeSaturation; |
128 case SkXfermode::kColor_Mode: | 128 case SkXfermode::kColor_Mode: |
129 return BLEND_MODE_COLOR; | 129 return BlendModeColor; |
130 case SkXfermode::kLuminosity_Mode: | 130 case SkXfermode::kLuminosity_Mode: |
131 return BLEND_MODE_LUMINOSITY; | 131 return BlendModeLuminosity; |
132 default: | 132 default: |
133 NOTREACHED(); | 133 NOTREACHED(); |
134 return BLEND_MODE_NONE; | 134 return BlendModeNone; |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 // Smallest unit that impact anti-aliasing output. We use this to | 138 // Smallest unit that impact anti-aliasing output. We use this to |
139 // determine when anti-aliasing is unnecessary. | 139 // determine when anti-aliasing is unnecessary. |
140 const float kAntiAliasingEpsilon = 1.0f / 1024.0f; | 140 const float kAntiAliasingEpsilon = 1.0f / 1024.0f; |
141 | 141 |
142 // Block or crash if the number of pending sync queries reach this high as | 142 // Block or crash if the number of pending sync queries reach this high as |
143 // something is seriously wrong on the service side if this happens. | 143 // something is seriously wrong on the service side if this happens. |
144 const size_t kMaxPendingSyncQueries = 16; | 144 const size_t kMaxPendingSyncQueries = 16; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 case DrawQuad::CHECKERBOARD: | 506 case DrawQuad::CHECKERBOARD: |
507 DrawCheckerboardQuad(frame, CheckerboardDrawQuad::MaterialCast(quad)); | 507 DrawCheckerboardQuad(frame, CheckerboardDrawQuad::MaterialCast(quad)); |
508 break; | 508 break; |
509 case DrawQuad::DEBUG_BORDER: | 509 case DrawQuad::DEBUG_BORDER: |
510 DrawDebugBorderQuad(frame, DebugBorderDrawQuad::MaterialCast(quad)); | 510 DrawDebugBorderQuad(frame, DebugBorderDrawQuad::MaterialCast(quad)); |
511 break; | 511 break; |
512 case DrawQuad::IO_SURFACE_CONTENT: | 512 case DrawQuad::IO_SURFACE_CONTENT: |
513 DrawIOSurfaceQuad(frame, IOSurfaceDrawQuad::MaterialCast(quad)); | 513 DrawIOSurfaceQuad(frame, IOSurfaceDrawQuad::MaterialCast(quad)); |
514 break; | 514 break; |
515 case DrawQuad::PICTURE_CONTENT: | 515 case DrawQuad::PICTURE_CONTENT: |
516 // PictureDrawQuad should only be used for resourceless software draws. | 516 DrawPictureQuad(frame, PictureDrawQuad::MaterialCast(quad)); |
517 NOTREACHED(); | |
518 break; | 517 break; |
519 case DrawQuad::RENDER_PASS: | 518 case DrawQuad::RENDER_PASS: |
520 DrawRenderPassQuad(frame, RenderPassDrawQuad::MaterialCast(quad)); | 519 DrawRenderPassQuad(frame, RenderPassDrawQuad::MaterialCast(quad)); |
521 break; | 520 break; |
522 case DrawQuad::SOLID_COLOR: | 521 case DrawQuad::SOLID_COLOR: |
523 DrawSolidColorQuad(frame, SolidColorDrawQuad::MaterialCast(quad)); | 522 DrawSolidColorQuad(frame, SolidColorDrawQuad::MaterialCast(quad)); |
524 break; | 523 break; |
525 case DrawQuad::STREAM_VIDEO_CONTENT: | 524 case DrawQuad::STREAM_VIDEO_CONTENT: |
526 DrawStreamVideoQuad(frame, StreamVideoDrawQuad::MaterialCast(quad)); | 525 DrawStreamVideoQuad(frame, StreamVideoDrawQuad::MaterialCast(quad)); |
527 break; | 526 break; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 frame, frame->current_render_pass->output_rect)); | 838 frame, frame->current_render_pass->output_rect)); |
840 return backdrop_rect; | 839 return backdrop_rect; |
841 } | 840 } |
842 | 841 |
843 scoped_ptr<ScopedResource> GLRenderer::GetBackdropTexture( | 842 scoped_ptr<ScopedResource> GLRenderer::GetBackdropTexture( |
844 const gfx::Rect& bounding_rect) { | 843 const gfx::Rect& bounding_rect) { |
845 scoped_ptr<ScopedResource> device_background_texture = | 844 scoped_ptr<ScopedResource> device_background_texture = |
846 ScopedResource::Create(resource_provider_); | 845 ScopedResource::Create(resource_provider_); |
847 // CopyTexImage2D fails when called on a texture having immutable storage. | 846 // CopyTexImage2D fails when called on a texture having immutable storage. |
848 device_background_texture->Allocate( | 847 device_background_texture->Allocate( |
849 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, RGBA_8888); | 848 bounding_rect.size(), ResourceProvider::TextureHintDefault, RGBA_8888); |
850 { | 849 { |
851 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, | 850 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, |
852 device_background_texture->id()); | 851 device_background_texture->id()); |
853 GetFramebufferTexture( | 852 GetFramebufferTexture( |
854 lock.texture_id(), device_background_texture->format(), bounding_rect); | 853 lock.texture_id(), device_background_texture->format(), bounding_rect); |
855 } | 854 } |
856 return device_background_texture.Pass(); | 855 return device_background_texture.Pass(); |
857 } | 856 } |
858 | 857 |
859 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( | 858 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 } else { | 973 } else { |
975 filter_image = ApplyImageFilter( | 974 filter_image = ApplyImageFilter( |
976 ScopedUseGrContext::Create(this, frame), resource_provider_, | 975 ScopedUseGrContext::Create(this, frame), resource_provider_, |
977 quad->rect, quad->filters_scale, filter.get(), contents_texture); | 976 quad->rect, quad->filters_scale, filter.get(), contents_texture); |
978 } | 977 } |
979 } | 978 } |
980 } | 979 } |
981 | 980 |
982 scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; | 981 scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; |
983 unsigned mask_texture_id = 0; | 982 unsigned mask_texture_id = 0; |
984 SamplerType mask_sampler = SAMPLER_TYPE_NA; | 983 SamplerType mask_sampler = SamplerTypeNA; |
985 if (quad->mask_resource_id) { | 984 if (quad->mask_resource_id) { |
986 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( | 985 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( |
987 resource_provider_, quad->mask_resource_id, GL_TEXTURE1, GL_LINEAR)); | 986 resource_provider_, quad->mask_resource_id, GL_TEXTURE1, GL_LINEAR)); |
988 mask_texture_id = mask_resource_lock->texture_id(); | 987 mask_texture_id = mask_resource_lock->texture_id(); |
989 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); | 988 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); |
990 } | 989 } |
991 | 990 |
992 scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; | 991 scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; |
993 if (filter_image) { | 992 if (filter_image) { |
994 GrTexture* texture = filter_image->getTexture(); | 993 GrTexture* texture = filter_image->getTexture(); |
(...skipping 30 matching lines...) Expand all Loading... |
1025 int shader_alpha_location = -1; | 1024 int shader_alpha_location = -1; |
1026 int shader_color_matrix_location = -1; | 1025 int shader_color_matrix_location = -1; |
1027 int shader_color_offset_location = -1; | 1026 int shader_color_offset_location = -1; |
1028 int shader_tex_transform_location = -1; | 1027 int shader_tex_transform_location = -1; |
1029 int shader_backdrop_location = -1; | 1028 int shader_backdrop_location = -1; |
1030 int shader_backdrop_rect_location = -1; | 1029 int shader_backdrop_rect_location = -1; |
1031 | 1030 |
1032 DCHECK_EQ(background_texture || background_image, use_shaders_for_blending); | 1031 DCHECK_EQ(background_texture || background_image, use_shaders_for_blending); |
1033 BlendMode shader_blend_mode = use_shaders_for_blending | 1032 BlendMode shader_blend_mode = use_shaders_for_blending |
1034 ? BlendModeFromSkXfermode(blend_mode) | 1033 ? BlendModeFromSkXfermode(blend_mode) |
1035 : BLEND_MODE_NONE; | 1034 : BlendModeNone; |
1036 | 1035 |
1037 if (use_aa && mask_texture_id && !use_color_matrix) { | 1036 if (use_aa && mask_texture_id && !use_color_matrix) { |
1038 const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA( | 1037 const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA( |
1039 tex_coord_precision, mask_sampler, shader_blend_mode); | 1038 tex_coord_precision, mask_sampler, shader_blend_mode); |
1040 SetUseProgram(program->program()); | 1039 SetUseProgram(program->program()); |
1041 GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); | 1040 GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); |
1042 | 1041 |
1043 shader_quad_location = program->vertex_shader().quad_location(); | 1042 shader_quad_location = program->vertex_shader().quad_location(); |
1044 shader_edge_location = program->vertex_shader().edge_location(); | 1043 shader_edge_location = program->vertex_shader().edge_location(); |
1045 shader_viewport_location = program->vertex_shader().viewport_location(); | 1044 shader_viewport_location = program->vertex_shader().viewport_location(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 tex_scale_x, | 1211 tex_scale_x, |
1213 -tex_scale_y)); | 1212 -tex_scale_y)); |
1214 | 1213 |
1215 GLint last_texture_unit = 0; | 1214 GLint last_texture_unit = 0; |
1216 if (shader_mask_sampler_location != -1) { | 1215 if (shader_mask_sampler_location != -1) { |
1217 DCHECK_NE(shader_mask_tex_coord_scale_location, 1); | 1216 DCHECK_NE(shader_mask_tex_coord_scale_location, 1); |
1218 DCHECK_NE(shader_mask_tex_coord_offset_location, 1); | 1217 DCHECK_NE(shader_mask_tex_coord_offset_location, 1); |
1219 GLC(gl_, gl_->Uniform1i(shader_mask_sampler_location, 1)); | 1218 GLC(gl_, gl_->Uniform1i(shader_mask_sampler_location, 1)); |
1220 | 1219 |
1221 gfx::RectF mask_uv_rect = quad->MaskUVRect(); | 1220 gfx::RectF mask_uv_rect = quad->MaskUVRect(); |
1222 if (mask_sampler != SAMPLER_TYPE_2D) { | 1221 if (mask_sampler != SamplerType2D) { |
1223 mask_uv_rect.Scale(quad->mask_texture_size.width(), | 1222 mask_uv_rect.Scale(quad->mask_texture_size.width(), |
1224 quad->mask_texture_size.height()); | 1223 quad->mask_texture_size.height()); |
1225 } | 1224 } |
1226 | 1225 |
1227 // Mask textures are oriented vertically flipped relative to the framebuffer | 1226 // Mask textures are oriented vertically flipped relative to the framebuffer |
1228 // and the RenderPass contents texture, so we flip the tex coords from the | 1227 // and the RenderPass contents texture, so we flip the tex coords from the |
1229 // RenderPass texture to find the mask texture coords. | 1228 // RenderPass texture to find the mask texture coords. |
1230 GLC(gl_, | 1229 GLC(gl_, |
1231 gl_->Uniform2f(shader_mask_tex_coord_offset_location, | 1230 gl_->Uniform2f(shader_mask_tex_coord_offset_location, |
1232 mask_uv_rect.x(), | 1231 mask_uv_rect.x(), |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 quad->nearest_neighbor ? GL_NEAREST : GL_LINEAR); | 1630 quad->nearest_neighbor ? GL_NEAREST : GL_LINEAR); |
1632 SamplerType sampler = | 1631 SamplerType sampler = |
1633 SamplerTypeFromTextureTarget(quad_resource_lock.target()); | 1632 SamplerTypeFromTextureTarget(quad_resource_lock.target()); |
1634 | 1633 |
1635 float fragment_tex_translate_x = clamp_tex_rect.x(); | 1634 float fragment_tex_translate_x = clamp_tex_rect.x(); |
1636 float fragment_tex_translate_y = clamp_tex_rect.y(); | 1635 float fragment_tex_translate_y = clamp_tex_rect.y(); |
1637 float fragment_tex_scale_x = clamp_tex_rect.width(); | 1636 float fragment_tex_scale_x = clamp_tex_rect.width(); |
1638 float fragment_tex_scale_y = clamp_tex_rect.height(); | 1637 float fragment_tex_scale_y = clamp_tex_rect.height(); |
1639 | 1638 |
1640 // Map to normalized texture coordinates. | 1639 // Map to normalized texture coordinates. |
1641 if (sampler != SAMPLER_TYPE_2D_RECT) { | 1640 if (sampler != SamplerType2DRect) { |
1642 gfx::Size texture_size = quad->texture_size; | 1641 gfx::Size texture_size = quad->texture_size; |
1643 DCHECK(!texture_size.IsEmpty()); | 1642 DCHECK(!texture_size.IsEmpty()); |
1644 fragment_tex_translate_x /= texture_size.width(); | 1643 fragment_tex_translate_x /= texture_size.width(); |
1645 fragment_tex_translate_y /= texture_size.height(); | 1644 fragment_tex_translate_y /= texture_size.height(); |
1646 fragment_tex_scale_x /= texture_size.width(); | 1645 fragment_tex_scale_x /= texture_size.width(); |
1647 fragment_tex_scale_y /= texture_size.height(); | 1646 fragment_tex_scale_y /= texture_size.height(); |
1648 } | 1647 } |
1649 | 1648 |
1650 TileProgramUniforms uniforms; | 1649 TileProgramUniforms uniforms; |
1651 if (quad->swizzle_contents) { | 1650 if (quad->swizzle_contents) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 resource_provider_, resource_id, filter); | 1720 resource_provider_, resource_id, filter); |
1722 SamplerType sampler = | 1721 SamplerType sampler = |
1723 SamplerTypeFromTextureTarget(quad_resource_lock.target()); | 1722 SamplerTypeFromTextureTarget(quad_resource_lock.target()); |
1724 | 1723 |
1725 float vertex_tex_translate_x = tex_coord_rect.x(); | 1724 float vertex_tex_translate_x = tex_coord_rect.x(); |
1726 float vertex_tex_translate_y = tex_coord_rect.y(); | 1725 float vertex_tex_translate_y = tex_coord_rect.y(); |
1727 float vertex_tex_scale_x = tex_coord_rect.width(); | 1726 float vertex_tex_scale_x = tex_coord_rect.width(); |
1728 float vertex_tex_scale_y = tex_coord_rect.height(); | 1727 float vertex_tex_scale_y = tex_coord_rect.height(); |
1729 | 1728 |
1730 // Map to normalized texture coordinates. | 1729 // Map to normalized texture coordinates. |
1731 if (sampler != SAMPLER_TYPE_2D_RECT) { | 1730 if (sampler != SamplerType2DRect) { |
1732 gfx::Size texture_size = quad->texture_size; | 1731 gfx::Size texture_size = quad->texture_size; |
1733 DCHECK(!texture_size.IsEmpty()); | 1732 DCHECK(!texture_size.IsEmpty()); |
1734 vertex_tex_translate_x /= texture_size.width(); | 1733 vertex_tex_translate_x /= texture_size.width(); |
1735 vertex_tex_translate_y /= texture_size.height(); | 1734 vertex_tex_translate_y /= texture_size.height(); |
1736 vertex_tex_scale_x /= texture_size.width(); | 1735 vertex_tex_scale_x /= texture_size.width(); |
1737 vertex_tex_scale_y /= texture_size.height(); | 1736 vertex_tex_scale_y /= texture_size.height(); |
1738 } | 1737 } |
1739 | 1738 |
1740 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1739 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
1741 gl_, &highp_threshold_cache_, highp_threshold_min_, quad->texture_size); | 1740 gl_, &highp_threshold_cache_, highp_threshold_min_, quad->texture_size); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 GLC(gl_, gl_->Uniform1i(v_texture_location, 3)); | 1892 GLC(gl_, gl_->Uniform1i(v_texture_location, 3)); |
1894 if (use_alpha_plane) | 1893 if (use_alpha_plane) |
1895 GLC(gl_, gl_->Uniform1i(a_texture_location, 4)); | 1894 GLC(gl_, gl_->Uniform1i(a_texture_location, 4)); |
1896 | 1895 |
1897 // These values are magic numbers that are used in the transformation from YUV | 1896 // These values are magic numbers that are used in the transformation from YUV |
1898 // to RGB color values. They are taken from the following webpage: | 1897 // to RGB color values. They are taken from the following webpage: |
1899 // http://www.fourcc.org/fccyvrgb.php | 1898 // http://www.fourcc.org/fccyvrgb.php |
1900 float yuv_to_rgb_rec601[9] = { | 1899 float yuv_to_rgb_rec601[9] = { |
1901 1.164f, 1.164f, 1.164f, 0.0f, -.391f, 2.018f, 1.596f, -.813f, 0.0f, | 1900 1.164f, 1.164f, 1.164f, 0.0f, -.391f, 2.018f, 1.596f, -.813f, 0.0f, |
1902 }; | 1901 }; |
1903 float yuv_to_rgb_jpeg[9] = { | 1902 float yuv_to_rgb_rec601_jpeg[9] = { |
1904 1.f, 1.f, 1.f, 0.0f, -.34414f, 1.772f, 1.402f, -.71414f, 0.0f, | 1903 1.f, 1.f, 1.f, 0.0f, -.34414f, 1.772f, 1.402f, -.71414f, 0.0f, |
1905 }; | 1904 }; |
1906 float yuv_to_rgb_rec709[9] = { | |
1907 1.164f, 1.164f, 1.164f, 0.0f, -0.213f, 2.112f, 1.793f, -0.533f, 0.0f, | |
1908 }; | |
1909 | 1905 |
1910 // These values map to 16, 128, and 128 respectively, and are computed | 1906 // These values map to 16, 128, and 128 respectively, and are computed |
1911 // as a fraction over 256 (e.g. 16 / 256 = 0.0625). | 1907 // as a fraction over 256 (e.g. 16 / 256 = 0.0625). |
1912 // They are used in the YUV to RGBA conversion formula: | 1908 // They are used in the YUV to RGBA conversion formula: |
1913 // Y - 16 : Gives 16 values of head and footroom for overshooting | 1909 // Y - 16 : Gives 16 values of head and footroom for overshooting |
1914 // U - 128 : Turns unsigned U into signed U [-128,127] | 1910 // U - 128 : Turns unsigned U into signed U [-128,127] |
1915 // V - 128 : Turns unsigned V into signed V [-128,127] | 1911 // V - 128 : Turns unsigned V into signed V [-128,127] |
1916 float yuv_adjust_constrained[3] = { | 1912 float yuv_adjust_rec601[3] = { |
1917 -0.0625f, -0.5f, -0.5f, | 1913 -0.0625f, -0.5f, -0.5f, |
1918 }; | 1914 }; |
1919 | 1915 |
1920 // Same as above, but without the head and footroom. | 1916 // Same as above, but without the head and footroom. |
1921 float yuv_adjust_full[3] = { | 1917 float yuv_adjust_rec601_jpeg[3] = { |
1922 0.0f, -0.5f, -0.5f, | 1918 0.0f, -0.5f, -0.5f, |
1923 }; | 1919 }; |
1924 | 1920 |
1925 float* yuv_to_rgb = NULL; | 1921 float* yuv_to_rgb = NULL; |
1926 float* yuv_adjust = NULL; | 1922 float* yuv_adjust = NULL; |
1927 | 1923 |
1928 switch (quad->color_space) { | 1924 switch (quad->color_space) { |
1929 case YUVVideoDrawQuad::REC_601: | 1925 case YUVVideoDrawQuad::REC_601: |
1930 yuv_to_rgb = yuv_to_rgb_rec601; | 1926 yuv_to_rgb = yuv_to_rgb_rec601; |
1931 yuv_adjust = yuv_adjust_constrained; | 1927 yuv_adjust = yuv_adjust_rec601; |
1932 break; | 1928 break; |
1933 case YUVVideoDrawQuad::REC_709: | 1929 case YUVVideoDrawQuad::REC_601_JPEG: |
1934 yuv_to_rgb = yuv_to_rgb_rec709; | 1930 yuv_to_rgb = yuv_to_rgb_rec601_jpeg; |
1935 yuv_adjust = yuv_adjust_constrained; | 1931 yuv_adjust = yuv_adjust_rec601_jpeg; |
1936 break; | |
1937 case YUVVideoDrawQuad::JPEG: | |
1938 yuv_to_rgb = yuv_to_rgb_jpeg; | |
1939 yuv_adjust = yuv_adjust_full; | |
1940 break; | 1932 break; |
1941 } | 1933 } |
1942 | 1934 |
1943 GLC(gl_, gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb)); | 1935 GLC(gl_, gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb)); |
1944 GLC(gl_, gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust)); | 1936 GLC(gl_, gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust)); |
1945 | 1937 |
1946 SetShaderOpacity(quad->opacity(), alpha_location); | 1938 SetShaderOpacity(quad->opacity(), alpha_location); |
1947 DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, matrix_location); | 1939 DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, matrix_location); |
1948 } | 1940 } |
1949 | 1941 |
(...skipping 28 matching lines...) Expand all Loading... |
1978 GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); | 1970 GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); |
1979 | 1971 |
1980 SetShaderOpacity(quad->opacity(), | 1972 SetShaderOpacity(quad->opacity(), |
1981 program->fragment_shader().alpha_location()); | 1973 program->fragment_shader().alpha_location()); |
1982 DrawQuadGeometry(frame, | 1974 DrawQuadGeometry(frame, |
1983 quad->quadTransform(), | 1975 quad->quadTransform(), |
1984 quad->rect, | 1976 quad->rect, |
1985 program->vertex_shader().matrix_location()); | 1977 program->vertex_shader().matrix_location()); |
1986 } | 1978 } |
1987 | 1979 |
| 1980 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, |
| 1981 const PictureDrawQuad* quad) { |
| 1982 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || |
| 1983 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { |
| 1984 on_demand_tile_raster_bitmap_.allocN32Pixels(quad->texture_size.width(), |
| 1985 quad->texture_size.height()); |
| 1986 |
| 1987 if (on_demand_tile_raster_resource_id_) |
| 1988 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
| 1989 |
| 1990 on_demand_tile_raster_resource_id_ = resource_provider_->CreateGLTexture( |
| 1991 quad->texture_size, |
| 1992 GL_TEXTURE_2D, |
| 1993 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, |
| 1994 GL_CLAMP_TO_EDGE, |
| 1995 ResourceProvider::TextureHintImmutable, |
| 1996 quad->texture_format); |
| 1997 } |
| 1998 |
| 1999 SkCanvas canvas(on_demand_tile_raster_bitmap_); |
| 2000 quad->raster_source->PlaybackToCanvas(&canvas, quad->content_rect, |
| 2001 quad->contents_scale); |
| 2002 |
| 2003 uint8_t* bitmap_pixels = NULL; |
| 2004 SkBitmap on_demand_tile_raster_bitmap_dest; |
| 2005 SkColorType colorType = ResourceFormatToSkColorType(quad->texture_format); |
| 2006 if (on_demand_tile_raster_bitmap_.colorType() != colorType) { |
| 2007 on_demand_tile_raster_bitmap_.copyTo(&on_demand_tile_raster_bitmap_dest, |
| 2008 colorType); |
| 2009 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the |
| 2010 // bitmap data. This check will be removed once crbug.com/293728 is fixed. |
| 2011 CHECK_EQ(0u, on_demand_tile_raster_bitmap_dest.rowBytes() % 4); |
| 2012 bitmap_pixels = reinterpret_cast<uint8_t*>( |
| 2013 on_demand_tile_raster_bitmap_dest.getPixels()); |
| 2014 } else { |
| 2015 bitmap_pixels = |
| 2016 reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()); |
| 2017 } |
| 2018 |
| 2019 resource_provider_->SetPixels(on_demand_tile_raster_resource_id_, |
| 2020 bitmap_pixels, |
| 2021 gfx::Rect(quad->texture_size), |
| 2022 gfx::Rect(quad->texture_size), |
| 2023 gfx::Vector2d()); |
| 2024 |
| 2025 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_); |
| 2026 } |
| 2027 |
1988 struct TextureProgramBinding { | 2028 struct TextureProgramBinding { |
1989 template <class Program> | 2029 template <class Program> |
1990 void Set(Program* program) { | 2030 void Set(Program* program) { |
1991 DCHECK(program); | 2031 DCHECK(program); |
1992 program_id = program->program(); | 2032 program_id = program->program(); |
1993 sampler_location = program->fragment_shader().sampler_location(); | 2033 sampler_location = program->fragment_shader().sampler_location(); |
1994 matrix_location = program->vertex_shader().matrix_location(); | 2034 matrix_location = program->vertex_shader().matrix_location(); |
1995 background_color_location = | 2035 background_color_location = |
1996 program->fragment_shader().background_color_location(); | 2036 program->fragment_shader().background_color_location(); |
1997 } | 2037 } |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 | 2768 |
2729 shared_geometry_ = make_scoped_ptr( | 2769 shared_geometry_ = make_scoped_ptr( |
2730 new GeometryBinding(gl_, QuadVertexRect())); | 2770 new GeometryBinding(gl_, QuadVertexRect())); |
2731 } | 2771 } |
2732 | 2772 |
2733 const GLRenderer::TileCheckerboardProgram* | 2773 const GLRenderer::TileCheckerboardProgram* |
2734 GLRenderer::GetTileCheckerboardProgram() { | 2774 GLRenderer::GetTileCheckerboardProgram() { |
2735 if (!tile_checkerboard_program_.initialized()) { | 2775 if (!tile_checkerboard_program_.initialized()) { |
2736 TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize"); | 2776 TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize"); |
2737 tile_checkerboard_program_.Initialize(output_surface_->context_provider(), | 2777 tile_checkerboard_program_.Initialize(output_surface_->context_provider(), |
2738 TEX_COORD_PRECISION_NA, | 2778 TexCoordPrecisionNA, |
2739 SAMPLER_TYPE_NA); | 2779 SamplerTypeNA); |
2740 } | 2780 } |
2741 return &tile_checkerboard_program_; | 2781 return &tile_checkerboard_program_; |
2742 } | 2782 } |
2743 | 2783 |
2744 const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { | 2784 const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { |
2745 if (!debug_border_program_.initialized()) { | 2785 if (!debug_border_program_.initialized()) { |
2746 TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize"); | 2786 TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize"); |
2747 debug_border_program_.Initialize(output_surface_->context_provider(), | 2787 debug_border_program_.Initialize(output_surface_->context_provider(), |
2748 TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA); | 2788 TexCoordPrecisionNA, |
| 2789 SamplerTypeNA); |
2749 } | 2790 } |
2750 return &debug_border_program_; | 2791 return &debug_border_program_; |
2751 } | 2792 } |
2752 | 2793 |
2753 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { | 2794 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { |
2754 if (!solid_color_program_.initialized()) { | 2795 if (!solid_color_program_.initialized()) { |
2755 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); | 2796 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); |
2756 solid_color_program_.Initialize(output_surface_->context_provider(), | 2797 solid_color_program_.Initialize(output_surface_->context_provider(), |
2757 TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA); | 2798 TexCoordPrecisionNA, |
| 2799 SamplerTypeNA); |
2758 } | 2800 } |
2759 return &solid_color_program_; | 2801 return &solid_color_program_; |
2760 } | 2802 } |
2761 | 2803 |
2762 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { | 2804 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { |
2763 if (!solid_color_program_aa_.initialized()) { | 2805 if (!solid_color_program_aa_.initialized()) { |
2764 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize"); | 2806 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize"); |
2765 solid_color_program_aa_.Initialize(output_surface_->context_provider(), | 2807 solid_color_program_aa_.Initialize(output_surface_->context_provider(), |
2766 TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA); | 2808 TexCoordPrecisionNA, |
| 2809 SamplerTypeNA); |
2767 } | 2810 } |
2768 return &solid_color_program_aa_; | 2811 return &solid_color_program_aa_; |
2769 } | 2812 } |
2770 | 2813 |
2771 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram( | 2814 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram( |
2772 TexCoordPrecision precision, | 2815 TexCoordPrecision precision, |
2773 BlendMode blend_mode) { | 2816 BlendMode blend_mode) { |
2774 DCHECK_GE(precision, 0); | 2817 DCHECK_GE(precision, 0); |
2775 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2818 DCHECK_LT(precision, NumTexCoordPrecisions); |
2776 DCHECK_GE(blend_mode, 0); | 2819 DCHECK_GE(blend_mode, 0); |
2777 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2820 DCHECK_LT(blend_mode, NumBlendModes); |
2778 RenderPassProgram* program = &render_pass_program_[precision][blend_mode]; | 2821 RenderPassProgram* program = &render_pass_program_[precision][blend_mode]; |
2779 if (!program->initialized()) { | 2822 if (!program->initialized()) { |
2780 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); | 2823 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); |
2781 program->Initialize(output_surface_->context_provider(), precision, | 2824 program->Initialize(output_surface_->context_provider(), |
2782 SAMPLER_TYPE_2D, blend_mode); | 2825 precision, |
| 2826 SamplerType2D, |
| 2827 blend_mode); |
2783 } | 2828 } |
2784 return program; | 2829 return program; |
2785 } | 2830 } |
2786 | 2831 |
2787 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( | 2832 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( |
2788 TexCoordPrecision precision, | 2833 TexCoordPrecision precision, |
2789 BlendMode blend_mode) { | 2834 BlendMode blend_mode) { |
2790 DCHECK_GE(precision, 0); | 2835 DCHECK_GE(precision, 0); |
2791 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2836 DCHECK_LT(precision, NumTexCoordPrecisions); |
2792 DCHECK_GE(blend_mode, 0); | 2837 DCHECK_GE(blend_mode, 0); |
2793 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2838 DCHECK_LT(blend_mode, NumBlendModes); |
2794 RenderPassProgramAA* program = | 2839 RenderPassProgramAA* program = |
2795 &render_pass_program_aa_[precision][blend_mode]; | 2840 &render_pass_program_aa_[precision][blend_mode]; |
2796 if (!program->initialized()) { | 2841 if (!program->initialized()) { |
2797 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); | 2842 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); |
2798 program->Initialize(output_surface_->context_provider(), precision, | 2843 program->Initialize(output_surface_->context_provider(), |
2799 SAMPLER_TYPE_2D, blend_mode); | 2844 precision, |
| 2845 SamplerType2D, |
| 2846 blend_mode); |
2800 } | 2847 } |
2801 return program; | 2848 return program; |
2802 } | 2849 } |
2803 | 2850 |
2804 const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( | 2851 const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( |
2805 TexCoordPrecision precision, | 2852 TexCoordPrecision precision, |
2806 SamplerType sampler, | 2853 SamplerType sampler, |
2807 BlendMode blend_mode) { | 2854 BlendMode blend_mode) { |
2808 DCHECK_GE(precision, 0); | 2855 DCHECK_GE(precision, 0); |
2809 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2856 DCHECK_LT(precision, NumTexCoordPrecisions); |
2810 DCHECK_GE(sampler, 0); | 2857 DCHECK_GE(sampler, 0); |
2811 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2858 DCHECK_LT(sampler, NumSamplerTypes); |
2812 DCHECK_GE(blend_mode, 0); | 2859 DCHECK_GE(blend_mode, 0); |
2813 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2860 DCHECK_LT(blend_mode, NumBlendModes); |
2814 RenderPassMaskProgram* program = | 2861 RenderPassMaskProgram* program = |
2815 &render_pass_mask_program_[precision][sampler][blend_mode]; | 2862 &render_pass_mask_program_[precision][sampler][blend_mode]; |
2816 if (!program->initialized()) { | 2863 if (!program->initialized()) { |
2817 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); | 2864 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); |
2818 program->Initialize( | 2865 program->Initialize( |
2819 output_surface_->context_provider(), precision, sampler, blend_mode); | 2866 output_surface_->context_provider(), precision, sampler, blend_mode); |
2820 } | 2867 } |
2821 return program; | 2868 return program; |
2822 } | 2869 } |
2823 | 2870 |
2824 const GLRenderer::RenderPassMaskProgramAA* | 2871 const GLRenderer::RenderPassMaskProgramAA* |
2825 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, | 2872 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, |
2826 SamplerType sampler, | 2873 SamplerType sampler, |
2827 BlendMode blend_mode) { | 2874 BlendMode blend_mode) { |
2828 DCHECK_GE(precision, 0); | 2875 DCHECK_GE(precision, 0); |
2829 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2876 DCHECK_LT(precision, NumTexCoordPrecisions); |
2830 DCHECK_GE(sampler, 0); | 2877 DCHECK_GE(sampler, 0); |
2831 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2878 DCHECK_LT(sampler, NumSamplerTypes); |
2832 DCHECK_GE(blend_mode, 0); | 2879 DCHECK_GE(blend_mode, 0); |
2833 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2880 DCHECK_LT(blend_mode, NumBlendModes); |
2834 RenderPassMaskProgramAA* program = | 2881 RenderPassMaskProgramAA* program = |
2835 &render_pass_mask_program_aa_[precision][sampler][blend_mode]; | 2882 &render_pass_mask_program_aa_[precision][sampler][blend_mode]; |
2836 if (!program->initialized()) { | 2883 if (!program->initialized()) { |
2837 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); | 2884 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); |
2838 program->Initialize( | 2885 program->Initialize( |
2839 output_surface_->context_provider(), precision, sampler, blend_mode); | 2886 output_surface_->context_provider(), precision, sampler, blend_mode); |
2840 } | 2887 } |
2841 return program; | 2888 return program; |
2842 } | 2889 } |
2843 | 2890 |
2844 const GLRenderer::RenderPassColorMatrixProgram* | 2891 const GLRenderer::RenderPassColorMatrixProgram* |
2845 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision, | 2892 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision, |
2846 BlendMode blend_mode) { | 2893 BlendMode blend_mode) { |
2847 DCHECK_GE(precision, 0); | 2894 DCHECK_GE(precision, 0); |
2848 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2895 DCHECK_LT(precision, NumTexCoordPrecisions); |
2849 DCHECK_GE(blend_mode, 0); | 2896 DCHECK_GE(blend_mode, 0); |
2850 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2897 DCHECK_LT(blend_mode, NumBlendModes); |
2851 RenderPassColorMatrixProgram* program = | 2898 RenderPassColorMatrixProgram* program = |
2852 &render_pass_color_matrix_program_[precision][blend_mode]; | 2899 &render_pass_color_matrix_program_[precision][blend_mode]; |
2853 if (!program->initialized()) { | 2900 if (!program->initialized()) { |
2854 TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize"); | 2901 TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize"); |
2855 program->Initialize(output_surface_->context_provider(), precision, | 2902 program->Initialize(output_surface_->context_provider(), |
2856 SAMPLER_TYPE_2D, blend_mode); | 2903 precision, |
| 2904 SamplerType2D, |
| 2905 blend_mode); |
2857 } | 2906 } |
2858 return program; | 2907 return program; |
2859 } | 2908 } |
2860 | 2909 |
2861 const GLRenderer::RenderPassColorMatrixProgramAA* | 2910 const GLRenderer::RenderPassColorMatrixProgramAA* |
2862 GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision, | 2911 GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision, |
2863 BlendMode blend_mode) { | 2912 BlendMode blend_mode) { |
2864 DCHECK_GE(precision, 0); | 2913 DCHECK_GE(precision, 0); |
2865 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2914 DCHECK_LT(precision, NumTexCoordPrecisions); |
2866 DCHECK_GE(blend_mode, 0); | 2915 DCHECK_GE(blend_mode, 0); |
2867 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2916 DCHECK_LT(blend_mode, NumBlendModes); |
2868 RenderPassColorMatrixProgramAA* program = | 2917 RenderPassColorMatrixProgramAA* program = |
2869 &render_pass_color_matrix_program_aa_[precision][blend_mode]; | 2918 &render_pass_color_matrix_program_aa_[precision][blend_mode]; |
2870 if (!program->initialized()) { | 2919 if (!program->initialized()) { |
2871 TRACE_EVENT0("cc", | 2920 TRACE_EVENT0("cc", |
2872 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); | 2921 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); |
2873 program->Initialize(output_surface_->context_provider(), precision, | 2922 program->Initialize(output_surface_->context_provider(), |
2874 SAMPLER_TYPE_2D, blend_mode); | 2923 precision, |
| 2924 SamplerType2D, |
| 2925 blend_mode); |
2875 } | 2926 } |
2876 return program; | 2927 return program; |
2877 } | 2928 } |
2878 | 2929 |
2879 const GLRenderer::RenderPassMaskColorMatrixProgram* | 2930 const GLRenderer::RenderPassMaskColorMatrixProgram* |
2880 GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision, | 2931 GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision, |
2881 SamplerType sampler, | 2932 SamplerType sampler, |
2882 BlendMode blend_mode) { | 2933 BlendMode blend_mode) { |
2883 DCHECK_GE(precision, 0); | 2934 DCHECK_GE(precision, 0); |
2884 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2935 DCHECK_LT(precision, NumTexCoordPrecisions); |
2885 DCHECK_GE(sampler, 0); | 2936 DCHECK_GE(sampler, 0); |
2886 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2937 DCHECK_LT(sampler, NumSamplerTypes); |
2887 DCHECK_GE(blend_mode, 0); | 2938 DCHECK_GE(blend_mode, 0); |
2888 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2939 DCHECK_LT(blend_mode, NumBlendModes); |
2889 RenderPassMaskColorMatrixProgram* program = | 2940 RenderPassMaskColorMatrixProgram* program = |
2890 &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode]; | 2941 &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode]; |
2891 if (!program->initialized()) { | 2942 if (!program->initialized()) { |
2892 TRACE_EVENT0("cc", | 2943 TRACE_EVENT0("cc", |
2893 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); | 2944 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); |
2894 program->Initialize( | 2945 program->Initialize( |
2895 output_surface_->context_provider(), precision, sampler, blend_mode); | 2946 output_surface_->context_provider(), precision, sampler, blend_mode); |
2896 } | 2947 } |
2897 return program; | 2948 return program; |
2898 } | 2949 } |
2899 | 2950 |
2900 const GLRenderer::RenderPassMaskColorMatrixProgramAA* | 2951 const GLRenderer::RenderPassMaskColorMatrixProgramAA* |
2901 GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision, | 2952 GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision, |
2902 SamplerType sampler, | 2953 SamplerType sampler, |
2903 BlendMode blend_mode) { | 2954 BlendMode blend_mode) { |
2904 DCHECK_GE(precision, 0); | 2955 DCHECK_GE(precision, 0); |
2905 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2956 DCHECK_LT(precision, NumTexCoordPrecisions); |
2906 DCHECK_GE(sampler, 0); | 2957 DCHECK_GE(sampler, 0); |
2907 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2958 DCHECK_LT(sampler, NumSamplerTypes); |
2908 DCHECK_GE(blend_mode, 0); | 2959 DCHECK_GE(blend_mode, 0); |
2909 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2960 DCHECK_LT(blend_mode, NumBlendModes); |
2910 RenderPassMaskColorMatrixProgramAA* program = | 2961 RenderPassMaskColorMatrixProgramAA* program = |
2911 &render_pass_mask_color_matrix_program_aa_[precision][sampler] | 2962 &render_pass_mask_color_matrix_program_aa_[precision][sampler] |
2912 [blend_mode]; | 2963 [blend_mode]; |
2913 if (!program->initialized()) { | 2964 if (!program->initialized()) { |
2914 TRACE_EVENT0("cc", | 2965 TRACE_EVENT0("cc", |
2915 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); | 2966 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); |
2916 program->Initialize( | 2967 program->Initialize( |
2917 output_surface_->context_provider(), precision, sampler, blend_mode); | 2968 output_surface_->context_provider(), precision, sampler, blend_mode); |
2918 } | 2969 } |
2919 return program; | 2970 return program; |
2920 } | 2971 } |
2921 | 2972 |
2922 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( | 2973 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( |
2923 TexCoordPrecision precision, | 2974 TexCoordPrecision precision, |
2924 SamplerType sampler) { | 2975 SamplerType sampler) { |
2925 DCHECK_GE(precision, 0); | 2976 DCHECK_GE(precision, 0); |
2926 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2977 DCHECK_LT(precision, NumTexCoordPrecisions); |
2927 DCHECK_GE(sampler, 0); | 2978 DCHECK_GE(sampler, 0); |
2928 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2979 DCHECK_LT(sampler, NumSamplerTypes); |
2929 TileProgram* program = &tile_program_[precision][sampler]; | 2980 TileProgram* program = &tile_program_[precision][sampler]; |
2930 if (!program->initialized()) { | 2981 if (!program->initialized()) { |
2931 TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize"); | 2982 TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize"); |
2932 program->Initialize( | 2983 program->Initialize( |
2933 output_surface_->context_provider(), precision, sampler); | 2984 output_surface_->context_provider(), precision, sampler); |
2934 } | 2985 } |
2935 return program; | 2986 return program; |
2936 } | 2987 } |
2937 | 2988 |
2938 const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque( | 2989 const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque( |
2939 TexCoordPrecision precision, | 2990 TexCoordPrecision precision, |
2940 SamplerType sampler) { | 2991 SamplerType sampler) { |
2941 DCHECK_GE(precision, 0); | 2992 DCHECK_GE(precision, 0); |
2942 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2993 DCHECK_LT(precision, NumTexCoordPrecisions); |
2943 DCHECK_GE(sampler, 0); | 2994 DCHECK_GE(sampler, 0); |
2944 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2995 DCHECK_LT(sampler, NumSamplerTypes); |
2945 TileProgramOpaque* program = &tile_program_opaque_[precision][sampler]; | 2996 TileProgramOpaque* program = &tile_program_opaque_[precision][sampler]; |
2946 if (!program->initialized()) { | 2997 if (!program->initialized()) { |
2947 TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize"); | 2998 TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize"); |
2948 program->Initialize( | 2999 program->Initialize( |
2949 output_surface_->context_provider(), precision, sampler); | 3000 output_surface_->context_provider(), precision, sampler); |
2950 } | 3001 } |
2951 return program; | 3002 return program; |
2952 } | 3003 } |
2953 | 3004 |
2954 const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA( | 3005 const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA( |
2955 TexCoordPrecision precision, | 3006 TexCoordPrecision precision, |
2956 SamplerType sampler) { | 3007 SamplerType sampler) { |
2957 DCHECK_GE(precision, 0); | 3008 DCHECK_GE(precision, 0); |
2958 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3009 DCHECK_LT(precision, NumTexCoordPrecisions); |
2959 DCHECK_GE(sampler, 0); | 3010 DCHECK_GE(sampler, 0); |
2960 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3011 DCHECK_LT(sampler, NumSamplerTypes); |
2961 TileProgramAA* program = &tile_program_aa_[precision][sampler]; | 3012 TileProgramAA* program = &tile_program_aa_[precision][sampler]; |
2962 if (!program->initialized()) { | 3013 if (!program->initialized()) { |
2963 TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); | 3014 TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); |
2964 program->Initialize( | 3015 program->Initialize( |
2965 output_surface_->context_provider(), precision, sampler); | 3016 output_surface_->context_provider(), precision, sampler); |
2966 } | 3017 } |
2967 return program; | 3018 return program; |
2968 } | 3019 } |
2969 | 3020 |
2970 const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle( | 3021 const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle( |
2971 TexCoordPrecision precision, | 3022 TexCoordPrecision precision, |
2972 SamplerType sampler) { | 3023 SamplerType sampler) { |
2973 DCHECK_GE(precision, 0); | 3024 DCHECK_GE(precision, 0); |
2974 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3025 DCHECK_LT(precision, NumTexCoordPrecisions); |
2975 DCHECK_GE(sampler, 0); | 3026 DCHECK_GE(sampler, 0); |
2976 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3027 DCHECK_LT(sampler, NumSamplerTypes); |
2977 TileProgramSwizzle* program = &tile_program_swizzle_[precision][sampler]; | 3028 TileProgramSwizzle* program = &tile_program_swizzle_[precision][sampler]; |
2978 if (!program->initialized()) { | 3029 if (!program->initialized()) { |
2979 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); | 3030 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); |
2980 program->Initialize( | 3031 program->Initialize( |
2981 output_surface_->context_provider(), precision, sampler); | 3032 output_surface_->context_provider(), precision, sampler); |
2982 } | 3033 } |
2983 return program; | 3034 return program; |
2984 } | 3035 } |
2985 | 3036 |
2986 const GLRenderer::TileProgramSwizzleOpaque* | 3037 const GLRenderer::TileProgramSwizzleOpaque* |
2987 GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision, | 3038 GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision, |
2988 SamplerType sampler) { | 3039 SamplerType sampler) { |
2989 DCHECK_GE(precision, 0); | 3040 DCHECK_GE(precision, 0); |
2990 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3041 DCHECK_LT(precision, NumTexCoordPrecisions); |
2991 DCHECK_GE(sampler, 0); | 3042 DCHECK_GE(sampler, 0); |
2992 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3043 DCHECK_LT(sampler, NumSamplerTypes); |
2993 TileProgramSwizzleOpaque* program = | 3044 TileProgramSwizzleOpaque* program = |
2994 &tile_program_swizzle_opaque_[precision][sampler]; | 3045 &tile_program_swizzle_opaque_[precision][sampler]; |
2995 if (!program->initialized()) { | 3046 if (!program->initialized()) { |
2996 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); | 3047 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); |
2997 program->Initialize( | 3048 program->Initialize( |
2998 output_surface_->context_provider(), precision, sampler); | 3049 output_surface_->context_provider(), precision, sampler); |
2999 } | 3050 } |
3000 return program; | 3051 return program; |
3001 } | 3052 } |
3002 | 3053 |
3003 const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA( | 3054 const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA( |
3004 TexCoordPrecision precision, | 3055 TexCoordPrecision precision, |
3005 SamplerType sampler) { | 3056 SamplerType sampler) { |
3006 DCHECK_GE(precision, 0); | 3057 DCHECK_GE(precision, 0); |
3007 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3058 DCHECK_LT(precision, NumTexCoordPrecisions); |
3008 DCHECK_GE(sampler, 0); | 3059 DCHECK_GE(sampler, 0); |
3009 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3060 DCHECK_LT(sampler, NumSamplerTypes); |
3010 TileProgramSwizzleAA* program = &tile_program_swizzle_aa_[precision][sampler]; | 3061 TileProgramSwizzleAA* program = &tile_program_swizzle_aa_[precision][sampler]; |
3011 if (!program->initialized()) { | 3062 if (!program->initialized()) { |
3012 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); | 3063 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); |
3013 program->Initialize( | 3064 program->Initialize( |
3014 output_surface_->context_provider(), precision, sampler); | 3065 output_surface_->context_provider(), precision, sampler); |
3015 } | 3066 } |
3016 return program; | 3067 return program; |
3017 } | 3068 } |
3018 | 3069 |
3019 const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram( | 3070 const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram( |
3020 TexCoordPrecision precision) { | 3071 TexCoordPrecision precision) { |
3021 DCHECK_GE(precision, 0); | 3072 DCHECK_GE(precision, 0); |
3022 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3073 DCHECK_LT(precision, NumTexCoordPrecisions); |
3023 TextureProgram* program = &texture_program_[precision]; | 3074 TextureProgram* program = &texture_program_[precision]; |
3024 if (!program->initialized()) { | 3075 if (!program->initialized()) { |
3025 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); | 3076 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); |
3026 program->Initialize(output_surface_->context_provider(), precision, | 3077 program->Initialize( |
3027 SAMPLER_TYPE_2D); | 3078 output_surface_->context_provider(), precision, SamplerType2D); |
3028 } | 3079 } |
3029 return program; | 3080 return program; |
3030 } | 3081 } |
3031 | 3082 |
3032 const GLRenderer::NonPremultipliedTextureProgram* | 3083 const GLRenderer::NonPremultipliedTextureProgram* |
3033 GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) { | 3084 GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) { |
3034 DCHECK_GE(precision, 0); | 3085 DCHECK_GE(precision, 0); |
3035 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3086 DCHECK_LT(precision, NumTexCoordPrecisions); |
3036 NonPremultipliedTextureProgram* program = | 3087 NonPremultipliedTextureProgram* program = |
3037 &nonpremultiplied_texture_program_[precision]; | 3088 &nonpremultiplied_texture_program_[precision]; |
3038 if (!program->initialized()) { | 3089 if (!program->initialized()) { |
3039 TRACE_EVENT0("cc", | 3090 TRACE_EVENT0("cc", |
3040 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); | 3091 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); |
3041 program->Initialize(output_surface_->context_provider(), precision, | 3092 program->Initialize( |
3042 SAMPLER_TYPE_2D); | 3093 output_surface_->context_provider(), precision, SamplerType2D); |
3043 } | 3094 } |
3044 return program; | 3095 return program; |
3045 } | 3096 } |
3046 | 3097 |
3047 const GLRenderer::TextureBackgroundProgram* | 3098 const GLRenderer::TextureBackgroundProgram* |
3048 GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision) { | 3099 GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision) { |
3049 DCHECK_GE(precision, 0); | 3100 DCHECK_GE(precision, 0); |
3050 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3101 DCHECK_LT(precision, NumTexCoordPrecisions); |
3051 TextureBackgroundProgram* program = &texture_background_program_[precision]; | 3102 TextureBackgroundProgram* program = &texture_background_program_[precision]; |
3052 if (!program->initialized()) { | 3103 if (!program->initialized()) { |
3053 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); | 3104 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); |
3054 program->Initialize(output_surface_->context_provider(), precision, | 3105 program->Initialize( |
3055 SAMPLER_TYPE_2D); | 3106 output_surface_->context_provider(), precision, SamplerType2D); |
3056 } | 3107 } |
3057 return program; | 3108 return program; |
3058 } | 3109 } |
3059 | 3110 |
3060 const GLRenderer::NonPremultipliedTextureBackgroundProgram* | 3111 const GLRenderer::NonPremultipliedTextureBackgroundProgram* |
3061 GLRenderer::GetNonPremultipliedTextureBackgroundProgram( | 3112 GLRenderer::GetNonPremultipliedTextureBackgroundProgram( |
3062 TexCoordPrecision precision) { | 3113 TexCoordPrecision precision) { |
3063 DCHECK_GE(precision, 0); | 3114 DCHECK_GE(precision, 0); |
3064 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3115 DCHECK_LT(precision, NumTexCoordPrecisions); |
3065 NonPremultipliedTextureBackgroundProgram* program = | 3116 NonPremultipliedTextureBackgroundProgram* program = |
3066 &nonpremultiplied_texture_background_program_[precision]; | 3117 &nonpremultiplied_texture_background_program_[precision]; |
3067 if (!program->initialized()) { | 3118 if (!program->initialized()) { |
3068 TRACE_EVENT0("cc", | 3119 TRACE_EVENT0("cc", |
3069 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); | 3120 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); |
3070 program->Initialize(output_surface_->context_provider(), precision, | 3121 program->Initialize( |
3071 SAMPLER_TYPE_2D); | 3122 output_surface_->context_provider(), precision, SamplerType2D); |
3072 } | 3123 } |
3073 return program; | 3124 return program; |
3074 } | 3125 } |
3075 | 3126 |
3076 const GLRenderer::TextureProgram* GLRenderer::GetTextureIOSurfaceProgram( | 3127 const GLRenderer::TextureProgram* GLRenderer::GetTextureIOSurfaceProgram( |
3077 TexCoordPrecision precision) { | 3128 TexCoordPrecision precision) { |
3078 DCHECK_GE(precision, 0); | 3129 DCHECK_GE(precision, 0); |
3079 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3130 DCHECK_LT(precision, NumTexCoordPrecisions); |
3080 TextureProgram* program = &texture_io_surface_program_[precision]; | 3131 TextureProgram* program = &texture_io_surface_program_[precision]; |
3081 if (!program->initialized()) { | 3132 if (!program->initialized()) { |
3082 TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize"); | 3133 TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize"); |
3083 program->Initialize(output_surface_->context_provider(), precision, | 3134 program->Initialize( |
3084 SAMPLER_TYPE_2D_RECT); | 3135 output_surface_->context_provider(), precision, SamplerType2DRect); |
3085 } | 3136 } |
3086 return program; | 3137 return program; |
3087 } | 3138 } |
3088 | 3139 |
3089 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( | 3140 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( |
3090 TexCoordPrecision precision) { | 3141 TexCoordPrecision precision) { |
3091 DCHECK_GE(precision, 0); | 3142 DCHECK_GE(precision, 0); |
3092 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3143 DCHECK_LT(precision, NumTexCoordPrecisions); |
3093 VideoYUVProgram* program = &video_yuv_program_[precision]; | 3144 VideoYUVProgram* program = &video_yuv_program_[precision]; |
3094 if (!program->initialized()) { | 3145 if (!program->initialized()) { |
3095 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); | 3146 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); |
3096 program->Initialize(output_surface_->context_provider(), precision, | 3147 program->Initialize( |
3097 SAMPLER_TYPE_2D); | 3148 output_surface_->context_provider(), precision, SamplerType2D); |
3098 } | 3149 } |
3099 return program; | 3150 return program; |
3100 } | 3151 } |
3101 | 3152 |
3102 const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram( | 3153 const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram( |
3103 TexCoordPrecision precision) { | 3154 TexCoordPrecision precision) { |
3104 DCHECK_GE(precision, 0); | 3155 DCHECK_GE(precision, 0); |
3105 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3156 DCHECK_LT(precision, NumTexCoordPrecisions); |
3106 VideoYUVAProgram* program = &video_yuva_program_[precision]; | 3157 VideoYUVAProgram* program = &video_yuva_program_[precision]; |
3107 if (!program->initialized()) { | 3158 if (!program->initialized()) { |
3108 TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize"); | 3159 TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize"); |
3109 program->Initialize(output_surface_->context_provider(), precision, | 3160 program->Initialize( |
3110 SAMPLER_TYPE_2D); | 3161 output_surface_->context_provider(), precision, SamplerType2D); |
3111 } | 3162 } |
3112 return program; | 3163 return program; |
3113 } | 3164 } |
3114 | 3165 |
3115 const GLRenderer::VideoStreamTextureProgram* | 3166 const GLRenderer::VideoStreamTextureProgram* |
3116 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { | 3167 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { |
3117 if (!Capabilities().using_egl_image) | 3168 if (!Capabilities().using_egl_image) |
3118 return NULL; | 3169 return NULL; |
3119 DCHECK_GE(precision, 0); | 3170 DCHECK_GE(precision, 0); |
3120 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3171 DCHECK_LT(precision, NumTexCoordPrecisions); |
3121 VideoStreamTextureProgram* program = | 3172 VideoStreamTextureProgram* program = |
3122 &video_stream_texture_program_[precision]; | 3173 &video_stream_texture_program_[precision]; |
3123 if (!program->initialized()) { | 3174 if (!program->initialized()) { |
3124 TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); | 3175 TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); |
3125 program->Initialize(output_surface_->context_provider(), precision, | 3176 program->Initialize( |
3126 SAMPLER_TYPE_EXTERNAL_OES); | 3177 output_surface_->context_provider(), precision, SamplerTypeExternalOES); |
3127 } | 3178 } |
3128 return program; | 3179 return program; |
3129 } | 3180 } |
3130 | 3181 |
3131 void GLRenderer::CleanupSharedObjects() { | 3182 void GLRenderer::CleanupSharedObjects() { |
3132 shared_geometry_ = nullptr; | 3183 shared_geometry_ = nullptr; |
3133 | 3184 |
3134 for (int i = 0; i <= LAST_TEX_COORD_PRECISION; ++i) { | 3185 for (int i = 0; i < NumTexCoordPrecisions; ++i) { |
3135 for (int j = 0; j <= LAST_SAMPLER_TYPE; ++j) { | 3186 for (int j = 0; j < NumSamplerTypes; ++j) { |
3136 tile_program_[i][j].Cleanup(gl_); | 3187 tile_program_[i][j].Cleanup(gl_); |
3137 tile_program_opaque_[i][j].Cleanup(gl_); | 3188 tile_program_opaque_[i][j].Cleanup(gl_); |
3138 tile_program_swizzle_[i][j].Cleanup(gl_); | 3189 tile_program_swizzle_[i][j].Cleanup(gl_); |
3139 tile_program_swizzle_opaque_[i][j].Cleanup(gl_); | 3190 tile_program_swizzle_opaque_[i][j].Cleanup(gl_); |
3140 tile_program_aa_[i][j].Cleanup(gl_); | 3191 tile_program_aa_[i][j].Cleanup(gl_); |
3141 tile_program_swizzle_aa_[i][j].Cleanup(gl_); | 3192 tile_program_swizzle_aa_[i][j].Cleanup(gl_); |
3142 | 3193 |
3143 for (int k = 0; k <= LAST_BLEND_MODE; k++) { | 3194 for (int k = 0; k < NumBlendModes; k++) { |
3144 render_pass_mask_program_[i][j][k].Cleanup(gl_); | 3195 render_pass_mask_program_[i][j][k].Cleanup(gl_); |
3145 render_pass_mask_program_aa_[i][j][k].Cleanup(gl_); | 3196 render_pass_mask_program_aa_[i][j][k].Cleanup(gl_); |
3146 render_pass_mask_color_matrix_program_aa_[i][j][k].Cleanup(gl_); | 3197 render_pass_mask_color_matrix_program_aa_[i][j][k].Cleanup(gl_); |
3147 render_pass_mask_color_matrix_program_[i][j][k].Cleanup(gl_); | 3198 render_pass_mask_color_matrix_program_[i][j][k].Cleanup(gl_); |
3148 } | 3199 } |
3149 } | 3200 } |
3150 for (int j = 0; j <= LAST_BLEND_MODE; j++) { | 3201 for (int j = 0; j < NumBlendModes; j++) { |
3151 render_pass_program_[i][j].Cleanup(gl_); | 3202 render_pass_program_[i][j].Cleanup(gl_); |
3152 render_pass_program_aa_[i][j].Cleanup(gl_); | 3203 render_pass_program_aa_[i][j].Cleanup(gl_); |
3153 render_pass_color_matrix_program_[i][j].Cleanup(gl_); | 3204 render_pass_color_matrix_program_[i][j].Cleanup(gl_); |
3154 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); | 3205 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); |
3155 } | 3206 } |
3156 | 3207 |
3157 texture_program_[i].Cleanup(gl_); | 3208 texture_program_[i].Cleanup(gl_); |
3158 nonpremultiplied_texture_program_[i].Cleanup(gl_); | 3209 nonpremultiplied_texture_program_[i].Cleanup(gl_); |
3159 texture_background_program_[i].Cleanup(gl_); | 3210 texture_background_program_[i].Cleanup(gl_); |
3160 nonpremultiplied_texture_background_program_[i].Cleanup(gl_); | 3211 nonpremultiplied_texture_background_program_[i].Cleanup(gl_); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3254 context_support_->ScheduleOverlayPlane( | 3305 context_support_->ScheduleOverlayPlane( |
3255 overlay.plane_z_order, | 3306 overlay.plane_z_order, |
3256 overlay.transform, | 3307 overlay.transform, |
3257 pending_overlay_resources_.back()->texture_id(), | 3308 pending_overlay_resources_.back()->texture_id(), |
3258 overlay.display_rect, | 3309 overlay.display_rect, |
3259 overlay.uv_rect); | 3310 overlay.uv_rect); |
3260 } | 3311 } |
3261 } | 3312 } |
3262 | 3313 |
3263 } // namespace cc | 3314 } // namespace cc |
OLD | NEW |