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 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 // Set the correct blending mode. | 2047 // Set the correct blending mode. |
2048 SetBlendEnabled(draw_cache_.needs_blending); | 2048 SetBlendEnabled(draw_cache_.needs_blending); |
2049 | 2049 |
2050 // Bind the program to the GL state. | 2050 // Bind the program to the GL state. |
2051 SetUseProgram(draw_cache_.program_id); | 2051 SetUseProgram(draw_cache_.program_id); |
2052 | 2052 |
2053 // Bind the correct texture sampler location. | 2053 // Bind the correct texture sampler location. |
2054 GLC(gl_, gl_->Uniform1i(draw_cache_.sampler_location, 0)); | 2054 GLC(gl_, gl_->Uniform1i(draw_cache_.sampler_location, 0)); |
2055 | 2055 |
2056 // Assume the current active textures is 0. | 2056 // Assume the current active textures is 0. |
2057 ResourceProvider::ScopedReadLockGL locked_quad(resource_provider_, | 2057 ResourceProvider::ScopedSamplerGL locked_quad( |
2058 draw_cache_.resource_id); | 2058 resource_provider_, |
| 2059 draw_cache_.resource_id, |
| 2060 draw_cache_.nearest_neighbor ? GL_NEAREST : GL_LINEAR); |
2059 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 2061 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
2060 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id())); | 2062 GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id())); |
2061 | 2063 |
2062 COMPILE_ASSERT(sizeof(Float4) == 4 * sizeof(float), struct_is_densely_packed); | 2064 COMPILE_ASSERT(sizeof(Float4) == 4 * sizeof(float), struct_is_densely_packed); |
2063 COMPILE_ASSERT(sizeof(Float16) == 16 * sizeof(float), | 2065 COMPILE_ASSERT(sizeof(Float16) == 16 * sizeof(float), |
2064 struct_is_densely_packed); | 2066 struct_is_densely_packed); |
2065 | 2067 |
2066 // Upload the tranforms for both points and uvs. | 2068 // Upload the tranforms for both points and uvs. |
2067 GLC(gl_, | 2069 GLC(gl_, |
2068 gl_->UniformMatrix4fv( | 2070 gl_->UniformMatrix4fv( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 binding.Set( | 2128 binding.Set( |
2127 GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision)); | 2129 GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision)); |
2128 } | 2130 } |
2129 } | 2131 } |
2130 | 2132 |
2131 int resource_id = quad->resource_id; | 2133 int resource_id = quad->resource_id; |
2132 | 2134 |
2133 if (draw_cache_.program_id != binding.program_id || | 2135 if (draw_cache_.program_id != binding.program_id || |
2134 draw_cache_.resource_id != resource_id || | 2136 draw_cache_.resource_id != resource_id || |
2135 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || | 2137 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || |
| 2138 draw_cache_.nearest_neighbor != quad->nearest_neighbor || |
2136 draw_cache_.background_color != quad->background_color || | 2139 draw_cache_.background_color != quad->background_color || |
2137 draw_cache_.matrix_data.size() >= 8) { | 2140 draw_cache_.matrix_data.size() >= 8) { |
2138 FlushTextureQuadCache(); | 2141 FlushTextureQuadCache(); |
2139 draw_cache_.program_id = binding.program_id; | 2142 draw_cache_.program_id = binding.program_id; |
2140 draw_cache_.resource_id = resource_id; | 2143 draw_cache_.resource_id = resource_id; |
2141 draw_cache_.needs_blending = quad->ShouldDrawWithBlending(); | 2144 draw_cache_.needs_blending = quad->ShouldDrawWithBlending(); |
| 2145 draw_cache_.nearest_neighbor = quad->nearest_neighbor; |
2142 draw_cache_.background_color = quad->background_color; | 2146 draw_cache_.background_color = quad->background_color; |
2143 | 2147 |
2144 draw_cache_.uv_xform_location = binding.tex_transform_location; | 2148 draw_cache_.uv_xform_location = binding.tex_transform_location; |
2145 draw_cache_.background_color_location = binding.background_color_location; | 2149 draw_cache_.background_color_location = binding.background_color_location; |
2146 draw_cache_.vertex_opacity_location = binding.vertex_opacity_location; | 2150 draw_cache_.vertex_opacity_location = binding.vertex_opacity_location; |
2147 draw_cache_.matrix_location = binding.matrix_location; | 2151 draw_cache_.matrix_location = binding.matrix_location; |
2148 draw_cache_.sampler_location = binding.sampler_location; | 2152 draw_cache_.sampler_location = binding.sampler_location; |
2149 } | 2153 } |
2150 | 2154 |
2151 // Generate the uv-transform | 2155 // Generate the uv-transform |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3284 context_support_->ScheduleOverlayPlane( | 3288 context_support_->ScheduleOverlayPlane( |
3285 overlay.plane_z_order, | 3289 overlay.plane_z_order, |
3286 overlay.transform, | 3290 overlay.transform, |
3287 pending_overlay_resources_.back()->texture_id(), | 3291 pending_overlay_resources_.back()->texture_id(), |
3288 overlay.display_rect, | 3292 overlay.display_rect, |
3289 overlay.uv_rect); | 3293 overlay.uv_rect); |
3290 } | 3294 } |
3291 } | 3295 } |
3292 | 3296 |
3293 } // namespace cc | 3297 } // namespace cc |
OLD | NEW |