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