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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1559203003: Add GLStreamTextureImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/GL_EXPORT/GPU_EXPORT for windows Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 52118fb73103847f9c600b57d56b38f3c1894a02..fb1a36600632ca7a8852835a10b562073bc1459f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -37,6 +37,7 @@
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/framebuffer_manager.h"
+#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h"
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
@@ -1625,6 +1626,10 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
void DoUniformMatrix4fv(
GLint fake_location, GLsizei count, GLboolean transpose,
const GLfloat* value);
+ void DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint fake_location,
+ GLboolean transpose,
+ const GLfloat* default_value);
void DoUniformMatrix2x3fv(
GLint fake_location, GLsizei count, GLboolean transpose,
const GLfloat* value);
@@ -7486,6 +7491,46 @@ void GLES2DecoderImpl::DoUniformMatrix4fv(
glUniformMatrix4fv(real_location, count, transpose, value);
}
+void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint fake_location,
+ GLboolean transpose,
+ const GLfloat* default_value) {
+ float gl_matrix[16];
+
+ // If we can't get a matrix from the texture, then use a default.
+ // TODO(liberato): remove |default_value| and replace with an identity matrix.
+ // It is only present as a transitionary step until StreamTexture supplies
+ // the matrix via GLImage. Once that happens, GLRenderer can quit sending
+ // in a default.
+ memcpy(gl_matrix, default_value, sizeof(gl_matrix));
+
+ // This refers to the bound external texture on the active unit.
+ TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
+ if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) {
+ if (GLStreamTextureImage* image =
+ texture_ref->texture()->GetLevelStreamTextureImage(
+ GL_TEXTURE_EXTERNAL_OES, 0)) {
+ image->GetTextureMatrix(gl_matrix);
+ }
+ } else {
+ LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
+ "DoUniformMatrix4vStreamTextureMatrix",
+ "no texture bound");
+ return;
+ }
+
+ GLenum type = 0;
+ GLint real_location = -1;
+ GLsizei count = 1;
+ if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv",
+ Program::kUniformMatrix4f, &real_location,
+ &type, &count)) {
+ return;
+ }
+
+ glUniformMatrix4fv(real_location, count, transpose, gl_matrix);
+}
+
void GLES2DecoderImpl::DoUniformMatrix2x3fv(
GLint fake_location, GLsizei count, GLboolean transpose,
const GLfloat* value) {
« 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