Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2150993002: Revert of Always apply UniformMatrix4fvStreamTextureMatrixCHROMIUM matrix argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 8375 matching lines...) Expand 10 before | Expand all | Expand 10 after
8386 &type, 8386 &type,
8387 &count)) { 8387 &count)) {
8388 return; 8388 return;
8389 } 8389 }
8390 glUniformMatrix4fv(real_location, count, transpose, value); 8390 glUniformMatrix4fv(real_location, count, transpose, value);
8391 } 8391 }
8392 8392
8393 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( 8393 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
8394 GLint fake_location, 8394 GLint fake_location,
8395 GLboolean transpose, 8395 GLboolean transpose,
8396 const GLfloat* transform) { 8396 const GLfloat* default_value) {
8397 float gl_matrix[16]; 8397 float gl_matrix[16];
8398 8398
8399 // If we can't get a matrix from the texture, then use a default.
8400 // TODO(liberato): remove |default_value| and replace with an identity matrix.
8401 // It is only present as a transitionary step until StreamTexture supplies
8402 // the matrix via GLImage. Once that happens, GLRenderer can quit sending
8403 // in a default.
8404 memcpy(gl_matrix, default_value, sizeof(gl_matrix));
8405
8399 // This refers to the bound external texture on the active unit. 8406 // This refers to the bound external texture on the active unit.
8400 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 8407 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
8401 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { 8408 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) {
8402 if (GLStreamTextureImage* image = 8409 if (GLStreamTextureImage* image =
8403 texture_ref->texture()->GetLevelStreamTextureImage( 8410 texture_ref->texture()->GetLevelStreamTextureImage(
8404 GL_TEXTURE_EXTERNAL_OES, 0)) { 8411 GL_TEXTURE_EXTERNAL_OES, 0)) {
8405 gfx::Transform st_transform(gfx::Transform::kSkipInitialization);
8406 gfx::Transform pre_transform(gfx::Transform::kSkipInitialization);
8407 image->GetTextureMatrix(gl_matrix); 8412 image->GetTextureMatrix(gl_matrix);
8408 st_transform.matrix().setColMajorf(gl_matrix);
8409 pre_transform.matrix().setColMajorf(transform);
8410 gfx::Transform(pre_transform, st_transform)
8411 .matrix()
8412 .asColMajorf(gl_matrix);
8413 } else {
8414 // Missing stream texture. Treat matrix as identity.
8415 memcpy(gl_matrix, transform, sizeof(gl_matrix));
8416 } 8413 }
8417 } else { 8414 } else {
8418 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 8415 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
8419 "DoUniformMatrix4vStreamTextureMatrix", 8416 "DoUniformMatrix4vStreamTextureMatrix",
8420 "no texture bound"); 8417 "no texture bound");
8421 return; 8418 return;
8422 } 8419 }
8423 8420
8424 GLenum type = 0; 8421 GLenum type = 0;
8425 GLint real_location = -1; 8422 GLint real_location = -1;
(...skipping 6428 matching lines...) Expand 10 before | Expand all | Expand 10 after
14854 } 14851 }
14855 14852
14856 DoCopyTexImageIfNeeded(source_texture, source_target); 14853 DoCopyTexImageIfNeeded(source_texture, source_target);
14857 14854
14858 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix 14855 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix
14859 // before presenting. 14856 // before presenting.
14860 if (source_target == GL_TEXTURE_EXTERNAL_OES) { 14857 if (source_target == GL_TEXTURE_EXTERNAL_OES) {
14861 if (GLStreamTextureImage* image = 14858 if (GLStreamTextureImage* image =
14862 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 14859 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES,
14863 0)) { 14860 0)) {
14861 // The coordinate system of this matrix is y-up, not y-down, so a flip is
14862 // needed.
14864 GLfloat transform_matrix[16]; 14863 GLfloat transform_matrix[16];
14865 image->GetTextureMatrix(transform_matrix); 14864 image->GetFlippedTextureMatrix(transform_matrix);
14866 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( 14865 copy_texture_CHROMIUM_->DoCopyTextureWithTransform(
14867 this, source_target, source_texture->service_id(), dest_target, 14866 this, source_target, source_texture->service_id(), dest_target,
14868 dest_texture->service_id(), source_width, source_height, 14867 dest_texture->service_id(), source_width, source_height,
14869 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, 14868 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
14870 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); 14869 unpack_unmultiply_alpha == GL_TRUE, transform_matrix);
14871 return; 14870 return;
14872 } 14871 }
14873 } 14872 }
14874 copy_texture_CHROMIUM_->DoCopyTexture( 14873 copy_texture_CHROMIUM_->DoCopyTexture(
14875 this, source_target, source_texture->service_id(), source_internal_format, 14874 this, source_target, source_texture->service_id(), source_internal_format,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
15030 ScopedTextureBinder binder( 15029 ScopedTextureBinder binder(
15031 &state_, dest_texture->service_id(), dest_target); 15030 &state_, dest_texture->service_id(), dest_target);
15032 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), 15031 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset),
15033 gfx::Rect(x, y, width, height))) { 15032 gfx::Rect(x, y, width, height))) {
15034 return; 15033 return;
15035 } 15034 }
15036 } 15035 }
15037 15036
15038 DoCopyTexImageIfNeeded(source_texture, source_target); 15037 DoCopyTexImageIfNeeded(source_texture, source_target);
15039 15038
15039
15040 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix 15040 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
15041 // before presenting. 15041 // before presenting.
15042 if (source_target == GL_TEXTURE_EXTERNAL_OES) { 15042 if (source_target == GL_TEXTURE_EXTERNAL_OES) {
15043 if (GLStreamTextureImage* image = 15043 if (GLStreamTextureImage* image =
15044 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 15044 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES,
15045 0)) { 15045 0)) {
15046 // The coordinate system of this matrix is y-up, not y-down, so a flip is
15047 // needed.
15046 GLfloat transform_matrix[16]; 15048 GLfloat transform_matrix[16];
15047 image->GetTextureMatrix(transform_matrix); 15049 image->GetFlippedTextureMatrix(transform_matrix);
15048 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( 15050 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform(
15049 this, source_target, source_texture->service_id(), 15051 this, source_target, source_texture->service_id(),
15050 source_internal_format, dest_target, dest_texture->service_id(), 15052 source_internal_format, dest_target, dest_texture->service_id(),
15051 dest_internal_format, xoffset, yoffset, x, y, width, height, 15053 dest_internal_format, xoffset, yoffset, x, y, width, height,
15052 dest_width, dest_height, source_width, source_height, 15054 dest_width, dest_height, source_width, source_height,
15053 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, 15055 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
15054 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); 15056 unpack_unmultiply_alpha == GL_TRUE, transform_matrix);
15055 return; 15057 return;
15056 } 15058 }
15057 } 15059 }
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
17346 } 17348 }
17347 17349
17348 // Include the auto-generated part of this file. We split this because it means 17350 // Include the auto-generated part of this file. We split this because it means
17349 // we can easily edit the non-auto generated parts right here in this file 17351 // we can easily edit the non-auto generated parts right here in this file
17350 // instead of having to edit some template or the code generator. 17352 // instead of having to edit some template or the code generator.
17351 #include "base/macros.h" 17353 #include "base/macros.h"
17352 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17354 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17353 17355
17354 } // namespace gles2 17356 } // namespace gles2
17355 } // namespace gpu 17357 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_stream_texture_image.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698