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