| 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 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 // Set the correct blending mode. | 2103 // Set the correct blending mode. |
| 2104 SetBlendEnabled(draw_cache_.needs_blending); | 2104 SetBlendEnabled(draw_cache_.needs_blending); |
| 2105 | 2105 |
| 2106 // Bind the program to the GL state. | 2106 // Bind the program to the GL state. |
| 2107 SetUseProgram(draw_cache_.program_id); | 2107 SetUseProgram(draw_cache_.program_id); |
| 2108 | 2108 |
| 2109 // Bind the correct texture sampler location. | 2109 // Bind the correct texture sampler location. |
| 2110 GLC(gl_, gl_->Uniform1i(draw_cache_.sampler_location, 0)); | 2110 GLC(gl_, gl_->Uniform1i(draw_cache_.sampler_location, 0)); |
| 2111 | 2111 |
| 2112 // Assume the current active textures is 0. | 2112 // Assume the current active textures is 0. |
| 2113 ResourceProvider::ScopedReadLockGL locked_quad(resource_provider_, | 2113 ResourceProvider::ScopedSamplerGL locked_quad( |
| 2114 draw_cache_.resource_id); | 2114 resource_provider_, |
| 2115 draw_cache_.resource_id, |
| 2116 draw_cache_.nearest_neighbor ? GL_NEAREST : GL_LINEAR); |
| 2115 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 2117 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
| 2116 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id())); | 2118 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id())); |
| 2117 | 2119 |
| 2118 COMPILE_ASSERT(sizeof(Float4) == 4 * sizeof(float), struct_is_densely_packed); | 2120 COMPILE_ASSERT(sizeof(Float4) == 4 * sizeof(float), struct_is_densely_packed); |
| 2119 COMPILE_ASSERT(sizeof(Float16) == 16 * sizeof(float), | 2121 COMPILE_ASSERT(sizeof(Float16) == 16 * sizeof(float), |
| 2120 struct_is_densely_packed); | 2122 struct_is_densely_packed); |
| 2121 | 2123 |
| 2122 // Upload the tranforms for both points and uvs. | 2124 // Upload the tranforms for both points and uvs. |
| 2123 GLC(gl_, | 2125 GLC(gl_, |
| 2124 gl_->UniformMatrix4fv( | 2126 gl_->UniformMatrix4fv( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 binding.Set( | 2184 binding.Set( |
| 2183 GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision)); | 2185 GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision)); |
| 2184 } | 2186 } |
| 2185 } | 2187 } |
| 2186 | 2188 |
| 2187 int resource_id = quad->resource_id; | 2189 int resource_id = quad->resource_id; |
| 2188 | 2190 |
| 2189 if (draw_cache_.program_id != binding.program_id || | 2191 if (draw_cache_.program_id != binding.program_id || |
| 2190 draw_cache_.resource_id != resource_id || | 2192 draw_cache_.resource_id != resource_id || |
| 2191 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || | 2193 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || |
| 2194 draw_cache_.nearest_neighbor != quad->nearest_neighbor || |
| 2192 draw_cache_.background_color != quad->background_color || | 2195 draw_cache_.background_color != quad->background_color || |
| 2193 draw_cache_.matrix_data.size() >= 8) { | 2196 draw_cache_.matrix_data.size() >= 8) { |
| 2194 FlushTextureQuadCache(); | 2197 FlushTextureQuadCache(); |
| 2195 draw_cache_.program_id = binding.program_id; | 2198 draw_cache_.program_id = binding.program_id; |
| 2196 draw_cache_.resource_id = resource_id; | 2199 draw_cache_.resource_id = resource_id; |
| 2197 draw_cache_.needs_blending = quad->ShouldDrawWithBlending(); | 2200 draw_cache_.needs_blending = quad->ShouldDrawWithBlending(); |
| 2201 draw_cache_.nearest_neighbor = quad->nearest_neighbor; |
| 2198 draw_cache_.background_color = quad->background_color; | 2202 draw_cache_.background_color = quad->background_color; |
| 2199 | 2203 |
| 2200 draw_cache_.uv_xform_location = binding.tex_transform_location; | 2204 draw_cache_.uv_xform_location = binding.tex_transform_location; |
| 2201 draw_cache_.background_color_location = binding.background_color_location; | 2205 draw_cache_.background_color_location = binding.background_color_location; |
| 2202 draw_cache_.vertex_opacity_location = binding.vertex_opacity_location; | 2206 draw_cache_.vertex_opacity_location = binding.vertex_opacity_location; |
| 2203 draw_cache_.matrix_location = binding.matrix_location; | 2207 draw_cache_.matrix_location = binding.matrix_location; |
| 2204 draw_cache_.sampler_location = binding.sampler_location; | 2208 draw_cache_.sampler_location = binding.sampler_location; |
| 2205 } | 2209 } |
| 2206 | 2210 |
| 2207 // Generate the uv-transform | 2211 // Generate the uv-transform |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 context_support_->ScheduleOverlayPlane( | 3362 context_support_->ScheduleOverlayPlane( |
| 3359 overlay.plane_z_order, | 3363 overlay.plane_z_order, |
| 3360 overlay.transform, | 3364 overlay.transform, |
| 3361 pending_overlay_resources_.back()->texture_id(), | 3365 pending_overlay_resources_.back()->texture_id(), |
| 3362 overlay.display_rect, | 3366 overlay.display_rect, |
| 3363 overlay.uv_rect); | 3367 overlay.uv_rect); |
| 3364 } | 3368 } |
| 3365 } | 3369 } |
| 3366 | 3370 |
| 3367 } // namespace cc | 3371 } // namespace cc |
| OLD | NEW |