| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "gpu/command_buffer/service/gl_utils.h" | 10 #include "gpu/command_buffer/service/gl_utils.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 return shader_ids[index][SAMPLER_2D]; | 160 return shader_ids[index][SAMPLER_2D]; |
| 161 case GL_TEXTURE_RECTANGLE_ARB: | 161 case GL_TEXTURE_RECTANGLE_ARB: |
| 162 return shader_ids[index][SAMPLER_RECTANGLE_ARB]; | 162 return shader_ids[index][SAMPLER_RECTANGLE_ARB]; |
| 163 case GL_TEXTURE_EXTERNAL_OES: | 163 case GL_TEXTURE_EXTERNAL_OES: |
| 164 return shader_ids[index][SAMPLER_EXTERNAL_OES]; | 164 return shader_ids[index][SAMPLER_EXTERNAL_OES]; |
| 165 default: | 165 default: |
| 166 break; | 166 break; |
| 167 } | 167 } |
| 168 | 168 |
| 169 NOTREACHED(); | 169 NOTREACHED(); |
| 170 return shader_ids[index][SAMPLER_2D]; | 170 return shader_ids[0][SAMPLER_2D]; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void CompileShader(GLuint shader, const char* shader_source) { | 173 void CompileShader(GLuint shader, const char* shader_source) { |
| 174 glShaderSource(shader, 1, &shader_source, 0); | 174 glShaderSource(shader, 1, &shader_source, 0); |
| 175 glCompileShader(shader); | 175 glCompileShader(shader); |
| 176 #ifndef NDEBUG | 176 #ifndef NDEBUG |
| 177 GLint compile_status; | 177 GLint compile_status; |
| 178 glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status); | 178 glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status); |
| 179 if (GL_TRUE != compile_status) | 179 if (GL_TRUE != compile_status) |
| 180 DLOG(ERROR) << "CopyTextureCHROMIUM: shader compilation failure."; | 180 DLOG(ERROR) << "CopyTextureCHROMIUM: shader compilation failure."; |
| 181 #endif | 181 #endif |
| 182 } | 182 } |
| 183 | 183 |
| 184 void DeleteShader(GLuint shader) { | 184 void DeleteShader(GLuint shader) { |
| 185 if (shader) | 185 if (shader) |
| 186 glDeleteShader(shader); | 186 glDeleteShader(shader); |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool BindFramebufferTexture2D(GLenum target, |
| 190 GLuint texture_id, |
| 191 GLint level, |
| 192 GLuint framebuffer) { |
| 193 DCHECK(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB); |
| 194 glActiveTexture(GL_TEXTURE0); |
| 195 glBindTexture(target, texture_id); |
| 196 // NVidia drivers require texture settings to be a certain way |
| 197 // or they won't report FRAMEBUFFER_COMPLETE. |
| 198 glTexParameterf(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 199 glTexParameterf(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 200 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 201 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 202 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); |
| 203 glFramebufferTexture2DEXT( |
| 204 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, texture_id, level); |
| 205 |
| 206 #ifndef NDEBUG |
| 207 GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 208 if (GL_FRAMEBUFFER_COMPLETE != fb_status) { |
| 209 DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; |
| 210 return false; |
| 211 } |
| 212 #endif |
| 213 return true; |
| 214 } |
| 215 |
| 216 void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, |
| 217 GLenum source_target, |
| 218 GLuint source_id, |
| 219 GLuint dest_id, |
| 220 GLint dest_level, |
| 221 GLenum dest_internal_format, |
| 222 GLsizei width, |
| 223 GLsizei height, |
| 224 GLuint framebuffer) { |
| 225 DCHECK(source_target == GL_TEXTURE_2D || |
| 226 source_target == GL_TEXTURE_RECTANGLE_ARB); |
| 227 if (BindFramebufferTexture2D( |
| 228 source_target, source_id, 0 /* level */, framebuffer)) { |
| 229 glBindTexture(GL_TEXTURE_2D, dest_id); |
| 230 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 231 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 232 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 233 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 234 glCopyTexImage2D(GL_TEXTURE_2D, |
| 235 dest_level, |
| 236 dest_internal_format, |
| 237 0 /* x */, |
| 238 0 /* y */, |
| 239 width, |
| 240 height, |
| 241 0 /* border */); |
| 242 } |
| 243 |
| 244 decoder->RestoreTextureState(source_id); |
| 245 decoder->RestoreTextureState(dest_id); |
| 246 decoder->RestoreTextureUnitBindings(0); |
| 247 decoder->RestoreActiveTexture(); |
| 248 decoder->RestoreFramebufferBindings(); |
| 249 } |
| 250 |
| 189 } // namespace | 251 } // namespace |
| 190 | 252 |
| 191 namespace gpu { | 253 namespace gpu { |
| 192 | 254 |
| 193 CopyTextureCHROMIUMResourceManager::CopyTextureCHROMIUMResourceManager() | 255 CopyTextureCHROMIUMResourceManager::CopyTextureCHROMIUMResourceManager() |
| 194 : initialized_(false), | 256 : initialized_(false), |
| 195 vertex_shaders_(NUM_VERTEX_SHADERS, 0u), | 257 vertex_shaders_(NUM_VERTEX_SHADERS, 0u), |
| 196 fragment_shaders_(NUM_FRAGMENT_SHADERS, 0u), | 258 fragment_shaders_(NUM_FRAGMENT_SHADERS, 0u), |
| 197 buffer_id_(0u), | 259 buffer_id_(0u), |
| 198 framebuffer_(0u) {} | 260 framebuffer_(0u) {} |
| 199 | 261 |
| 200 CopyTextureCHROMIUMResourceManager::~CopyTextureCHROMIUMResourceManager() {} | 262 CopyTextureCHROMIUMResourceManager::~CopyTextureCHROMIUMResourceManager() { |
| 263 DCHECK(!buffer_id_); |
| 264 DCHECK(!framebuffer_); |
| 265 } |
| 201 | 266 |
| 202 void CopyTextureCHROMIUMResourceManager::Initialize( | 267 void CopyTextureCHROMIUMResourceManager::Initialize( |
| 203 const gles2::GLES2Decoder* decoder) { | 268 const gles2::GLES2Decoder* decoder) { |
| 204 COMPILE_ASSERT( | 269 COMPILE_ASSERT( |
| 205 kVertexPositionAttrib == 0u, | 270 kVertexPositionAttrib == 0u, |
| 206 Position_attribs_must_be_0); | 271 Position_attribs_must_be_0); |
| 272 DCHECK(!buffer_id_); |
| 273 DCHECK(!framebuffer_); |
| 274 DCHECK(programs_.empty()); |
| 207 | 275 |
| 208 // Initialize all of the GPU resources required to perform the copy. | 276 // Initialize all of the GPU resources required to perform the copy. |
| 209 glGenBuffersARB(1, &buffer_id_); | 277 glGenBuffersARB(1, &buffer_id_); |
| 210 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); | 278 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); |
| 211 const GLfloat kQuadVertices[] = {-1.0f, -1.0f, | 279 const GLfloat kQuadVertices[] = {-1.0f, -1.0f, |
| 212 1.0f, -1.0f, | 280 1.0f, -1.0f, |
| 213 1.0f, 1.0f, | 281 1.0f, 1.0f, |
| 214 -1.0f, 1.0f}; | 282 -1.0f, 1.0f}; |
| 215 glBufferData( | 283 glBufferData( |
| 216 GL_ARRAY_BUFFER, sizeof(kQuadVertices), kQuadVertices, GL_STATIC_DRAW); | 284 GL_ARRAY_BUFFER, sizeof(kQuadVertices), kQuadVertices, GL_STATIC_DRAW); |
| 217 | 285 |
| 218 glGenFramebuffersEXT(1, &framebuffer_); | 286 glGenFramebuffersEXT(1, &framebuffer_); |
| 219 | 287 |
| 220 decoder->RestoreBufferBindings(); | 288 decoder->RestoreBufferBindings(); |
| 221 | 289 |
| 222 initialized_ = true; | 290 initialized_ = true; |
| 223 } | 291 } |
| 224 | 292 |
| 225 void CopyTextureCHROMIUMResourceManager::Destroy() { | 293 void CopyTextureCHROMIUMResourceManager::Destroy() { |
| 226 if (!initialized_) | 294 if (!initialized_) |
| 227 return; | 295 return; |
| 228 | 296 |
| 229 glDeleteFramebuffersEXT(1, &framebuffer_); | 297 glDeleteFramebuffersEXT(1, &framebuffer_); |
| 298 framebuffer_ = 0; |
| 230 | 299 |
| 231 std::for_each(vertex_shaders_.begin(), vertex_shaders_.end(), DeleteShader); | 300 std::for_each(vertex_shaders_.begin(), vertex_shaders_.end(), DeleteShader); |
| 232 std::for_each( | 301 std::for_each( |
| 233 fragment_shaders_.begin(), fragment_shaders_.end(), DeleteShader); | 302 fragment_shaders_.begin(), fragment_shaders_.end(), DeleteShader); |
| 234 | 303 |
| 235 for (ProgramMap::const_iterator it = programs_.begin(); it != programs_.end(); | 304 for (ProgramMap::const_iterator it = programs_.begin(); it != programs_.end(); |
| 236 ++it) { | 305 ++it) { |
| 237 const ProgramInfo& info = it->second; | 306 const ProgramInfo& info = it->second; |
| 238 glDeleteProgram(info.program); | 307 glDeleteProgram(info.program); |
| 239 } | 308 } |
| 240 | 309 |
| 241 glDeleteBuffersARB(1, &buffer_id_); | 310 glDeleteBuffersARB(1, &buffer_id_); |
| 311 buffer_id_ = 0; |
| 242 } | 312 } |
| 243 | 313 |
| 244 void CopyTextureCHROMIUMResourceManager::DoCopyTexture( | 314 void CopyTextureCHROMIUMResourceManager::DoCopyTexture( |
| 245 const gles2::GLES2Decoder* decoder, | 315 const gles2::GLES2Decoder* decoder, |
| 246 GLenum source_target, | 316 GLenum source_target, |
| 247 GLenum dest_target, | |
| 248 GLuint source_id, | 317 GLuint source_id, |
| 318 GLenum source_internal_format, |
| 249 GLuint dest_id, | 319 GLuint dest_id, |
| 250 GLint level, | 320 GLint dest_level, |
| 321 GLenum dest_internal_format, |
| 251 GLsizei width, | 322 GLsizei width, |
| 252 GLsizei height, | 323 GLsizei height, |
| 253 bool flip_y, | 324 bool flip_y, |
| 254 bool premultiply_alpha, | 325 bool premultiply_alpha, |
| 255 bool unpremultiply_alpha) { | 326 bool unpremultiply_alpha) { |
| 327 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; |
| 328 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's |
| 329 // format does not contain a superset of the components required by the base |
| 330 // format of internalformat. |
| 331 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml |
| 332 bool source_format_contain_superset_of_dest_format = |
| 333 source_internal_format == dest_internal_format || |
| 334 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); |
| 335 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, |
| 336 // so restrict this to GL_TEXTURE_2D. |
| 337 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && |
| 338 source_format_contain_superset_of_dest_format) { |
| 339 DoCopyTexImage2D(decoder, |
| 340 source_target, |
| 341 source_id, |
| 342 dest_id, |
| 343 dest_level, |
| 344 dest_internal_format, |
| 345 width, |
| 346 height, |
| 347 framebuffer_); |
| 348 return; |
| 349 } |
| 350 |
| 256 // Use default transform matrix if no transform passed in. | 351 // Use default transform matrix if no transform passed in. |
| 257 const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, | 352 const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, |
| 258 0.0f, 1.0f, 0.0f, 0.0f, | 353 0.0f, 1.0f, 0.0f, 0.0f, |
| 259 0.0f, 0.0f, 1.0f, 0.0f, | 354 0.0f, 0.0f, 1.0f, 0.0f, |
| 260 0.0f, 0.0f, 0.0f, 1.0f}; | 355 0.0f, 0.0f, 0.0f, 1.0f}; |
| 261 DoCopyTextureWithTransform(decoder, source_target, dest_target, source_id, | 356 DoCopyTextureWithTransform(decoder, |
| 262 dest_id, level, width, height, flip_y, premultiply_alpha, | 357 source_target, |
| 263 unpremultiply_alpha, default_matrix); | 358 source_id, |
| 359 dest_id, |
| 360 dest_level, |
| 361 width, |
| 362 height, |
| 363 flip_y, |
| 364 premultiply_alpha, |
| 365 unpremultiply_alpha, |
| 366 default_matrix); |
| 264 } | 367 } |
| 265 | 368 |
| 266 void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform( | 369 void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform( |
| 267 const gles2::GLES2Decoder* decoder, | 370 const gles2::GLES2Decoder* decoder, |
| 268 GLenum source_target, | 371 GLenum source_target, |
| 269 GLenum dest_target, | |
| 270 GLuint source_id, | 372 GLuint source_id, |
| 271 GLuint dest_id, | 373 GLuint dest_id, |
| 272 GLint level, | 374 GLint dest_level, |
| 273 GLsizei width, | 375 GLsizei width, |
| 274 GLsizei height, | 376 GLsizei height, |
| 275 bool flip_y, | 377 bool flip_y, |
| 276 bool premultiply_alpha, | 378 bool premultiply_alpha, |
| 277 bool unpremultiply_alpha, | 379 bool unpremultiply_alpha, |
| 278 const GLfloat transform_matrix[16]) { | 380 const GLfloat transform_matrix[16]) { |
| 279 DCHECK(source_target == GL_TEXTURE_2D || | 381 DCHECK(source_target == GL_TEXTURE_2D || |
| 280 source_target == GL_TEXTURE_RECTANGLE_ARB || | 382 source_target == GL_TEXTURE_RECTANGLE_ARB || |
| 281 source_target == GL_TEXTURE_EXTERNAL_OES); | 383 source_target == GL_TEXTURE_EXTERNAL_OES); |
| 282 if (!initialized_) { | 384 if (!initialized_) { |
| 283 DLOG(ERROR) << "CopyTextureCHROMIUM: Uninitialized manager."; | 385 DLOG(ERROR) << "CopyTextureCHROMIUM: Uninitialized manager."; |
| 284 return; | 386 return; |
| 285 } | 387 } |
| 286 | 388 |
| 287 VertexShaderId vertex_shader_id = GetVertexShaderId(flip_y); | 389 VertexShaderId vertex_shader_id = GetVertexShaderId(flip_y); |
| 288 DCHECK_LT(static_cast<size_t>(vertex_shader_id), vertex_shaders_.size()); | 390 DCHECK_LT(static_cast<size_t>(vertex_shader_id), vertex_shaders_.size()); |
| 289 GLuint* vertex_shader = &vertex_shaders_[vertex_shader_id]; | |
| 290 if (!*vertex_shader) { | |
| 291 *vertex_shader = glCreateShader(GL_VERTEX_SHADER); | |
| 292 CompileShader(*vertex_shader, vertex_shader_source[vertex_shader_id]); | |
| 293 } | |
| 294 | |
| 295 FragmentShaderId fragment_shader_id = GetFragmentShaderId( | 391 FragmentShaderId fragment_shader_id = GetFragmentShaderId( |
| 296 premultiply_alpha, unpremultiply_alpha, source_target); | 392 premultiply_alpha, unpremultiply_alpha, source_target); |
| 297 DCHECK_LT(static_cast<size_t>(fragment_shader_id), fragment_shaders_.size()); | 393 DCHECK_LT(static_cast<size_t>(fragment_shader_id), fragment_shaders_.size()); |
| 298 GLuint* fragment_shader = &fragment_shaders_[fragment_shader_id]; | |
| 299 if (!*fragment_shader) { | |
| 300 *fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); | |
| 301 CompileShader(*fragment_shader, fragment_shader_source[fragment_shader_id]); | |
| 302 } | |
| 303 | 394 |
| 304 ProgramMapKey key(vertex_shader_id, fragment_shader_id); | 395 ProgramMapKey key(vertex_shader_id, fragment_shader_id); |
| 305 ProgramInfo* info = &programs_[key]; | 396 ProgramInfo* info = &programs_[key]; |
| 306 // Create program if necessary. | 397 // Create program if necessary. |
| 307 if (!info->program) { | 398 if (!info->program) { |
| 308 info->program = glCreateProgram(); | 399 info->program = glCreateProgram(); |
| 400 GLuint* vertex_shader = &vertex_shaders_[vertex_shader_id]; |
| 401 if (!*vertex_shader) { |
| 402 *vertex_shader = glCreateShader(GL_VERTEX_SHADER); |
| 403 CompileShader(*vertex_shader, vertex_shader_source[vertex_shader_id]); |
| 404 } |
| 309 glAttachShader(info->program, *vertex_shader); | 405 glAttachShader(info->program, *vertex_shader); |
| 406 GLuint* fragment_shader = &fragment_shaders_[fragment_shader_id]; |
| 407 if (!*fragment_shader) { |
| 408 *fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); |
| 409 CompileShader(*fragment_shader, |
| 410 fragment_shader_source[fragment_shader_id]); |
| 411 } |
| 310 glAttachShader(info->program, *fragment_shader); | 412 glAttachShader(info->program, *fragment_shader); |
| 311 glBindAttribLocation(info->program, kVertexPositionAttrib, "a_position"); | 413 glBindAttribLocation(info->program, kVertexPositionAttrib, "a_position"); |
| 312 glLinkProgram(info->program); | 414 glLinkProgram(info->program); |
| 313 #ifndef NDEBUG | 415 #ifndef NDEBUG |
| 314 GLint linked; | 416 GLint linked; |
| 315 glGetProgramiv(info->program, GL_LINK_STATUS, &linked); | 417 glGetProgramiv(info->program, GL_LINK_STATUS, &linked); |
| 316 if (!linked) | 418 if (!linked) |
| 317 DLOG(ERROR) << "CopyTextureCHROMIUM: program link failure."; | 419 DLOG(ERROR) << "CopyTextureCHROMIUM: program link failure."; |
| 318 #endif | 420 #endif |
| 319 info->matrix_handle = glGetUniformLocation(info->program, "u_matrix"); | 421 info->matrix_handle = glGetUniformLocation(info->program, "u_matrix"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 330 DLOG(ERROR) << "CopyTextureCHROMIUM: Invalid shader."; | 432 DLOG(ERROR) << "CopyTextureCHROMIUM: Invalid shader."; |
| 331 return; | 433 return; |
| 332 } | 434 } |
| 333 #endif | 435 #endif |
| 334 | 436 |
| 335 glUniformMatrix4fv(info->matrix_handle, 1, GL_FALSE, transform_matrix); | 437 glUniformMatrix4fv(info->matrix_handle, 1, GL_FALSE, transform_matrix); |
| 336 if (source_target == GL_TEXTURE_RECTANGLE_ARB) | 438 if (source_target == GL_TEXTURE_RECTANGLE_ARB) |
| 337 glUniform2f(info->half_size_handle, width / 2.0f, height / 2.0f); | 439 glUniform2f(info->half_size_handle, width / 2.0f, height / 2.0f); |
| 338 else | 440 else |
| 339 glUniform2f(info->half_size_handle, 0.5f, 0.5f); | 441 glUniform2f(info->half_size_handle, 0.5f, 0.5f); |
| 340 glActiveTexture(GL_TEXTURE0); | |
| 341 glBindTexture(GL_TEXTURE_2D, dest_id); | |
| 342 // NVidia drivers require texture settings to be a certain way | |
| 343 // or they won't report FRAMEBUFFER_COMPLETE. | |
| 344 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | |
| 345 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | |
| 346 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | |
| 347 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | |
| 348 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer_); | |
| 349 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest_target, | |
| 350 dest_id, level); | |
| 351 | 442 |
| 352 #ifndef NDEBUG | 443 if (BindFramebufferTexture2D( |
| 353 GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 444 GL_TEXTURE_2D, dest_id, dest_level, framebuffer_)) { |
| 354 if (GL_FRAMEBUFFER_COMPLETE != fb_status) { | |
| 355 DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; | |
| 356 } else | |
| 357 #endif | |
| 358 { | |
| 359 decoder->ClearAllAttributes(); | 445 decoder->ClearAllAttributes(); |
| 360 glEnableVertexAttribArray(kVertexPositionAttrib); | 446 glEnableVertexAttribArray(kVertexPositionAttrib); |
| 361 | 447 |
| 362 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); | 448 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); |
| 363 glVertexAttribPointer(kVertexPositionAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0); | 449 glVertexAttribPointer(kVertexPositionAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0); |
| 364 | 450 |
| 365 glUniform1i(info->sampler_handle, 0); | 451 glUniform1i(info->sampler_handle, 0); |
| 366 | 452 |
| 367 glBindTexture(source_target, source_id); | 453 glBindTexture(source_target, source_id); |
| 368 glTexParameterf(source_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 454 glTexParameterf(source_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 387 decoder->RestoreTextureState(dest_id); | 473 decoder->RestoreTextureState(dest_id); |
| 388 decoder->RestoreTextureUnitBindings(0); | 474 decoder->RestoreTextureUnitBindings(0); |
| 389 decoder->RestoreActiveTexture(); | 475 decoder->RestoreActiveTexture(); |
| 390 decoder->RestoreProgramBindings(); | 476 decoder->RestoreProgramBindings(); |
| 391 decoder->RestoreBufferBindings(); | 477 decoder->RestoreBufferBindings(); |
| 392 decoder->RestoreFramebufferBindings(); | 478 decoder->RestoreFramebufferBindings(); |
| 393 decoder->RestoreGlobalState(); | 479 decoder->RestoreGlobalState(); |
| 394 } | 480 } |
| 395 | 481 |
| 396 } // namespace gpu | 482 } // namespace gpu |
| OLD | NEW |