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 <string.h> | 7 #include <string.h> |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "gpu/command_buffer/common/types.h" | 9 #include "gpu/command_buffer/common/types.h" |
10 #include "gpu/command_buffer/service/gl_utils.h" | 10 #include "gpu/command_buffer/service/gl_utils.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest_target, | 388 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest_target, |
389 dest_id, level); | 389 dest_id, level); |
390 | 390 |
391 #ifndef NDEBUG | 391 #ifndef NDEBUG |
392 GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 392 GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
393 if (GL_FRAMEBUFFER_COMPLETE != fb_status) { | 393 if (GL_FRAMEBUFFER_COMPLETE != fb_status) { |
394 DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; | 394 DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; |
395 } else | 395 } else |
396 #endif | 396 #endif |
397 { | 397 { |
| 398 decoder->ClearAllAttributes(); |
398 glEnableVertexAttribArray(kVertexPositionAttrib); | 399 glEnableVertexAttribArray(kVertexPositionAttrib); |
399 | 400 |
400 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); | 401 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); |
401 glVertexAttribPointer(kVertexPositionAttrib, 4, GL_FLOAT, GL_FALSE, | 402 glVertexAttribPointer(kVertexPositionAttrib, 4, GL_FLOAT, GL_FALSE, |
402 4 * sizeof(GLfloat), 0); | 403 4 * sizeof(GLfloat), 0); |
403 | 404 |
404 glUniform1i(sampler_locations_[program], 0); | 405 glUniform1i(sampler_locations_[program], 0); |
405 | 406 |
406 glBindTexture(source_target, source_id); | 407 glBindTexture(source_target, source_id); |
407 glTexParameterf(source_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 408 glTexParameterf(source_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
408 glTexParameterf(source_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 409 glTexParameterf(source_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
409 glTexParameteri(source_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 410 glTexParameteri(source_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
410 glTexParameteri(source_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 411 glTexParameteri(source_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
411 | 412 |
412 glDisable(GL_DEPTH_TEST); | 413 glDisable(GL_DEPTH_TEST); |
413 glDisable(GL_SCISSOR_TEST); | 414 glDisable(GL_SCISSOR_TEST); |
414 glDisable(GL_STENCIL_TEST); | 415 glDisable(GL_STENCIL_TEST); |
415 glDisable(GL_CULL_FACE); | 416 glDisable(GL_CULL_FACE); |
416 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 417 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
417 glDepthMask(GL_FALSE); | 418 glDepthMask(GL_FALSE); |
418 glDisable(GL_BLEND); | 419 glDisable(GL_BLEND); |
419 | 420 |
420 glViewport(0, 0, width, height); | 421 glViewport(0, 0, width, height); |
421 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | 422 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
422 } | 423 } |
423 | 424 |
424 decoder->RestoreAttribute(kVertexPositionAttrib); | 425 decoder->RestoreAllAttributes(); |
425 decoder->RestoreTextureState(source_id); | 426 decoder->RestoreTextureState(source_id); |
426 decoder->RestoreTextureState(dest_id); | 427 decoder->RestoreTextureState(dest_id); |
427 decoder->RestoreTextureUnitBindings(0); | 428 decoder->RestoreTextureUnitBindings(0); |
428 decoder->RestoreActiveTexture(); | 429 decoder->RestoreActiveTexture(); |
429 decoder->RestoreProgramBindings(); | 430 decoder->RestoreProgramBindings(); |
430 decoder->RestoreBufferBindings(); | 431 decoder->RestoreBufferBindings(); |
431 decoder->RestoreFramebufferBindings(); | 432 decoder->RestoreFramebufferBindings(); |
432 decoder->RestoreGlobalState(); | 433 decoder->RestoreGlobalState(); |
433 } | 434 } |
434 | 435 |
435 } // namespace | 436 } // namespace |
436 | 437 |
OLD | NEW |