| 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/common/gles2_cmd_utils.h" |
| 10 #include "gpu/command_buffer/service/gl_utils.h" | 11 #include "gpu/command_buffer/service/gl_utils.h" |
| 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 12 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 12 | 13 |
| 13 #define SHADER(src) \ | 14 #define SHADER(src) \ |
| 14 "#ifdef GL_ES\n" \ | 15 "#ifdef GL_ES\n" \ |
| 15 "precision mediump float;\n" \ | 16 "precision mediump float;\n" \ |
| 16 "#define TexCoordPrecision mediump\n" \ | 17 "#define TexCoordPrecision mediump\n" \ |
| 17 "#else\n" \ | 18 "#else\n" \ |
| 18 "#define TexCoordPrecision\n" \ | 19 "#define TexCoordPrecision\n" \ |
| 19 "#endif\n" #src | 20 "#endif\n" #src |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 194 } |
| 194 | 195 |
| 195 void DeleteShader(GLuint shader) { | 196 void DeleteShader(GLuint shader) { |
| 196 if (shader) | 197 if (shader) |
| 197 glDeleteShader(shader); | 198 glDeleteShader(shader); |
| 198 } | 199 } |
| 199 | 200 |
| 200 bool BindFramebufferTexture2D(GLenum target, | 201 bool BindFramebufferTexture2D(GLenum target, |
| 201 GLuint texture_id, | 202 GLuint texture_id, |
| 202 GLuint framebuffer) { | 203 GLuint framebuffer) { |
| 203 DCHECK(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB); | 204 GLenum binding_target = gpu::gles2::GLES2Util::GLFaceToTarget(target); |
| 205 DCHECK(binding_target == GL_TEXTURE_2D || |
| 206 binding_target == GL_TEXTURE_RECTANGLE_ARB || |
| 207 binding_target == GL_TEXTURE_CUBE_MAP); |
| 204 glActiveTexture(GL_TEXTURE0); | 208 glActiveTexture(GL_TEXTURE0); |
| 205 glBindTexture(target, texture_id); | 209 glBindTexture(binding_target, texture_id); |
| 206 // NVidia drivers require texture settings to be a certain way | 210 // NVidia drivers require texture settings to be a certain way |
| 207 // or they won't report FRAMEBUFFER_COMPLETE. | 211 // or they won't report FRAMEBUFFER_COMPLETE. |
| 208 glTexParameterf(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 212 glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 209 glTexParameterf(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 213 glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 210 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 214 glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 211 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 215 glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 212 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); | 216 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); |
| 213 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, | 217 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, |
| 214 texture_id, 0); | 218 texture_id, 0); |
| 215 | 219 |
| 216 #ifndef NDEBUG | 220 #ifndef NDEBUG |
| 217 GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 221 GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 218 if (GL_FRAMEBUFFER_COMPLETE != fb_status) { | 222 if (GL_FRAMEBUFFER_COMPLETE != fb_status) { |
| 219 DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; | 223 DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; |
| 220 return false; | 224 return false; |
| 221 } | 225 } |
| 222 #endif | 226 #endif |
| 223 return true; | 227 return true; |
| 224 } | 228 } |
| 225 | 229 |
| 226 void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, | 230 void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, |
| 227 GLenum source_target, | 231 GLenum source_target, |
| 228 GLuint source_id, | 232 GLuint source_id, |
| 233 GLenum dest_target, |
| 229 GLuint dest_id, | 234 GLuint dest_id, |
| 230 GLenum dest_internal_format, | 235 GLenum dest_internal_format, |
| 231 GLsizei width, | 236 GLsizei width, |
| 232 GLsizei height, | 237 GLsizei height, |
| 233 GLuint framebuffer) { | 238 GLuint framebuffer) { |
| 234 DCHECK(source_target == GL_TEXTURE_2D || | 239 DCHECK(source_target == GL_TEXTURE_2D || |
| 235 source_target == GL_TEXTURE_RECTANGLE_ARB); | 240 source_target == GL_TEXTURE_RECTANGLE_ARB); |
| 236 if (BindFramebufferTexture2D(source_target, source_id, framebuffer)) { | 241 if (BindFramebufferTexture2D(source_target, source_id, framebuffer)) { |
| 237 glBindTexture(GL_TEXTURE_2D, dest_id); | 242 GLenum binding_target = gpu::gles2::GLES2Util::GLFaceToTarget(dest_target); |
| 238 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 243 glBindTexture(binding_target, dest_id); |
| 239 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 244 glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 240 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 245 glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 241 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 246 glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 242 glCopyTexImage2D(GL_TEXTURE_2D, 0 /* level */, dest_internal_format, | 247 glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 248 glCopyTexImage2D(dest_target, 0 /* level */, dest_internal_format, |
| 243 0 /* x */, 0 /* y */, width, height, 0 /* border */); | 249 0 /* x */, 0 /* y */, width, height, 0 /* border */); |
| 244 } | 250 } |
| 245 | 251 |
| 246 decoder->RestoreTextureState(source_id); | 252 decoder->RestoreTextureState(source_id); |
| 247 decoder->RestoreTextureState(dest_id); | 253 decoder->RestoreTextureState(dest_id); |
| 248 decoder->RestoreTextureUnitBindings(0); | 254 decoder->RestoreTextureUnitBindings(0); |
| 249 decoder->RestoreActiveTexture(); | 255 decoder->RestoreActiveTexture(); |
| 250 decoder->RestoreFramebufferBindings(); | 256 decoder->RestoreFramebufferBindings(); |
| 251 } | 257 } |
| 252 | 258 |
| 253 void DoCopyTexSubImage2D(const gpu::gles2::GLES2Decoder* decoder, | 259 void DoCopyTexSubImage2D(const gpu::gles2::GLES2Decoder* decoder, |
| 254 GLenum source_target, | 260 GLenum source_target, |
| 255 GLuint source_id, | 261 GLuint source_id, |
| 262 GLenum dest_target, |
| 256 GLuint dest_id, | 263 GLuint dest_id, |
| 257 GLint xoffset, | 264 GLint xoffset, |
| 258 GLint yoffset, | 265 GLint yoffset, |
| 259 GLint source_x, | 266 GLint source_x, |
| 260 GLint source_y, | 267 GLint source_y, |
| 261 GLsizei source_width, | 268 GLsizei source_width, |
| 262 GLsizei source_height, | 269 GLsizei source_height, |
| 263 GLuint framebuffer) { | 270 GLuint framebuffer) { |
| 264 DCHECK(source_target == GL_TEXTURE_2D || | 271 DCHECK(source_target == GL_TEXTURE_2D || |
| 265 source_target == GL_TEXTURE_RECTANGLE_ARB); | 272 source_target == GL_TEXTURE_RECTANGLE_ARB); |
| 266 if (BindFramebufferTexture2D(source_target, source_id, framebuffer)) { | 273 if (BindFramebufferTexture2D(source_target, source_id, framebuffer)) { |
| 267 glBindTexture(GL_TEXTURE_2D, dest_id); | 274 GLenum binding_target = gpu::gles2::GLES2Util::GLFaceToTarget(dest_target); |
| 268 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 275 glBindTexture(binding_target, dest_id); |
| 269 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 276 glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 270 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 277 glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 271 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 278 glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 272 glCopyTexSubImage2D(GL_TEXTURE_2D, 0 /* level */, xoffset, yoffset, | 279 glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 273 source_x, source_y, source_width, source_height); | 280 glCopyTexSubImage2D(dest_target, 0 /* level */, xoffset, yoffset, source_x, |
| 281 source_y, source_width, source_height); |
| 274 } | 282 } |
| 275 | 283 |
| 276 decoder->RestoreTextureState(source_id); | 284 decoder->RestoreTextureState(source_id); |
| 277 decoder->RestoreTextureState(dest_id); | 285 decoder->RestoreTextureState(dest_id); |
| 278 decoder->RestoreTextureUnitBindings(0); | 286 decoder->RestoreTextureUnitBindings(0); |
| 279 decoder->RestoreActiveTexture(); | 287 decoder->RestoreActiveTexture(); |
| 280 decoder->RestoreFramebufferBindings(); | 288 decoder->RestoreFramebufferBindings(); |
| 281 } | 289 } |
| 282 | 290 |
| 283 } // namespace | 291 } // namespace |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 350 |
| 343 glDeleteBuffersARB(1, &buffer_id_); | 351 glDeleteBuffersARB(1, &buffer_id_); |
| 344 buffer_id_ = 0; | 352 buffer_id_ = 0; |
| 345 } | 353 } |
| 346 | 354 |
| 347 void CopyTextureCHROMIUMResourceManager::DoCopyTexture( | 355 void CopyTextureCHROMIUMResourceManager::DoCopyTexture( |
| 348 const gles2::GLES2Decoder* decoder, | 356 const gles2::GLES2Decoder* decoder, |
| 349 GLenum source_target, | 357 GLenum source_target, |
| 350 GLuint source_id, | 358 GLuint source_id, |
| 351 GLenum source_internal_format, | 359 GLenum source_internal_format, |
| 360 GLenum dest_target, |
| 352 GLuint dest_id, | 361 GLuint dest_id, |
| 353 GLenum dest_internal_format, | 362 GLenum dest_internal_format, |
| 354 GLsizei width, | 363 GLsizei width, |
| 355 GLsizei height, | 364 GLsizei height, |
| 356 bool flip_y, | 365 bool flip_y, |
| 357 bool premultiply_alpha, | 366 bool premultiply_alpha, |
| 358 bool unpremultiply_alpha) { | 367 bool unpremultiply_alpha) { |
| 359 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; | 368 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; |
| 360 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's | 369 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's |
| 361 // format does not contain a superset of the components required by the base | 370 // format does not contain a superset of the components required by the base |
| 362 // format of internalformat. | 371 // format of internalformat. |
| 363 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml | 372 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml |
| 364 bool source_format_contain_superset_of_dest_format = | 373 bool source_format_contain_superset_of_dest_format = |
| 365 (source_internal_format == dest_internal_format && | 374 (source_internal_format == dest_internal_format && |
| 366 source_internal_format != GL_BGRA_EXT) || | 375 source_internal_format != GL_BGRA_EXT) || |
| 367 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); | 376 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); |
| 368 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, | 377 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, |
| 369 // so restrict this to GL_TEXTURE_2D. | 378 // so restrict this to GL_TEXTURE_2D. |
| 370 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && | 379 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && |
| 371 source_format_contain_superset_of_dest_format) { | 380 source_format_contain_superset_of_dest_format) { |
| 372 DoCopyTexImage2D(decoder, | 381 DoCopyTexImage2D(decoder, source_target, source_id, dest_target, dest_id, |
| 373 source_target, | 382 dest_internal_format, width, height, framebuffer_); |
| 374 source_id, | |
| 375 dest_id, | |
| 376 dest_internal_format, | |
| 377 width, | |
| 378 height, | |
| 379 framebuffer_); | |
| 380 return; | 383 return; |
| 381 } | 384 } |
| 382 | 385 |
| 383 // Use kIdentityMatrix if no transform passed in. | 386 // Use kIdentityMatrix if no transform passed in. |
| 384 DoCopyTextureWithTransform(decoder, source_target, source_id, dest_id, width, | 387 DoCopyTextureWithTransform(decoder, source_target, source_id, dest_target, |
| 385 height, flip_y, premultiply_alpha, | 388 dest_id, width, height, flip_y, premultiply_alpha, |
| 386 unpremultiply_alpha, kIdentityMatrix); | 389 unpremultiply_alpha, kIdentityMatrix); |
| 387 } | 390 } |
| 388 | 391 |
| 389 void CopyTextureCHROMIUMResourceManager::DoCopySubTexture( | 392 void CopyTextureCHROMIUMResourceManager::DoCopySubTexture( |
| 390 const gles2::GLES2Decoder* decoder, | 393 const gles2::GLES2Decoder* decoder, |
| 391 GLenum source_target, | 394 GLenum source_target, |
| 392 GLuint source_id, | 395 GLuint source_id, |
| 393 GLenum source_internal_format, | 396 GLenum source_internal_format, |
| 397 GLenum dest_target, |
| 394 GLuint dest_id, | 398 GLuint dest_id, |
| 395 GLenum dest_internal_format, | 399 GLenum dest_internal_format, |
| 396 GLint xoffset, | 400 GLint xoffset, |
| 397 GLint yoffset, | 401 GLint yoffset, |
| 398 GLint x, | 402 GLint x, |
| 399 GLint y, | 403 GLint y, |
| 400 GLsizei width, | 404 GLsizei width, |
| 401 GLsizei height, | 405 GLsizei height, |
| 402 GLsizei dest_width, | 406 GLsizei dest_width, |
| 403 GLsizei dest_height, | 407 GLsizei dest_height, |
| 404 GLsizei source_width, | 408 GLsizei source_width, |
| 405 GLsizei source_height, | 409 GLsizei source_height, |
| 406 bool flip_y, | 410 bool flip_y, |
| 407 bool premultiply_alpha, | 411 bool premultiply_alpha, |
| 408 bool unpremultiply_alpha) { | 412 bool unpremultiply_alpha) { |
| 409 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; | 413 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; |
| 410 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's | 414 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's |
| 411 // format does not contain a superset of the components required by the base | 415 // format does not contain a superset of the components required by the base |
| 412 // format of internalformat. | 416 // format of internalformat. |
| 413 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml | 417 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml |
| 414 bool source_format_contain_superset_of_dest_format = | 418 bool source_format_contain_superset_of_dest_format = |
| 415 (source_internal_format == dest_internal_format && | 419 (source_internal_format == dest_internal_format && |
| 416 source_internal_format != GL_BGRA_EXT) || | 420 source_internal_format != GL_BGRA_EXT) || |
| 417 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); | 421 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); |
| 418 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, | 422 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, |
| 419 // so restrict this to GL_TEXTURE_2D. | 423 // so restrict this to GL_TEXTURE_2D. |
| 420 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && | 424 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && |
| 421 source_format_contain_superset_of_dest_format) { | 425 source_format_contain_superset_of_dest_format) { |
| 422 DoCopyTexSubImage2D(decoder, source_target, source_id, dest_id, xoffset, | 426 DoCopyTexSubImage2D(decoder, source_target, source_id, dest_target, dest_id, |
| 423 yoffset, x, y, width, height, framebuffer_); | 427 xoffset, yoffset, x, y, width, height, framebuffer_); |
| 424 return; | 428 return; |
| 425 } | 429 } |
| 426 | 430 |
| 427 DoCopyTextureInternal(decoder, source_target, source_id, dest_id, xoffset, | 431 DoCopyTextureInternal( |
| 428 yoffset, x, y, width, height, dest_width, dest_height, | 432 decoder, source_target, source_id, dest_target, dest_id, xoffset, yoffset, |
| 429 source_width, source_height, flip_y, premultiply_alpha, | 433 x, y, width, height, dest_width, dest_height, source_width, source_height, |
| 430 unpremultiply_alpha, kIdentityMatrix); | 434 flip_y, premultiply_alpha, unpremultiply_alpha, kIdentityMatrix); |
| 431 } | 435 } |
| 432 | 436 |
| 433 void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform( | 437 void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform( |
| 434 const gles2::GLES2Decoder* decoder, | 438 const gles2::GLES2Decoder* decoder, |
| 435 GLenum source_target, | 439 GLenum source_target, |
| 436 GLuint source_id, | 440 GLuint source_id, |
| 441 GLenum dest_target, |
| 437 GLuint dest_id, | 442 GLuint dest_id, |
| 438 GLsizei width, | 443 GLsizei width, |
| 439 GLsizei height, | 444 GLsizei height, |
| 440 bool flip_y, | 445 bool flip_y, |
| 441 bool premultiply_alpha, | 446 bool premultiply_alpha, |
| 442 bool unpremultiply_alpha, | 447 bool unpremultiply_alpha, |
| 443 const GLfloat transform_matrix[16]) { | 448 const GLfloat transform_matrix[16]) { |
| 444 GLsizei dest_width = width; | 449 GLsizei dest_width = width; |
| 445 GLsizei dest_height = height; | 450 GLsizei dest_height = height; |
| 446 DoCopyTextureInternal(decoder, source_target, source_id, dest_id, 0, 0, 0, 0, | 451 DoCopyTextureInternal(decoder, source_target, source_id, dest_target, dest_id, |
| 447 width, height, dest_width, dest_height, width, height, | 452 0, 0, 0, 0, width, height, dest_width, dest_height, |
| 448 flip_y, premultiply_alpha, unpremultiply_alpha, | 453 width, height, flip_y, premultiply_alpha, |
| 449 transform_matrix); | 454 unpremultiply_alpha, transform_matrix); |
| 450 } | 455 } |
| 451 | 456 |
| 452 void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal( | 457 void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal( |
| 453 const gles2::GLES2Decoder* decoder, | 458 const gles2::GLES2Decoder* decoder, |
| 454 GLenum source_target, | 459 GLenum source_target, |
| 455 GLuint source_id, | 460 GLuint source_id, |
| 461 GLenum dest_target, |
| 456 GLuint dest_id, | 462 GLuint dest_id, |
| 457 GLint xoffset, | 463 GLint xoffset, |
| 458 GLint yoffset, | 464 GLint yoffset, |
| 459 GLint x, | 465 GLint x, |
| 460 GLint y, | 466 GLint y, |
| 461 GLsizei width, | 467 GLsizei width, |
| 462 GLsizei height, | 468 GLsizei height, |
| 463 GLsizei dest_width, | 469 GLsizei dest_width, |
| 464 GLsizei dest_height, | 470 GLsizei dest_height, |
| 465 GLsizei source_width, | 471 GLsizei source_width, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // Pass translation to the shader program. | 541 // Pass translation to the shader program. |
| 536 glUniform2f(info->vertex_translate_handle, x_translate_on_vertex, | 542 glUniform2f(info->vertex_translate_handle, x_translate_on_vertex, |
| 537 y_translate_on_vertex); | 543 y_translate_on_vertex); |
| 538 } | 544 } |
| 539 if (source_target == GL_TEXTURE_RECTANGLE_ARB) | 545 if (source_target == GL_TEXTURE_RECTANGLE_ARB) |
| 540 glUniform2f(info->half_size_handle, source_width / 2.0f, | 546 glUniform2f(info->half_size_handle, source_width / 2.0f, |
| 541 source_height / 2.0f); | 547 source_height / 2.0f); |
| 542 else | 548 else |
| 543 glUniform2f(info->half_size_handle, 0.5f, 0.5f); | 549 glUniform2f(info->half_size_handle, 0.5f, 0.5f); |
| 544 | 550 |
| 545 if (BindFramebufferTexture2D(GL_TEXTURE_2D, dest_id, framebuffer_)) { | 551 if (BindFramebufferTexture2D(dest_target, dest_id, framebuffer_)) { |
| 546 #ifndef NDEBUG | 552 #ifndef NDEBUG |
| 547 // glValidateProgram of MACOSX validates FBO unlike other platforms, so | 553 // glValidateProgram of MACOSX validates FBO unlike other platforms, so |
| 548 // glValidateProgram must be called after FBO binding. crbug.com/463439 | 554 // glValidateProgram must be called after FBO binding. crbug.com/463439 |
| 549 glValidateProgram(info->program); | 555 glValidateProgram(info->program); |
| 550 GLint validation_status; | 556 GLint validation_status; |
| 551 glGetProgramiv(info->program, GL_VALIDATE_STATUS, &validation_status); | 557 glGetProgramiv(info->program, GL_VALIDATE_STATUS, &validation_status); |
| 552 if (GL_TRUE != validation_status) { | 558 if (GL_TRUE != validation_status) { |
| 553 DLOG(ERROR) << "CopyTextureCHROMIUM: Invalid shader."; | 559 DLOG(ERROR) << "CopyTextureCHROMIUM: Invalid shader."; |
| 554 return; | 560 return; |
| 555 } | 561 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 decoder->RestoreTextureState(dest_id); | 596 decoder->RestoreTextureState(dest_id); |
| 591 decoder->RestoreTextureUnitBindings(0); | 597 decoder->RestoreTextureUnitBindings(0); |
| 592 decoder->RestoreActiveTexture(); | 598 decoder->RestoreActiveTexture(); |
| 593 decoder->RestoreProgramBindings(); | 599 decoder->RestoreProgramBindings(); |
| 594 decoder->RestoreBufferBindings(); | 600 decoder->RestoreBufferBindings(); |
| 595 decoder->RestoreFramebufferBindings(); | 601 decoder->RestoreFramebufferBindings(); |
| 596 decoder->RestoreGlobalState(); | 602 decoder->RestoreGlobalState(); |
| 597 } | 603 } |
| 598 | 604 |
| 599 } // namespace gpu | 605 } // namespace gpu |
| OLD | NEW |