summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliberato <liberato@chromium.org>2016-02-23 16:24:56 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-24 00:25:57 +0000
commitdf64f2cb11bb32d8522fa0ebeeed8653be158533 (patch)
tree33d475476f769c270b13db9a880159481784435d
parente8547b1a1e003bd3bee177c87746421c3b5248cc (diff)
downloadchromium_src-df64f2cb11bb32d8522fa0ebeeed8653be158533.zip
chromium_src-df64f2cb11bb32d8522fa0ebeeed8653be158533.tar.gz
chromium_src-df64f2cb11bb32d8522fa0ebeeed8653be158533.tar.bz2
Added GLStreamTextureImage : GLImage, which exposes
GetTextureMatrix. This provides a texture matrix to convert from hardware-specific texture coordinates. Made AVDACodecImage provide the current matrix from the SurfaceTexture. Updates GLRenderer::DrawStreamVideoQuad to use the current texture matrix from the GLImage if available, else fall back to the one recorded quad. Once stream_texture_android.cc returns the most recent texture matrix, it may be possible to remove the entire DidUpdateMatrix path in VideoFrameProvider. Does not address CopyTextureCHROMIUM. BUG=530681,226218 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1559203003 Cr-Commit-Position: refs/heads/master@{#377150}
-rw-r--r--cc/output/gl_renderer.cc13
-rw-r--r--content/common/gpu/media/android_deferred_rendering_backing_strategy.cc9
-rw-r--r--content/common/gpu/media/android_deferred_rendering_backing_strategy.h6
-rw-r--r--content/common/gpu/media/avda_codec_image.cc122
-rw-r--r--content/common/gpu/media/avda_codec_image.h46
-rw-r--r--content/common/gpu/media/avda_shared_state.cc8
-rw-r--r--content/common/gpu/media/avda_shared_state.h11
-rw-r--r--gpu/GLES2/extensions/CHROMIUM/CHROMIUM_stream_texture_matrix.txt58
-rw-r--r--gpu/GLES2/gl2chromium_autogen.h2
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py8
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h12
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h15
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h5
-rw-r--r--gpu/command_buffer/client/gles2_implementation_impl_autogen.h17
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h10
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h57
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h37
-rw-r--r--gpu/command_buffer/common/gles2_cmd_ids_autogen.h647
-rw-r--r--gpu/command_buffer/service/gl_stream_texture_image.h33
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc45
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h28
-rw-r--r--gpu/command_buffer/service/texture_manager.cc68
-rw-r--r--gpu/command_buffer/service/texture_manager.h32
-rw-r--r--gpu/command_buffer/service/texture_manager_unittest.cc69
-rw-r--r--mojo/gpu/mojo_gles2_impl_autogen.cc8
-rw-r--r--mojo/gpu/mojo_gles2_impl_autogen.h4
-rw-r--r--mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h6
32 files changed, 981 insertions, 413 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 2b20d25..57e3f33 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -2192,14 +2192,23 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame,
SetUseProgram(program->program());
ToGLMatrix(&gl_matrix[0], quad->matrix);
- gl_->UniformMatrix4fv(program->vertex_shader().tex_matrix_location(), 1,
- false, gl_matrix);
ResourceProvider::ScopedReadLockGL lock(resource_provider_,
quad->resource_id());
+
DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id());
+ // TODO(liberato): stream_texture_android should stop sending |gl_matrix| to
+ // the video frame provider with this change (and to us), but it should
+ // start reporting the current matrix via
+ // GLStreamTextureImage::GetTextureMatrix. Until then, though, this will use
+ // the matrix that we provide to it, unless the GLStreamTextureImage
+ // overrides it. This lets it also work with AVDACodecImage, which provides
+ // the correct custom matrix and supplies a default one to us.
+ gl_->UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ program->vertex_shader().tex_matrix_location(), false, gl_matrix);
+
gl_->Uniform1i(program->fragment_shader().sampler_location(), 0);
SetShaderOpacity(quad->shared_quad_state->opacity,
diff --git a/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc b/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
index a76c98d..1fc85da 100644
--- a/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
+++ b/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
@@ -13,6 +13,7 @@
#include "content/common/gpu/media/avda_codec_image.h"
#include "content/common/gpu/media/avda_return_on_failure.h"
#include "content/common/gpu/media/avda_shared_state.h"
+#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gl/android/surface_texture.h"
#include "ui/gl/gl_bindings.h"
@@ -105,7 +106,7 @@ AVDACodecImage* AndroidDeferredRenderingBackingStrategy::GetImageForPicture(
void AndroidDeferredRenderingBackingStrategy::SetImageForPicture(
const media::PictureBuffer& picture_buffer,
- const scoped_refptr<gl::GLImage>& image) {
+ const scoped_refptr<gpu::gles2::GLStreamTextureImage>& image) {
gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer);
RETURN_IF_NULL(texture_ref);
@@ -145,8 +146,8 @@ void AndroidDeferredRenderingBackingStrategy::SetImageForPicture(
const gpu::gles2::Texture::ImageState image_state =
surface_texture_ ? gpu::gles2::Texture::UNBOUND
: gpu::gles2::Texture::BOUND;
- texture_manager->SetLevelImage(texture_ref, GetTextureTarget(), 0,
- image.get(), image_state);
+ texture_manager->SetLevelStreamTextureImage(texture_ref, GetTextureTarget(),
+ 0, image.get(), image_state);
}
void AndroidDeferredRenderingBackingStrategy::UseCodecBufferForPictureBuffer(
@@ -170,7 +171,7 @@ void AndroidDeferredRenderingBackingStrategy::AssignOnePictureBuffer(
const media::PictureBuffer& picture_buffer) {
// Attach a GLImage to each texture that will use the surface texture.
// We use a refptr here in case SetImageForPicture fails.
- scoped_refptr<gl::GLImage> gl_image =
+ scoped_refptr<gpu::gles2::GLStreamTextureImage> gl_image =
new AVDACodecImage(shared_state_, media_codec_,
state_provider_->GetGlDecoder(), surface_texture_);
SetImageForPicture(picture_buffer, gl_image);
diff --git a/content/common/gpu/media/android_deferred_rendering_backing_strategy.h b/content/common/gpu/media/android_deferred_rendering_backing_strategy.h
index 4b8bd6d..83bfa28 100644
--- a/content/common/gpu/media/android_deferred_rendering_backing_strategy.h
+++ b/content/common/gpu/media/android_deferred_rendering_backing_strategy.h
@@ -17,6 +17,7 @@ class GLImage;
namespace gpu {
namespace gles2 {
+class GLStreamTextureImage;
class TextureRef;
}
}
@@ -64,8 +65,9 @@ class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy
// Return the AVDACodecImage for a given PictureBuffer's texture.
AVDACodecImage* GetImageForPicture(const media::PictureBuffer&);
- void SetImageForPicture(const media::PictureBuffer& picture_buffer,
- const scoped_refptr<gl::GLImage>& image);
+ void SetImageForPicture(
+ const media::PictureBuffer& picture_buffer,
+ const scoped_refptr<gpu::gles2::GLStreamTextureImage>& image);
scoped_refptr<AVDASharedState> shared_state_;
diff --git a/content/common/gpu/media/avda_codec_image.cc b/content/common/gpu/media/avda_codec_image.cc
index 6b0fa8a6..e0a0cb5 100644
--- a/content/common/gpu/media/avda_codec_image.cc
+++ b/content/common/gpu/media/avda_codec_image.cc
@@ -29,11 +29,12 @@ AVDACodecImage::AVDACodecImage(
decoder_(decoder),
surface_texture_(surface_texture),
detach_surface_texture_on_destruction_(false),
- texture_(0),
- need_shader_info_(true),
- texmatrix_uniform_location_(-1) {
+ texture_(0) {
+ // Default to a sane guess of "flip Y", just in case we can't get
+ // the matrix on the first call.
memset(gl_matrix_, 0, sizeof(gl_matrix_));
- gl_matrix_[0] = gl_matrix_[5] = gl_matrix_[10] = gl_matrix_[15] = 1.0f;
+ gl_matrix_[0] = gl_matrix_[10] = gl_matrix_[15] = 1.0f;
+ gl_matrix_[5] = -1.0f;
}
AVDACodecImage::~AVDACodecImage() {}
@@ -61,35 +62,29 @@ bool AVDACodecImage::CopyTexImage(unsigned target) {
if (target != GL_TEXTURE_EXTERNAL_OES)
return false;
- // Verify that the currently bound texture is the right one. If we're not
- // copying to a Texture that shares our service_id, then we can't do much.
- // This will force a copy.
- // TODO(liberato): Fall back to a copy that uses the texture matrix.
GLint bound_service_id = 0;
glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &bound_service_id);
+ // We insist that the currently bound texture is the right one. We could
+ // make a new glimage from a 2D image.
if (bound_service_id != shared_state_->surface_texture_service_id())
return false;
- // Attach the surface texture to our GL context if needed.
+ // If the surface texture isn't attached yet, then attach it. Note that this
+ // will be to the texture in |shared_state_|, because of the checks above.
if (!shared_state_->surface_texture_is_attached())
AttachSurfaceTextureToContext();
- // Make sure that we have the right image in the front buffer.
- UpdateSurfaceTexture();
-
- InstallTextureMatrix();
-
- // TODO(liberato): Handle the texture matrix properly.
- // Either we can update the shader with it or we can move all of the logic
- // to updateTexImage() to the right place in the cc to send it to the shader.
- // For now, we just skip it. crbug.com/530681
+ // Make sure that we have the right image in the front buffer. Note that the
+ // bound_service_id is guaranteed to be equal to the surface texture's client
+ // texture id, so we can skip preserving it if the right context is current.
+ UpdateSurfaceTexture(kDontRestoreBindings);
// By setting image state to UNBOUND instead of COPIED we ensure that
// CopyTexImage() is called each time the surface texture is used for drawing.
// It would be nice if we could do this via asking for the currently bound
// Texture, but the active unit never seems to change.
- texture_->SetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0, this,
- gpu::gles2::Texture::UNBOUND);
+ texture_->SetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 0, this,
+ gpu::gles2::Texture::UNBOUND);
return true;
}
@@ -123,11 +118,11 @@ void AVDACodecImage::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
uint64_t process_tracing_id,
const std::string& dump_name) {}
-void AVDACodecImage::UpdateSurfaceTexture() {
+void AVDACodecImage::UpdateSurfaceTexture(RestoreBindingsMode mode) {
DCHECK(surface_texture_);
// Render via the media codec if needed.
- if (codec_buffer_index_ == kInvalidCodecBufferIndex || !media_codec_)
+ if (!IsCodecBufferOutstanding())
return;
// The decoder buffer is still pending.
@@ -142,12 +137,21 @@ void AVDACodecImage::UpdateSurfaceTexture() {
codec_buffer_index_ = kInvalidCodecBufferIndex;
// Swap the rendered image to the front.
- scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
- if (!shared_state_->context()->IsCurrent(NULL)) {
- scoped_make_current.reset(new ui::ScopedMakeCurrent(
- shared_state_->context(), shared_state_->surface()));
- }
+ scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current = MakeCurrentIfNeeded();
+
+ // If we changed contexts, then we always want to restore it, since the caller
+ // doesn't know that we're switching contexts.
+ if (scoped_make_current)
+ mode = kDoRestoreBindings;
+
+ // Save the current binding if requested.
+ GLint bound_service_id = 0;
+ if (mode == kDoRestoreBindings)
+ glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &bound_service_id);
+
surface_texture_->UpdateTexImage();
+ if (mode == kDoRestoreBindings)
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, bound_service_id);
// Helpfully, this is already column major.
surface_texture_->GetTransformMatrix(gl_matrix_);
@@ -176,6 +180,8 @@ void AVDACodecImage::SetTexture(gpu::gles2::Texture* texture) {
void AVDACodecImage::AttachSurfaceTextureToContext() {
DCHECK(surface_texture_);
+ // We assume that the currently bound texture is the intended one.
+
// Attach the surface texture to the first context we're bound on, so that
// no context switch is needed later.
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -187,38 +193,48 @@ void AVDACodecImage::AttachSurfaceTextureToContext() {
// We could do this earlier, but SurfaceTexture has context affinity, and we
// don't want to require a context switch.
surface_texture_->AttachToGLContext();
- shared_state_->did_attach_surface_texture();
+ shared_state_->DidAttachSurfaceTexture();
}
-void AVDACodecImage::InstallTextureMatrix() {
- DCHECK(surface_texture_);
+scoped_ptr<ui::ScopedMakeCurrent> AVDACodecImage::MakeCurrentIfNeeded() {
+ DCHECK(shared_state_->context());
+ scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
+ if (!shared_state_->context()->IsCurrent(NULL)) {
+ scoped_make_current.reset(new ui::ScopedMakeCurrent(
+ shared_state_->context(), shared_state_->surface()));
+ }
- // glUseProgram() has been run already -- just modify the uniform.
- // Updating this via VideoFrameProvider::Client::DidUpdateMatrix() would
- // be a better solution, except that we'd definitely miss a frame at this
- // point in drawing.
- // Our current method assumes that we'll end up being a stream resource,
- // and that the program has a texMatrix uniform that does what we want.
- if (need_shader_info_) {
- GLint program_id = -1;
- glGetIntegerv(GL_CURRENT_PROGRAM, &program_id);
-
- if (program_id >= 0) {
- // This is memorized from cc/output/shader.cc .
- const char* uniformName = "texMatrix";
-
- // Within unittests this value may be -1.
- texmatrix_uniform_location_ =
- glGetUniformLocation(program_id, uniformName);
- }
+ return scoped_make_current;
+}
- // Only try once.
- need_shader_info_ = false;
+void AVDACodecImage::GetTextureMatrix(float matrix[16]) {
+ if (IsCodecBufferOutstanding() && shared_state_ && surface_texture_) {
+ // Our current matrix may be stale. Update it if possible.
+ if (!shared_state_->surface_texture_is_attached()) {
+ // Don't attach the surface texture permanently. Perhaps we should
+ // just attach the surface texture in avda and be done with it.
+ GLuint service_id = 0;
+ glGenTextures(1, &service_id);
+ GLint bound_service_id = 0;
+ glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &bound_service_id);
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, service_id);
+ AttachSurfaceTextureToContext();
+ UpdateSurfaceTexture(kDontRestoreBindings);
+ // Detach the surface texture, which deletes the generated texture.
+ surface_texture_->DetachFromGLContext();
+ shared_state_->DidDetachSurfaceTexture();
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, bound_service_id);
+ } else {
+ // Surface texture is already attached, so just update it.
+ UpdateSurfaceTexture(kDoRestoreBindings);
+ }
}
- if (texmatrix_uniform_location_ >= 0) {
- glUniformMatrix4fv(texmatrix_uniform_location_, 1, false, gl_matrix_);
- }
+ memcpy(matrix, gl_matrix_, sizeof(gl_matrix_));
+}
+
+bool AVDACodecImage::IsCodecBufferOutstanding() const {
+ return codec_buffer_index_ != kInvalidCodecBufferIndex && media_codec_;
}
} // namespace content
diff --git a/content/common/gpu/media/avda_codec_image.h b/content/common/gpu/media/avda_codec_image.h
index 8bbcf13..46547e4 100644
--- a/content/common/gpu/media/avda_codec_image.h
+++ b/content/common/gpu/media/avda_codec_image.h
@@ -9,13 +9,17 @@
#include "base/macros.h"
#include "content/common/gpu/media/avda_shared_state.h"
-#include "ui/gl/gl_image.h"
+#include "gpu/command_buffer/service/gl_stream_texture_image.h"
+
+namespace ui {
+class ScopedMakeCurrent;
+}
namespace content {
// GLImage that renders MediaCodec buffers to a SurfaceTexture or SurfaceView as
// needed in order to draw them.
-class AVDACodecImage : public gl::GLImage {
+class AVDACodecImage : public gpu::gles2::GLStreamTextureImage {
public:
AVDACodecImage(const scoped_refptr<AVDASharedState>&,
media::VideoCodecBridge* codec,
@@ -44,6 +48,8 @@ class AVDACodecImage : public gl::GLImage {
void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
uint64_t process_tracing_id,
const std::string& dump_name) override;
+ // gpu::gles2::GLStreamTextureMatrix implementation
+ void GetTextureMatrix(float xform[16]) override;
public:
// Decoded buffer index that has the image for us to display.
@@ -63,15 +69,31 @@ class AVDACodecImage : public gl::GLImage {
private:
enum { kInvalidCodecBufferIndex = -1 };
- // Make sure that the surface texture's front buffer is current.
- void UpdateSurfaceTexture();
-
- // Attach the surface texture to our GL context, with a texture that we
- // create for it.
+ // Make sure that the surface texture's front buffer is current. This will
+ // save / restore the current context. It will optionally restore the texture
+ // bindings in the surface texture's context, based on |mode|. This is
+ // intended as a hint if we don't need to change contexts. If we do need to
+ // change contexts, then we'll always preserve the texture bindings in the
+ // both contexts. In other words, the caller is telling us whether it's
+ // okay to change the binding in the current context.
+ enum RestoreBindingsMode { kDontRestoreBindings, kDoRestoreBindings };
+ void UpdateSurfaceTexture(RestoreBindingsMode mode);
+
+ // Attach the surface texture to our GL context to whatever texture is bound
+ // on the active unit.
void AttachSurfaceTextureToContext();
- // Install the current texture matrix into the shader.
- void InstallTextureMatrix();
+ // Make shared_state_->context() current if it isn't already.
+ scoped_ptr<ui::ScopedMakeCurrent> MakeCurrentIfNeeded();
+
+ // Return whether or not the current context is in the same share group as
+ // |surface_texture_|'s client texture.
+ // TODO(liberato): is this needed?
+ bool IsCorrectShareGroup() const;
+
+ // Return whether there is a codec buffer that we haven't rendered yet. Will
+ // return false also if there's no codec or we otherwise can't update.
+ bool IsCodecBufferOutstanding() const;
// Shared state between the AVDA and all AVDACodecImages.
scoped_refptr<AVDASharedState> shared_state_;
@@ -99,12 +121,6 @@ class AVDACodecImage : public gl::GLImage {
// The texture that we're attached to.
gpu::gles2::Texture* texture_;
- // Have we cached |texmatrix_uniform_location_| yet?
- bool need_shader_info_;
-
- // Uniform ID of the texture matrix in the shader.
- GLint texmatrix_uniform_location_;
-
// Texture matrix of the front buffer of the surface texture.
float gl_matrix_[16];
diff --git a/content/common/gpu/media/avda_shared_state.cc b/content/common/gpu/media/avda_shared_state.cc
index d888afd..7746254 100644
--- a/content/common/gpu/media/avda_shared_state.cc
+++ b/content/common/gpu/media/avda_shared_state.cc
@@ -28,7 +28,7 @@ void AVDASharedState::WaitForFrameAvailable() {
frame_available_event_.TimedWait(max_wait_time);
}
-void AVDASharedState::did_attach_surface_texture() {
+void AVDASharedState::DidAttachSurfaceTexture() {
context_ = gfx::GLContext::GetCurrent();
surface_ = gfx::GLSurface::GetCurrent();
DCHECK(context_);
@@ -37,4 +37,10 @@ void AVDASharedState::did_attach_surface_texture() {
surface_texture_is_attached_ = true;
}
+void AVDASharedState::DidDetachSurfaceTexture() {
+ context_ = nullptr;
+ surface_ = nullptr;
+ surface_texture_is_attached_ = false;
+}
+
} // namespace content
diff --git a/content/common/gpu/media/avda_shared_state.h b/content/common/gpu/media/avda_shared_state.h
index eb62681..5f80c44 100644
--- a/content/common/gpu/media/avda_shared_state.h
+++ b/content/common/gpu/media/avda_shared_state.h
@@ -50,10 +50,19 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
return surface_texture_is_attached_;
}
+ // TODO(liberato): move the surface texture here and make these calls
+ // attach / detach it also. There are several changes going on in avda
+ // concurrently, so I don't want to change that until the dust settles.
+ // AVDACodecImage would no longer hold the surface texture.
+
// Call this when the SurfaceTexture is attached to a GL context. This will
// update surface_texture_is_attached(), and set the context() and surface()
// to match.
- void did_attach_surface_texture();
+ void DidAttachSurfaceTexture();
+
+ // Call this when the SurfaceTexture is detached from its GL context. This
+ // will cause us to forget the last binding.
+ void DidDetachSurfaceTexture();
private:
// Platform gl texture Id for |surface_texture_|. This will be zero if
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_stream_texture_matrix.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_stream_texture_matrix.txt
new file mode 100644
index 0000000..d0bfe88
--- /dev/null
+++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_stream_texture_matrix.txt
@@ -0,0 +1,58 @@
+Name
+
+ CHROMIUM_stream_texture_matrix
+
+Name Strings
+
+ CHROMIUM_stream_texture_matrix
+
+Version
+
+ Last Modifed Date: February 16, 2016
+
+Dependencies
+
+ OpenGL ES 2.0 is required.
+
+Overview
+
+ Allows clients to set the value of a 4x4 uniform to the current texture
+ matrix of a stream texture.
+
+ Allows shader access to the texture matrix for the current front buffer
+ of a stream texture. Intended for use with Android SurfaceTexture, which
+ doesn't provide the value until the front buffer is latched.
+
+New Procedures and Functions
+
+ The command
+
+ void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLintUniformLocation location,
+ GLbooleanFalseOnly transpose,
+ const GLfloat* default_value)
+
+ Updates a uniform to match the current stream texture's texture matrix.
+ The stream texture must be bound to the GL_TEXTURE_EXTERNAL_OES target on
+ the active texture unit.
+
+ If the bound texture is not a stream texture, then the default value is
+ used instead.
+
+ <location> Specifies the 4x4f uniform location to be modified.
+ <transpose> Specifies whether the matrix should be transposed.
+ <default_value> Provides the default matrix.
+
+ The default value is a transitionary step. It will be removed.
+
+Errors
+
+ None.
+
+New State
+
+ None.
+
+Revision History
+
+ 02/16/2016 Documented the extension
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h
index aa7febf..8909cd7 100644
--- a/gpu/GLES2/gl2chromium_autogen.h
+++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -379,5 +379,7 @@
GLES2_GET_FUN(BindFragDataLocationIndexedEXT)
#define glBindFragDataLocationEXT GLES2_GET_FUN(BindFragDataLocationEXT)
#define glGetFragDataIndexEXT GLES2_GET_FUN(GetFragDataIndexEXT)
+#define glUniformMatrix4fvStreamTextureMatrixCHROMIUM \
+ GLES2_GET_FUN(UniformMatrix4fvStreamTextureMatrixCHROMIUM)
#endif // GPU_GLES2_GL2CHROMIUM_AUTOGEN_H_
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 8f755ec..81d796a 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -3905,6 +3905,14 @@ _FUNCTION_INFO = {
'decoder_func': 'DoUniformMatrix4fv',
'unit_test': False,
},
+ 'UniformMatrix4fvStreamTextureMatrixCHROMIUM': {
+ 'type': 'PUT',
+ 'count': 16,
+ 'decoder_func': 'DoUniformMatrix4fvStreamTextureMatrixCHROMIUM',
+ 'extension': "CHROMIUM_uniform_stream_texture_matrix",
+ 'unit_test': False,
+ 'client_test': False,
+ },
'UniformMatrix4x2fv': {
'type': 'PUTn',
'count': 8,
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index e35f6d1..1aa3cbd 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -1712,6 +1712,13 @@ void GL_APIENTRY GLES2BindFragDataLocationEXT(GLuint program,
GLint GL_APIENTRY GLES2GetFragDataIndexEXT(GLuint program, const char* name) {
return gles2::GetGLContext()->GetFragDataIndexEXT(program, name);
}
+void GL_APIENTRY
+GLES2UniformMatrix4fvStreamTextureMatrixCHROMIUM(GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) {
+ gles2::GetGLContext()->UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ location, transpose, default_value);
+}
namespace gles2 {
@@ -3013,6 +3020,11 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glGetFragDataIndexEXT),
},
{
+ "glUniformMatrix4fvStreamTextureMatrixCHROMIUM",
+ reinterpret_cast<GLES2FunctionPointer>(
+ glUniformMatrix4fvStreamTextureMatrixCHROMIUM),
+ },
+ {
NULL, NULL,
},
};
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index 8dd89f1..f8b3dcb 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -3196,4 +3196,19 @@ void GetFragDataIndexEXT(GLuint program,
}
}
+void UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) {
+ const uint32_t size = gles2::cmds::
+ UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate::ComputeSize();
+ gles2::cmds::UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate* c =
+ GetImmediateCmdSpaceTotalSize<
+ gles2::cmds::UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate>(
+ size);
+ if (c) {
+ c->Init(location, transpose, default_value);
+ }
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index 2a4914f..deba71c 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -1187,4 +1187,9 @@ void BindFragDataLocationEXT(GLuint program,
GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
+void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) override;
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
index 4ed0561..0a56dc8 100644
--- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -3576,4 +3576,21 @@ void GLES2Implementation::ApplyScreenSpaceAntialiasingCHROMIUM() {
CheckGLError();
}
+void GLES2Implementation::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix()
+ << "] glUniformMatrix4fvStreamTextureMatrixCHROMIUM("
+ << location << ", " << GLES2Util::GetStringBool(transpose)
+ << ", " << static_cast<const void*>(default_value) << ")");
+ size_t count = 16;
+ for (size_t ii = 0; ii < count; ++ii)
+ GPU_CLIENT_LOG("value[" << ii << "]: " << default_value[ii]);
+ helper_->UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate(
+ location, transpose, default_value);
+ CheckGLError();
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 6cd390d..1020ce2 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -886,4 +886,8 @@ virtual void BindFragDataLocationEXT(GLuint program,
GLuint colorNumber,
const char* name) = 0;
virtual GLint GetFragDataIndexEXT(GLuint program, const char* name) = 0;
+virtual void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) = 0;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 84611a6..50e39cd 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -859,4 +859,8 @@ void BindFragDataLocationEXT(GLuint program,
GLuint colorNumber,
const char* name) override;
GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
+void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index b43c773..5ac7eba 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -1165,4 +1165,8 @@ GLint GLES2InterfaceStub::GetFragDataIndexEXT(GLuint /* program */,
const char* /* name */) {
return 0;
}
+void GLES2InterfaceStub::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint /* location */,
+ GLboolean /* transpose */,
+ const GLfloat* /* default_value */) {}
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_IMPL_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 24c96c6..ad35a36 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -859,4 +859,8 @@ void BindFragDataLocationEXT(GLuint program,
GLuint colorNumber,
const char* name) override;
GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
+void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index bc2a21b..5f8e3ca 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -2492,4 +2492,14 @@ GLint GLES2TraceImplementation::GetFragDataIndexEXT(GLuint program,
return gl_->GetFragDataIndexEXT(program, name);
}
+void GLES2TraceImplementation::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) {
+ TRACE_EVENT_BINARY_EFFICIENT0(
+ "gpu", "GLES2Trace::UniformMatrix4fvStreamTextureMatrixCHROMIUM");
+ gl_->UniformMatrix4fvStreamTextureMatrixCHROMIUM(location, transpose,
+ default_value);
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_IMPL_AUTOGEN_H_
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index 809a841..119f3f2 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -360,3 +360,5 @@ GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLidProgra
GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLidProgram program, GLuint colorNumber, const char* name);
GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLidProgram program, const char* name);
+// Extension CHROMIUM_stream_texture_matrix
+GL_APICALL void GL_APIENTRY glUniformMatrix4fvStreamTextureMatrixCHROMIUM (GLintUniformLocation location, GLbooleanFalseOnly transpose, const GLfloat* default_value);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index 7d678ca..3f3fe78 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -15704,4 +15704,61 @@ static_assert(offsetof(GetFragDataIndexEXT, index_shm_id) == 12,
static_assert(offsetof(GetFragDataIndexEXT, index_shm_offset) == 16,
"offset of GetFragDataIndexEXT index_shm_offset should be 16");
+struct UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate {
+ typedef UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate ValueType;
+ static const CommandId kCmdId =
+ kUniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate;
+ static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN;
+ static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
+
+ static uint32_t ComputeDataSize() {
+ return static_cast<uint32_t>(sizeof(GLfloat) * 16);
+ }
+
+ static uint32_t ComputeSize() {
+ return static_cast<uint32_t>(sizeof(ValueType) + ComputeDataSize());
+ }
+
+ void SetHeader() { header.SetCmdByTotalSize<ValueType>(ComputeSize()); }
+
+ void Init(GLint _location,
+ GLboolean _transpose,
+ const GLfloat* _default_value) {
+ SetHeader();
+ location = _location;
+ transpose = _transpose;
+ memcpy(ImmediateDataAddress(this), _default_value, ComputeDataSize());
+ }
+
+ void* Set(void* cmd,
+ GLint _location,
+ GLboolean _transpose,
+ const GLfloat* _default_value) {
+ static_cast<ValueType*>(cmd)->Init(_location, _transpose, _default_value);
+ const uint32_t size = ComputeSize();
+ return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size);
+ }
+
+ gpu::CommandHeader header;
+ int32_t location;
+ uint32_t transpose;
+};
+
+static_assert(sizeof(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate) ==
+ 12,
+ "size of UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate "
+ "should be 12");
+static_assert(offsetof(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate,
+ header) == 0,
+ "offset of UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate "
+ "header should be 0");
+static_assert(offsetof(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate,
+ location) == 4,
+ "offset of UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate "
+ "location should be 4");
+static_assert(offsetof(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate,
+ transpose) == 8,
+ "offset of UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate "
+ "transpose should be 8");
+
#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_AUTOGEN_H_
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
index 19d86ac..cee91671 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -5329,4 +5329,41 @@ TEST_F(GLES2FormatTest, GetFragDataIndexEXT) {
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
+TEST_F(GLES2FormatTest, UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate) {
+ const int kSomeBaseValueToTestWith = 51;
+ static GLfloat data[] = {
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
+ static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
+ };
+ cmds::UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate& cmd =
+ *GetBufferAs<
+ cmds::UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate>();
+ void* next_cmd =
+ cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLboolean>(12), data);
+ EXPECT_EQ(
+ static_cast<uint32_t>(
+ cmds::UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
+ cmd.header.size * 4u);
+ EXPECT_EQ(static_cast<GLint>(11), cmd.location);
+ EXPECT_EQ(static_cast<GLboolean>(12), cmd.transpose);
+ CheckBytesWrittenMatchesExpectedSize(
+ next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
+}
+
#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
index fedffa2..0316199 100644
--- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
@@ -11,329 +11,330 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_AUTOGEN_H_
-#define GLES2_COMMAND_LIST(OP) \
- OP(ActiveTexture) /* 256 */ \
- OP(AttachShader) /* 257 */ \
- OP(BindAttribLocationBucket) /* 258 */ \
- OP(BindBuffer) /* 259 */ \
- OP(BindBufferBase) /* 260 */ \
- OP(BindBufferRange) /* 261 */ \
- OP(BindFramebuffer) /* 262 */ \
- OP(BindRenderbuffer) /* 263 */ \
- OP(BindSampler) /* 264 */ \
- OP(BindTexture) /* 265 */ \
- OP(BindTransformFeedback) /* 266 */ \
- OP(BlendColor) /* 267 */ \
- OP(BlendEquation) /* 268 */ \
- OP(BlendEquationSeparate) /* 269 */ \
- OP(BlendFunc) /* 270 */ \
- OP(BlendFuncSeparate) /* 271 */ \
- OP(BufferData) /* 272 */ \
- OP(BufferSubData) /* 273 */ \
- OP(CheckFramebufferStatus) /* 274 */ \
- OP(Clear) /* 275 */ \
- OP(ClearBufferfi) /* 276 */ \
- OP(ClearBufferfvImmediate) /* 277 */ \
- OP(ClearBufferivImmediate) /* 278 */ \
- OP(ClearBufferuivImmediate) /* 279 */ \
- OP(ClearColor) /* 280 */ \
- OP(ClearDepthf) /* 281 */ \
- OP(ClearStencil) /* 282 */ \
- OP(ClientWaitSync) /* 283 */ \
- OP(ColorMask) /* 284 */ \
- OP(CompileShader) /* 285 */ \
- OP(CompressedTexImage2DBucket) /* 286 */ \
- OP(CompressedTexImage2D) /* 287 */ \
- OP(CompressedTexSubImage2DBucket) /* 288 */ \
- OP(CompressedTexSubImage2D) /* 289 */ \
- OP(CompressedTexImage3DBucket) /* 290 */ \
- OP(CompressedTexImage3D) /* 291 */ \
- OP(CompressedTexSubImage3DBucket) /* 292 */ \
- OP(CompressedTexSubImage3D) /* 293 */ \
- OP(CopyBufferSubData) /* 294 */ \
- OP(CopyTexImage2D) /* 295 */ \
- OP(CopyTexSubImage2D) /* 296 */ \
- OP(CopyTexSubImage3D) /* 297 */ \
- OP(CreateProgram) /* 298 */ \
- OP(CreateShader) /* 299 */ \
- OP(CullFace) /* 300 */ \
- OP(DeleteBuffersImmediate) /* 301 */ \
- OP(DeleteFramebuffersImmediate) /* 302 */ \
- OP(DeleteProgram) /* 303 */ \
- OP(DeleteRenderbuffersImmediate) /* 304 */ \
- OP(DeleteSamplersImmediate) /* 305 */ \
- OP(DeleteSync) /* 306 */ \
- OP(DeleteShader) /* 307 */ \
- OP(DeleteTexturesImmediate) /* 308 */ \
- OP(DeleteTransformFeedbacksImmediate) /* 309 */ \
- OP(DepthFunc) /* 310 */ \
- OP(DepthMask) /* 311 */ \
- OP(DepthRangef) /* 312 */ \
- OP(DetachShader) /* 313 */ \
- OP(Disable) /* 314 */ \
- OP(DisableVertexAttribArray) /* 315 */ \
- OP(DrawArrays) /* 316 */ \
- OP(DrawElements) /* 317 */ \
- OP(Enable) /* 318 */ \
- OP(EnableVertexAttribArray) /* 319 */ \
- OP(FenceSync) /* 320 */ \
- OP(Finish) /* 321 */ \
- OP(Flush) /* 322 */ \
- OP(FramebufferRenderbuffer) /* 323 */ \
- OP(FramebufferTexture2D) /* 324 */ \
- OP(FramebufferTextureLayer) /* 325 */ \
- OP(FrontFace) /* 326 */ \
- OP(GenBuffersImmediate) /* 327 */ \
- OP(GenerateMipmap) /* 328 */ \
- OP(GenFramebuffersImmediate) /* 329 */ \
- OP(GenRenderbuffersImmediate) /* 330 */ \
- OP(GenSamplersImmediate) /* 331 */ \
- OP(GenTexturesImmediate) /* 332 */ \
- OP(GenTransformFeedbacksImmediate) /* 333 */ \
- OP(GetActiveAttrib) /* 334 */ \
- OP(GetActiveUniform) /* 335 */ \
- OP(GetActiveUniformBlockiv) /* 336 */ \
- OP(GetActiveUniformBlockName) /* 337 */ \
- OP(GetActiveUniformsiv) /* 338 */ \
- OP(GetAttachedShaders) /* 339 */ \
- OP(GetAttribLocation) /* 340 */ \
- OP(GetBooleanv) /* 341 */ \
- OP(GetBufferParameteri64v) /* 342 */ \
- OP(GetBufferParameteriv) /* 343 */ \
- OP(GetError) /* 344 */ \
- OP(GetFloatv) /* 345 */ \
- OP(GetFragDataLocation) /* 346 */ \
- OP(GetFramebufferAttachmentParameteriv) /* 347 */ \
- OP(GetInteger64v) /* 348 */ \
- OP(GetIntegeri_v) /* 349 */ \
- OP(GetInteger64i_v) /* 350 */ \
- OP(GetIntegerv) /* 351 */ \
- OP(GetInternalformativ) /* 352 */ \
- OP(GetProgramiv) /* 353 */ \
- OP(GetProgramInfoLog) /* 354 */ \
- OP(GetRenderbufferParameteriv) /* 355 */ \
- OP(GetSamplerParameterfv) /* 356 */ \
- OP(GetSamplerParameteriv) /* 357 */ \
- OP(GetShaderiv) /* 358 */ \
- OP(GetShaderInfoLog) /* 359 */ \
- OP(GetShaderPrecisionFormat) /* 360 */ \
- OP(GetShaderSource) /* 361 */ \
- OP(GetString) /* 362 */ \
- OP(GetSynciv) /* 363 */ \
- OP(GetTexParameterfv) /* 364 */ \
- OP(GetTexParameteriv) /* 365 */ \
- OP(GetTransformFeedbackVarying) /* 366 */ \
- OP(GetUniformBlockIndex) /* 367 */ \
- OP(GetUniformfv) /* 368 */ \
- OP(GetUniformiv) /* 369 */ \
- OP(GetUniformuiv) /* 370 */ \
- OP(GetUniformIndices) /* 371 */ \
- OP(GetUniformLocation) /* 372 */ \
- OP(GetVertexAttribfv) /* 373 */ \
- OP(GetVertexAttribiv) /* 374 */ \
- OP(GetVertexAttribIiv) /* 375 */ \
- OP(GetVertexAttribIuiv) /* 376 */ \
- OP(GetVertexAttribPointerv) /* 377 */ \
- OP(Hint) /* 378 */ \
- OP(InvalidateFramebufferImmediate) /* 379 */ \
- OP(InvalidateSubFramebufferImmediate) /* 380 */ \
- OP(IsBuffer) /* 381 */ \
- OP(IsEnabled) /* 382 */ \
- OP(IsFramebuffer) /* 383 */ \
- OP(IsProgram) /* 384 */ \
- OP(IsRenderbuffer) /* 385 */ \
- OP(IsSampler) /* 386 */ \
- OP(IsShader) /* 387 */ \
- OP(IsSync) /* 388 */ \
- OP(IsTexture) /* 389 */ \
- OP(IsTransformFeedback) /* 390 */ \
- OP(LineWidth) /* 391 */ \
- OP(LinkProgram) /* 392 */ \
- OP(PauseTransformFeedback) /* 393 */ \
- OP(PixelStorei) /* 394 */ \
- OP(PolygonOffset) /* 395 */ \
- OP(ReadBuffer) /* 396 */ \
- OP(ReadPixels) /* 397 */ \
- OP(ReleaseShaderCompiler) /* 398 */ \
- OP(RenderbufferStorage) /* 399 */ \
- OP(ResumeTransformFeedback) /* 400 */ \
- OP(SampleCoverage) /* 401 */ \
- OP(SamplerParameterf) /* 402 */ \
- OP(SamplerParameterfvImmediate) /* 403 */ \
- OP(SamplerParameteri) /* 404 */ \
- OP(SamplerParameterivImmediate) /* 405 */ \
- OP(Scissor) /* 406 */ \
- OP(ShaderBinary) /* 407 */ \
- OP(ShaderSourceBucket) /* 408 */ \
- OP(StencilFunc) /* 409 */ \
- OP(StencilFuncSeparate) /* 410 */ \
- OP(StencilMask) /* 411 */ \
- OP(StencilMaskSeparate) /* 412 */ \
- OP(StencilOp) /* 413 */ \
- OP(StencilOpSeparate) /* 414 */ \
- OP(TexImage2D) /* 415 */ \
- OP(TexImage3D) /* 416 */ \
- OP(TexParameterf) /* 417 */ \
- OP(TexParameterfvImmediate) /* 418 */ \
- OP(TexParameteri) /* 419 */ \
- OP(TexParameterivImmediate) /* 420 */ \
- OP(TexStorage3D) /* 421 */ \
- OP(TexSubImage2D) /* 422 */ \
- OP(TexSubImage3D) /* 423 */ \
- OP(TransformFeedbackVaryingsBucket) /* 424 */ \
- OP(Uniform1f) /* 425 */ \
- OP(Uniform1fvImmediate) /* 426 */ \
- OP(Uniform1i) /* 427 */ \
- OP(Uniform1ivImmediate) /* 428 */ \
- OP(Uniform1ui) /* 429 */ \
- OP(Uniform1uivImmediate) /* 430 */ \
- OP(Uniform2f) /* 431 */ \
- OP(Uniform2fvImmediate) /* 432 */ \
- OP(Uniform2i) /* 433 */ \
- OP(Uniform2ivImmediate) /* 434 */ \
- OP(Uniform2ui) /* 435 */ \
- OP(Uniform2uivImmediate) /* 436 */ \
- OP(Uniform3f) /* 437 */ \
- OP(Uniform3fvImmediate) /* 438 */ \
- OP(Uniform3i) /* 439 */ \
- OP(Uniform3ivImmediate) /* 440 */ \
- OP(Uniform3ui) /* 441 */ \
- OP(Uniform3uivImmediate) /* 442 */ \
- OP(Uniform4f) /* 443 */ \
- OP(Uniform4fvImmediate) /* 444 */ \
- OP(Uniform4i) /* 445 */ \
- OP(Uniform4ivImmediate) /* 446 */ \
- OP(Uniform4ui) /* 447 */ \
- OP(Uniform4uivImmediate) /* 448 */ \
- OP(UniformBlockBinding) /* 449 */ \
- OP(UniformMatrix2fvImmediate) /* 450 */ \
- OP(UniformMatrix2x3fvImmediate) /* 451 */ \
- OP(UniformMatrix2x4fvImmediate) /* 452 */ \
- OP(UniformMatrix3fvImmediate) /* 453 */ \
- OP(UniformMatrix3x2fvImmediate) /* 454 */ \
- OP(UniformMatrix3x4fvImmediate) /* 455 */ \
- OP(UniformMatrix4fvImmediate) /* 456 */ \
- OP(UniformMatrix4x2fvImmediate) /* 457 */ \
- OP(UniformMatrix4x3fvImmediate) /* 458 */ \
- OP(UseProgram) /* 459 */ \
- OP(ValidateProgram) /* 460 */ \
- OP(VertexAttrib1f) /* 461 */ \
- OP(VertexAttrib1fvImmediate) /* 462 */ \
- OP(VertexAttrib2f) /* 463 */ \
- OP(VertexAttrib2fvImmediate) /* 464 */ \
- OP(VertexAttrib3f) /* 465 */ \
- OP(VertexAttrib3fvImmediate) /* 466 */ \
- OP(VertexAttrib4f) /* 467 */ \
- OP(VertexAttrib4fvImmediate) /* 468 */ \
- OP(VertexAttribI4i) /* 469 */ \
- OP(VertexAttribI4ivImmediate) /* 470 */ \
- OP(VertexAttribI4ui) /* 471 */ \
- OP(VertexAttribI4uivImmediate) /* 472 */ \
- OP(VertexAttribIPointer) /* 473 */ \
- OP(VertexAttribPointer) /* 474 */ \
- OP(Viewport) /* 475 */ \
- OP(WaitSync) /* 476 */ \
- OP(BlitFramebufferCHROMIUM) /* 477 */ \
- OP(RenderbufferStorageMultisampleCHROMIUM) /* 478 */ \
- OP(RenderbufferStorageMultisampleEXT) /* 479 */ \
- OP(FramebufferTexture2DMultisampleEXT) /* 480 */ \
- OP(TexStorage2DEXT) /* 481 */ \
- OP(GenQueriesEXTImmediate) /* 482 */ \
- OP(DeleteQueriesEXTImmediate) /* 483 */ \
- OP(QueryCounterEXT) /* 484 */ \
- OP(BeginQueryEXT) /* 485 */ \
- OP(BeginTransformFeedback) /* 486 */ \
- OP(EndQueryEXT) /* 487 */ \
- OP(EndTransformFeedback) /* 488 */ \
- OP(SetDisjointValueSyncCHROMIUM) /* 489 */ \
- OP(InsertEventMarkerEXT) /* 490 */ \
- OP(PushGroupMarkerEXT) /* 491 */ \
- OP(PopGroupMarkerEXT) /* 492 */ \
- OP(GenVertexArraysOESImmediate) /* 493 */ \
- OP(DeleteVertexArraysOESImmediate) /* 494 */ \
- OP(IsVertexArrayOES) /* 495 */ \
- OP(BindVertexArrayOES) /* 496 */ \
- OP(SwapBuffers) /* 497 */ \
- OP(GetMaxValueInBufferCHROMIUM) /* 498 */ \
- OP(EnableFeatureCHROMIUM) /* 499 */ \
- OP(MapBufferRange) /* 500 */ \
- OP(UnmapBuffer) /* 501 */ \
- OP(ResizeCHROMIUM) /* 502 */ \
- OP(GetRequestableExtensionsCHROMIUM) /* 503 */ \
- OP(RequestExtensionCHROMIUM) /* 504 */ \
- OP(GetProgramInfoCHROMIUM) /* 505 */ \
- OP(GetUniformBlocksCHROMIUM) /* 506 */ \
- OP(GetTransformFeedbackVaryingsCHROMIUM) /* 507 */ \
- OP(GetUniformsES3CHROMIUM) /* 508 */ \
- OP(GetTranslatedShaderSourceANGLE) /* 509 */ \
- OP(PostSubBufferCHROMIUM) /* 510 */ \
- OP(TexImageIOSurface2DCHROMIUM) /* 511 */ \
- OP(CopyTextureCHROMIUM) /* 512 */ \
- OP(CopySubTextureCHROMIUM) /* 513 */ \
- OP(CompressedCopyTextureCHROMIUM) /* 514 */ \
- OP(DrawArraysInstancedANGLE) /* 515 */ \
- OP(DrawElementsInstancedANGLE) /* 516 */ \
- OP(VertexAttribDivisorANGLE) /* 517 */ \
- OP(GenMailboxCHROMIUM) /* 518 */ \
- OP(ProduceTextureCHROMIUMImmediate) /* 519 */ \
- OP(ProduceTextureDirectCHROMIUMImmediate) /* 520 */ \
- OP(ConsumeTextureCHROMIUMImmediate) /* 521 */ \
- OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 522 */ \
- OP(BindUniformLocationCHROMIUMBucket) /* 523 */ \
- OP(GenValuebuffersCHROMIUMImmediate) /* 524 */ \
- OP(DeleteValuebuffersCHROMIUMImmediate) /* 525 */ \
- OP(IsValuebufferCHROMIUM) /* 526 */ \
- OP(BindValuebufferCHROMIUM) /* 527 */ \
- OP(SubscribeValueCHROMIUM) /* 528 */ \
- OP(PopulateSubscribedValuesCHROMIUM) /* 529 */ \
- OP(UniformValuebufferCHROMIUM) /* 530 */ \
- OP(BindTexImage2DCHROMIUM) /* 531 */ \
- OP(ReleaseTexImage2DCHROMIUM) /* 532 */ \
- OP(TraceBeginCHROMIUM) /* 533 */ \
- OP(TraceEndCHROMIUM) /* 534 */ \
- OP(DiscardFramebufferEXTImmediate) /* 535 */ \
- OP(LoseContextCHROMIUM) /* 536 */ \
- OP(InsertFenceSyncCHROMIUM) /* 537 */ \
- OP(GenSyncTokenCHROMIUMImmediate) /* 538 */ \
- OP(GenUnverifiedSyncTokenCHROMIUMImmediate) /* 539 */ \
- OP(VerifySyncTokensCHROMIUMImmediate) /* 540 */ \
- OP(WaitSyncTokenCHROMIUM) /* 541 */ \
- OP(DrawBuffersEXTImmediate) /* 542 */ \
- OP(DiscardBackbufferCHROMIUM) /* 543 */ \
- OP(ScheduleOverlayPlaneCHROMIUM) /* 544 */ \
- OP(ScheduleCALayerCHROMIUM) /* 545 */ \
- OP(CommitOverlayPlanesCHROMIUM) /* 546 */ \
- OP(SwapInterval) /* 547 */ \
- OP(FlushDriverCachesCHROMIUM) /* 548 */ \
- OP(MatrixLoadfCHROMIUMImmediate) /* 549 */ \
- OP(MatrixLoadIdentityCHROMIUM) /* 550 */ \
- OP(GenPathsCHROMIUM) /* 551 */ \
- OP(DeletePathsCHROMIUM) /* 552 */ \
- OP(IsPathCHROMIUM) /* 553 */ \
- OP(PathCommandsCHROMIUM) /* 554 */ \
- OP(PathParameterfCHROMIUM) /* 555 */ \
- OP(PathParameteriCHROMIUM) /* 556 */ \
- OP(PathStencilFuncCHROMIUM) /* 557 */ \
- OP(StencilFillPathCHROMIUM) /* 558 */ \
- OP(StencilStrokePathCHROMIUM) /* 559 */ \
- OP(CoverFillPathCHROMIUM) /* 560 */ \
- OP(CoverStrokePathCHROMIUM) /* 561 */ \
- OP(StencilThenCoverFillPathCHROMIUM) /* 562 */ \
- OP(StencilThenCoverStrokePathCHROMIUM) /* 563 */ \
- OP(StencilFillPathInstancedCHROMIUM) /* 564 */ \
- OP(StencilStrokePathInstancedCHROMIUM) /* 565 */ \
- OP(CoverFillPathInstancedCHROMIUM) /* 566 */ \
- OP(CoverStrokePathInstancedCHROMIUM) /* 567 */ \
- OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 568 */ \
- OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 569 */ \
- OP(BindFragmentInputLocationCHROMIUMBucket) /* 570 */ \
- OP(ProgramPathFragmentInputGenCHROMIUM) /* 571 */ \
- OP(CoverageModulationCHROMIUM) /* 572 */ \
- OP(BlendBarrierKHR) /* 573 */ \
- OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 574 */ \
- OP(BindFragDataLocationIndexedEXTBucket) /* 575 */ \
- OP(BindFragDataLocationEXTBucket) /* 576 */ \
- OP(GetFragDataIndexEXT) /* 577 */
+#define GLES2_COMMAND_LIST(OP) \
+ OP(ActiveTexture) /* 256 */ \
+ OP(AttachShader) /* 257 */ \
+ OP(BindAttribLocationBucket) /* 258 */ \
+ OP(BindBuffer) /* 259 */ \
+ OP(BindBufferBase) /* 260 */ \
+ OP(BindBufferRange) /* 261 */ \
+ OP(BindFramebuffer) /* 262 */ \
+ OP(BindRenderbuffer) /* 263 */ \
+ OP(BindSampler) /* 264 */ \
+ OP(BindTexture) /* 265 */ \
+ OP(BindTransformFeedback) /* 266 */ \
+ OP(BlendColor) /* 267 */ \
+ OP(BlendEquation) /* 268 */ \
+ OP(BlendEquationSeparate) /* 269 */ \
+ OP(BlendFunc) /* 270 */ \
+ OP(BlendFuncSeparate) /* 271 */ \
+ OP(BufferData) /* 272 */ \
+ OP(BufferSubData) /* 273 */ \
+ OP(CheckFramebufferStatus) /* 274 */ \
+ OP(Clear) /* 275 */ \
+ OP(ClearBufferfi) /* 276 */ \
+ OP(ClearBufferfvImmediate) /* 277 */ \
+ OP(ClearBufferivImmediate) /* 278 */ \
+ OP(ClearBufferuivImmediate) /* 279 */ \
+ OP(ClearColor) /* 280 */ \
+ OP(ClearDepthf) /* 281 */ \
+ OP(ClearStencil) /* 282 */ \
+ OP(ClientWaitSync) /* 283 */ \
+ OP(ColorMask) /* 284 */ \
+ OP(CompileShader) /* 285 */ \
+ OP(CompressedTexImage2DBucket) /* 286 */ \
+ OP(CompressedTexImage2D) /* 287 */ \
+ OP(CompressedTexSubImage2DBucket) /* 288 */ \
+ OP(CompressedTexSubImage2D) /* 289 */ \
+ OP(CompressedTexImage3DBucket) /* 290 */ \
+ OP(CompressedTexImage3D) /* 291 */ \
+ OP(CompressedTexSubImage3DBucket) /* 292 */ \
+ OP(CompressedTexSubImage3D) /* 293 */ \
+ OP(CopyBufferSubData) /* 294 */ \
+ OP(CopyTexImage2D) /* 295 */ \
+ OP(CopyTexSubImage2D) /* 296 */ \
+ OP(CopyTexSubImage3D) /* 297 */ \
+ OP(CreateProgram) /* 298 */ \
+ OP(CreateShader) /* 299 */ \
+ OP(CullFace) /* 300 */ \
+ OP(DeleteBuffersImmediate) /* 301 */ \
+ OP(DeleteFramebuffersImmediate) /* 302 */ \
+ OP(DeleteProgram) /* 303 */ \
+ OP(DeleteRenderbuffersImmediate) /* 304 */ \
+ OP(DeleteSamplersImmediate) /* 305 */ \
+ OP(DeleteSync) /* 306 */ \
+ OP(DeleteShader) /* 307 */ \
+ OP(DeleteTexturesImmediate) /* 308 */ \
+ OP(DeleteTransformFeedbacksImmediate) /* 309 */ \
+ OP(DepthFunc) /* 310 */ \
+ OP(DepthMask) /* 311 */ \
+ OP(DepthRangef) /* 312 */ \
+ OP(DetachShader) /* 313 */ \
+ OP(Disable) /* 314 */ \
+ OP(DisableVertexAttribArray) /* 315 */ \
+ OP(DrawArrays) /* 316 */ \
+ OP(DrawElements) /* 317 */ \
+ OP(Enable) /* 318 */ \
+ OP(EnableVertexAttribArray) /* 319 */ \
+ OP(FenceSync) /* 320 */ \
+ OP(Finish) /* 321 */ \
+ OP(Flush) /* 322 */ \
+ OP(FramebufferRenderbuffer) /* 323 */ \
+ OP(FramebufferTexture2D) /* 324 */ \
+ OP(FramebufferTextureLayer) /* 325 */ \
+ OP(FrontFace) /* 326 */ \
+ OP(GenBuffersImmediate) /* 327 */ \
+ OP(GenerateMipmap) /* 328 */ \
+ OP(GenFramebuffersImmediate) /* 329 */ \
+ OP(GenRenderbuffersImmediate) /* 330 */ \
+ OP(GenSamplersImmediate) /* 331 */ \
+ OP(GenTexturesImmediate) /* 332 */ \
+ OP(GenTransformFeedbacksImmediate) /* 333 */ \
+ OP(GetActiveAttrib) /* 334 */ \
+ OP(GetActiveUniform) /* 335 */ \
+ OP(GetActiveUniformBlockiv) /* 336 */ \
+ OP(GetActiveUniformBlockName) /* 337 */ \
+ OP(GetActiveUniformsiv) /* 338 */ \
+ OP(GetAttachedShaders) /* 339 */ \
+ OP(GetAttribLocation) /* 340 */ \
+ OP(GetBooleanv) /* 341 */ \
+ OP(GetBufferParameteri64v) /* 342 */ \
+ OP(GetBufferParameteriv) /* 343 */ \
+ OP(GetError) /* 344 */ \
+ OP(GetFloatv) /* 345 */ \
+ OP(GetFragDataLocation) /* 346 */ \
+ OP(GetFramebufferAttachmentParameteriv) /* 347 */ \
+ OP(GetInteger64v) /* 348 */ \
+ OP(GetIntegeri_v) /* 349 */ \
+ OP(GetInteger64i_v) /* 350 */ \
+ OP(GetIntegerv) /* 351 */ \
+ OP(GetInternalformativ) /* 352 */ \
+ OP(GetProgramiv) /* 353 */ \
+ OP(GetProgramInfoLog) /* 354 */ \
+ OP(GetRenderbufferParameteriv) /* 355 */ \
+ OP(GetSamplerParameterfv) /* 356 */ \
+ OP(GetSamplerParameteriv) /* 357 */ \
+ OP(GetShaderiv) /* 358 */ \
+ OP(GetShaderInfoLog) /* 359 */ \
+ OP(GetShaderPrecisionFormat) /* 360 */ \
+ OP(GetShaderSource) /* 361 */ \
+ OP(GetString) /* 362 */ \
+ OP(GetSynciv) /* 363 */ \
+ OP(GetTexParameterfv) /* 364 */ \
+ OP(GetTexParameteriv) /* 365 */ \
+ OP(GetTransformFeedbackVarying) /* 366 */ \
+ OP(GetUniformBlockIndex) /* 367 */ \
+ OP(GetUniformfv) /* 368 */ \
+ OP(GetUniformiv) /* 369 */ \
+ OP(GetUniformuiv) /* 370 */ \
+ OP(GetUniformIndices) /* 371 */ \
+ OP(GetUniformLocation) /* 372 */ \
+ OP(GetVertexAttribfv) /* 373 */ \
+ OP(GetVertexAttribiv) /* 374 */ \
+ OP(GetVertexAttribIiv) /* 375 */ \
+ OP(GetVertexAttribIuiv) /* 376 */ \
+ OP(GetVertexAttribPointerv) /* 377 */ \
+ OP(Hint) /* 378 */ \
+ OP(InvalidateFramebufferImmediate) /* 379 */ \
+ OP(InvalidateSubFramebufferImmediate) /* 380 */ \
+ OP(IsBuffer) /* 381 */ \
+ OP(IsEnabled) /* 382 */ \
+ OP(IsFramebuffer) /* 383 */ \
+ OP(IsProgram) /* 384 */ \
+ OP(IsRenderbuffer) /* 385 */ \
+ OP(IsSampler) /* 386 */ \
+ OP(IsShader) /* 387 */ \
+ OP(IsSync) /* 388 */ \
+ OP(IsTexture) /* 389 */ \
+ OP(IsTransformFeedback) /* 390 */ \
+ OP(LineWidth) /* 391 */ \
+ OP(LinkProgram) /* 392 */ \
+ OP(PauseTransformFeedback) /* 393 */ \
+ OP(PixelStorei) /* 394 */ \
+ OP(PolygonOffset) /* 395 */ \
+ OP(ReadBuffer) /* 396 */ \
+ OP(ReadPixels) /* 397 */ \
+ OP(ReleaseShaderCompiler) /* 398 */ \
+ OP(RenderbufferStorage) /* 399 */ \
+ OP(ResumeTransformFeedback) /* 400 */ \
+ OP(SampleCoverage) /* 401 */ \
+ OP(SamplerParameterf) /* 402 */ \
+ OP(SamplerParameterfvImmediate) /* 403 */ \
+ OP(SamplerParameteri) /* 404 */ \
+ OP(SamplerParameterivImmediate) /* 405 */ \
+ OP(Scissor) /* 406 */ \
+ OP(ShaderBinary) /* 407 */ \
+ OP(ShaderSourceBucket) /* 408 */ \
+ OP(StencilFunc) /* 409 */ \
+ OP(StencilFuncSeparate) /* 410 */ \
+ OP(StencilMask) /* 411 */ \
+ OP(StencilMaskSeparate) /* 412 */ \
+ OP(StencilOp) /* 413 */ \
+ OP(StencilOpSeparate) /* 414 */ \
+ OP(TexImage2D) /* 415 */ \
+ OP(TexImage3D) /* 416 */ \
+ OP(TexParameterf) /* 417 */ \
+ OP(TexParameterfvImmediate) /* 418 */ \
+ OP(TexParameteri) /* 419 */ \
+ OP(TexParameterivImmediate) /* 420 */ \
+ OP(TexStorage3D) /* 421 */ \
+ OP(TexSubImage2D) /* 422 */ \
+ OP(TexSubImage3D) /* 423 */ \
+ OP(TransformFeedbackVaryingsBucket) /* 424 */ \
+ OP(Uniform1f) /* 425 */ \
+ OP(Uniform1fvImmediate) /* 426 */ \
+ OP(Uniform1i) /* 427 */ \
+ OP(Uniform1ivImmediate) /* 428 */ \
+ OP(Uniform1ui) /* 429 */ \
+ OP(Uniform1uivImmediate) /* 430 */ \
+ OP(Uniform2f) /* 431 */ \
+ OP(Uniform2fvImmediate) /* 432 */ \
+ OP(Uniform2i) /* 433 */ \
+ OP(Uniform2ivImmediate) /* 434 */ \
+ OP(Uniform2ui) /* 435 */ \
+ OP(Uniform2uivImmediate) /* 436 */ \
+ OP(Uniform3f) /* 437 */ \
+ OP(Uniform3fvImmediate) /* 438 */ \
+ OP(Uniform3i) /* 439 */ \
+ OP(Uniform3ivImmediate) /* 440 */ \
+ OP(Uniform3ui) /* 441 */ \
+ OP(Uniform3uivImmediate) /* 442 */ \
+ OP(Uniform4f) /* 443 */ \
+ OP(Uniform4fvImmediate) /* 444 */ \
+ OP(Uniform4i) /* 445 */ \
+ OP(Uniform4ivImmediate) /* 446 */ \
+ OP(Uniform4ui) /* 447 */ \
+ OP(Uniform4uivImmediate) /* 448 */ \
+ OP(UniformBlockBinding) /* 449 */ \
+ OP(UniformMatrix2fvImmediate) /* 450 */ \
+ OP(UniformMatrix2x3fvImmediate) /* 451 */ \
+ OP(UniformMatrix2x4fvImmediate) /* 452 */ \
+ OP(UniformMatrix3fvImmediate) /* 453 */ \
+ OP(UniformMatrix3x2fvImmediate) /* 454 */ \
+ OP(UniformMatrix3x4fvImmediate) /* 455 */ \
+ OP(UniformMatrix4fvImmediate) /* 456 */ \
+ OP(UniformMatrix4x2fvImmediate) /* 457 */ \
+ OP(UniformMatrix4x3fvImmediate) /* 458 */ \
+ OP(UseProgram) /* 459 */ \
+ OP(ValidateProgram) /* 460 */ \
+ OP(VertexAttrib1f) /* 461 */ \
+ OP(VertexAttrib1fvImmediate) /* 462 */ \
+ OP(VertexAttrib2f) /* 463 */ \
+ OP(VertexAttrib2fvImmediate) /* 464 */ \
+ OP(VertexAttrib3f) /* 465 */ \
+ OP(VertexAttrib3fvImmediate) /* 466 */ \
+ OP(VertexAttrib4f) /* 467 */ \
+ OP(VertexAttrib4fvImmediate) /* 468 */ \
+ OP(VertexAttribI4i) /* 469 */ \
+ OP(VertexAttribI4ivImmediate) /* 470 */ \
+ OP(VertexAttribI4ui) /* 471 */ \
+ OP(VertexAttribI4uivImmediate) /* 472 */ \
+ OP(VertexAttribIPointer) /* 473 */ \
+ OP(VertexAttribPointer) /* 474 */ \
+ OP(Viewport) /* 475 */ \
+ OP(WaitSync) /* 476 */ \
+ OP(BlitFramebufferCHROMIUM) /* 477 */ \
+ OP(RenderbufferStorageMultisampleCHROMIUM) /* 478 */ \
+ OP(RenderbufferStorageMultisampleEXT) /* 479 */ \
+ OP(FramebufferTexture2DMultisampleEXT) /* 480 */ \
+ OP(TexStorage2DEXT) /* 481 */ \
+ OP(GenQueriesEXTImmediate) /* 482 */ \
+ OP(DeleteQueriesEXTImmediate) /* 483 */ \
+ OP(QueryCounterEXT) /* 484 */ \
+ OP(BeginQueryEXT) /* 485 */ \
+ OP(BeginTransformFeedback) /* 486 */ \
+ OP(EndQueryEXT) /* 487 */ \
+ OP(EndTransformFeedback) /* 488 */ \
+ OP(SetDisjointValueSyncCHROMIUM) /* 489 */ \
+ OP(InsertEventMarkerEXT) /* 490 */ \
+ OP(PushGroupMarkerEXT) /* 491 */ \
+ OP(PopGroupMarkerEXT) /* 492 */ \
+ OP(GenVertexArraysOESImmediate) /* 493 */ \
+ OP(DeleteVertexArraysOESImmediate) /* 494 */ \
+ OP(IsVertexArrayOES) /* 495 */ \
+ OP(BindVertexArrayOES) /* 496 */ \
+ OP(SwapBuffers) /* 497 */ \
+ OP(GetMaxValueInBufferCHROMIUM) /* 498 */ \
+ OP(EnableFeatureCHROMIUM) /* 499 */ \
+ OP(MapBufferRange) /* 500 */ \
+ OP(UnmapBuffer) /* 501 */ \
+ OP(ResizeCHROMIUM) /* 502 */ \
+ OP(GetRequestableExtensionsCHROMIUM) /* 503 */ \
+ OP(RequestExtensionCHROMIUM) /* 504 */ \
+ OP(GetProgramInfoCHROMIUM) /* 505 */ \
+ OP(GetUniformBlocksCHROMIUM) /* 506 */ \
+ OP(GetTransformFeedbackVaryingsCHROMIUM) /* 507 */ \
+ OP(GetUniformsES3CHROMIUM) /* 508 */ \
+ OP(GetTranslatedShaderSourceANGLE) /* 509 */ \
+ OP(PostSubBufferCHROMIUM) /* 510 */ \
+ OP(TexImageIOSurface2DCHROMIUM) /* 511 */ \
+ OP(CopyTextureCHROMIUM) /* 512 */ \
+ OP(CopySubTextureCHROMIUM) /* 513 */ \
+ OP(CompressedCopyTextureCHROMIUM) /* 514 */ \
+ OP(DrawArraysInstancedANGLE) /* 515 */ \
+ OP(DrawElementsInstancedANGLE) /* 516 */ \
+ OP(VertexAttribDivisorANGLE) /* 517 */ \
+ OP(GenMailboxCHROMIUM) /* 518 */ \
+ OP(ProduceTextureCHROMIUMImmediate) /* 519 */ \
+ OP(ProduceTextureDirectCHROMIUMImmediate) /* 520 */ \
+ OP(ConsumeTextureCHROMIUMImmediate) /* 521 */ \
+ OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 522 */ \
+ OP(BindUniformLocationCHROMIUMBucket) /* 523 */ \
+ OP(GenValuebuffersCHROMIUMImmediate) /* 524 */ \
+ OP(DeleteValuebuffersCHROMIUMImmediate) /* 525 */ \
+ OP(IsValuebufferCHROMIUM) /* 526 */ \
+ OP(BindValuebufferCHROMIUM) /* 527 */ \
+ OP(SubscribeValueCHROMIUM) /* 528 */ \
+ OP(PopulateSubscribedValuesCHROMIUM) /* 529 */ \
+ OP(UniformValuebufferCHROMIUM) /* 530 */ \
+ OP(BindTexImage2DCHROMIUM) /* 531 */ \
+ OP(ReleaseTexImage2DCHROMIUM) /* 532 */ \
+ OP(TraceBeginCHROMIUM) /* 533 */ \
+ OP(TraceEndCHROMIUM) /* 534 */ \
+ OP(DiscardFramebufferEXTImmediate) /* 535 */ \
+ OP(LoseContextCHROMIUM) /* 536 */ \
+ OP(InsertFenceSyncCHROMIUM) /* 537 */ \
+ OP(GenSyncTokenCHROMIUMImmediate) /* 538 */ \
+ OP(GenUnverifiedSyncTokenCHROMIUMImmediate) /* 539 */ \
+ OP(VerifySyncTokensCHROMIUMImmediate) /* 540 */ \
+ OP(WaitSyncTokenCHROMIUM) /* 541 */ \
+ OP(DrawBuffersEXTImmediate) /* 542 */ \
+ OP(DiscardBackbufferCHROMIUM) /* 543 */ \
+ OP(ScheduleOverlayPlaneCHROMIUM) /* 544 */ \
+ OP(ScheduleCALayerCHROMIUM) /* 545 */ \
+ OP(CommitOverlayPlanesCHROMIUM) /* 546 */ \
+ OP(SwapInterval) /* 547 */ \
+ OP(FlushDriverCachesCHROMIUM) /* 548 */ \
+ OP(MatrixLoadfCHROMIUMImmediate) /* 549 */ \
+ OP(MatrixLoadIdentityCHROMIUM) /* 550 */ \
+ OP(GenPathsCHROMIUM) /* 551 */ \
+ OP(DeletePathsCHROMIUM) /* 552 */ \
+ OP(IsPathCHROMIUM) /* 553 */ \
+ OP(PathCommandsCHROMIUM) /* 554 */ \
+ OP(PathParameterfCHROMIUM) /* 555 */ \
+ OP(PathParameteriCHROMIUM) /* 556 */ \
+ OP(PathStencilFuncCHROMIUM) /* 557 */ \
+ OP(StencilFillPathCHROMIUM) /* 558 */ \
+ OP(StencilStrokePathCHROMIUM) /* 559 */ \
+ OP(CoverFillPathCHROMIUM) /* 560 */ \
+ OP(CoverStrokePathCHROMIUM) /* 561 */ \
+ OP(StencilThenCoverFillPathCHROMIUM) /* 562 */ \
+ OP(StencilThenCoverStrokePathCHROMIUM) /* 563 */ \
+ OP(StencilFillPathInstancedCHROMIUM) /* 564 */ \
+ OP(StencilStrokePathInstancedCHROMIUM) /* 565 */ \
+ OP(CoverFillPathInstancedCHROMIUM) /* 566 */ \
+ OP(CoverStrokePathInstancedCHROMIUM) /* 567 */ \
+ OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 568 */ \
+ OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 569 */ \
+ OP(BindFragmentInputLocationCHROMIUMBucket) /* 570 */ \
+ OP(ProgramPathFragmentInputGenCHROMIUM) /* 571 */ \
+ OP(CoverageModulationCHROMIUM) /* 572 */ \
+ OP(BlendBarrierKHR) /* 573 */ \
+ OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 574 */ \
+ OP(BindFragDataLocationIndexedEXTBucket) /* 575 */ \
+ OP(BindFragDataLocationEXTBucket) /* 576 */ \
+ OP(GetFragDataIndexEXT) /* 577 */ \
+ OP(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate) /* 578 */
enum CommandId {
kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this.
diff --git a/gpu/command_buffer/service/gl_stream_texture_image.h b/gpu/command_buffer/service/gl_stream_texture_image.h
new file mode 100644
index 0000000..2cd710a
--- /dev/null
+++ b/gpu/command_buffer/service/gl_stream_texture_image.h
@@ -0,0 +1,33 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_
+#define GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_
+
+#include "ui/gl/gl_image.h"
+
+namespace gpu {
+namespace gles2 {
+
+// Specialization of GLImage that allows us to support (stream) textures
+// that supply a texture matrix.
+class GPU_EXPORT GLStreamTextureImage : public gl::GLImage {
+ public:
+ GLStreamTextureImage() {}
+
+ // Get the matrix.
+ // Copy the texture matrix for this image into |matrix|.
+ virtual void GetTextureMatrix(float matrix[16]) = 0;
+
+ protected:
+ ~GLStreamTextureImage() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GLStreamTextureImage);
+};
+
+} // namespace gles2
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 52118fb..fb1a366 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) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index a8f03ab..b56ae2c 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -5013,6 +5013,34 @@ error::Error GLES2DecoderImpl::HandleApplyScreenSpaceAntialiasingCHROMIUM(
return error::kNoError;
}
+error::Error
+GLES2DecoderImpl::HandleUniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate(
+ uint32_t immediate_data_size,
+ const void* cmd_data) {
+ const gles2::cmds::UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate& c =
+ *static_cast<const gles2::cmds::
+ UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate*>(
+ cmd_data);
+ (void)c;
+ GLint location = static_cast<GLint>(c.location);
+ GLboolean transpose = static_cast<GLboolean>(c.transpose);
+ uint32_t data_size;
+ if (!ComputeDataSize(1, sizeof(GLfloat), 16, &data_size)) {
+ return error::kOutOfBounds;
+ }
+ if (data_size > immediate_data_size) {
+ return error::kOutOfBounds;
+ }
+ const GLfloat* default_value =
+ GetImmediateDataAs<const GLfloat*>(c, data_size, immediate_data_size);
+ if (default_value == NULL) {
+ return error::kOutOfBounds;
+ }
+ DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(location, transpose,
+ default_value);
+ return error::kNoError;
+}
+
bool GLES2DecoderImpl::SetCapabilityState(GLenum cap, bool enabled) {
switch (cap) {
case GL_BLEND:
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index eaad260..e5430c1 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -22,6 +22,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/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
@@ -911,6 +912,7 @@ void Texture::SetLevelInfo(GLenum target,
info.format = format;
info.type = type;
info.image = 0;
+ info.stream_texture_image = 0;
info.image_state = UNBOUND;
info.internal_workaround = false;
@@ -1347,10 +1349,11 @@ bool Texture::ClearLevel(
return true;
}
-void Texture::SetLevelImage(GLenum target,
- GLint level,
- gl::GLImage* image,
- ImageState state) {
+void Texture::SetLevelImageInternal(GLenum target,
+ GLint level,
+ gl::GLImage* image,
+ GLStreamTextureImage* stream_texture_image,
+ ImageState state) {
DCHECK_GE(level, 0);
size_t face_index = GLES2Util::GLTargetToFaceIndex(target);
DCHECK_LT(static_cast<size_t>(face_index),
@@ -1362,15 +1365,29 @@ void Texture::SetLevelImage(GLenum target,
DCHECK_EQ(info.target, target);
DCHECK_EQ(info.level, level);
info.image = image;
+ info.stream_texture_image = stream_texture_image;
info.image_state = state;
UpdateCanRenderCondition();
UpdateHasImages();
}
-gl::GLImage* Texture::GetLevelImage(GLint target,
- GLint level,
- ImageState* state) const {
+void Texture::SetLevelImage(GLenum target,
+ GLint level,
+ gl::GLImage* image,
+ ImageState state) {
+ SetLevelImageInternal(target, level, image, nullptr, state);
+}
+
+void Texture::SetLevelStreamTextureImage(GLenum target,
+ GLint level,
+ GLStreamTextureImage* image,
+ ImageState state) {
+ SetLevelImageInternal(target, level, image, image, state);
+}
+
+const Texture::LevelInfo* Texture::GetLevelInfo(GLint target,
+ GLint level) const {
if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES &&
target != GL_TEXTURE_RECTANGLE_ARB) {
return NULL;
@@ -1380,19 +1397,37 @@ gl::GLImage* Texture::GetLevelImage(GLint target,
if (level >= 0 && face_index < face_infos_.size() &&
static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) {
const LevelInfo& info = face_infos_[face_index].level_infos[level];
- if (info.target != 0) {
- if (state)
- *state = info.image_state;
- return info.image.get();
- }
+ if (info.target != 0)
+ return &info;
}
return NULL;
}
+gl::GLImage* Texture::GetLevelImage(GLint target,
+ GLint level,
+ ImageState* state) const {
+ const LevelInfo* info = GetLevelInfo(target, level);
+ if (!info)
+ return nullptr;
+
+ if (state)
+ *state = info->image_state;
+ return info->image.get();
+}
+
gl::GLImage* Texture::GetLevelImage(GLint target, GLint level) const {
return GetLevelImage(target, level, nullptr);
}
+GLStreamTextureImage* Texture::GetLevelStreamTextureImage(GLint target,
+ GLint level) const {
+ const LevelInfo* info = GetLevelInfo(target, level);
+ if (!info)
+ return nullptr;
+
+ return info->stream_texture_image.get();
+}
+
void Texture::DumpLevelMemory(base::trace_event::ProcessMemoryDump* pmd,
uint64_t client_tracing_id,
const std::string& dump_name) const {
@@ -1888,6 +1923,15 @@ void TextureManager::SetLevelImage(TextureRef* ref,
ref->texture()->SetLevelImage(target, level, image, state);
}
+void TextureManager::SetLevelStreamTextureImage(TextureRef* ref,
+ GLenum target,
+ GLint level,
+ GLStreamTextureImage* image,
+ Texture::ImageState state) {
+ DCHECK(ref);
+ ref->texture()->SetLevelStreamTextureImage(target, level, image, state);
+}
+
size_t TextureManager::GetSignatureSize() const {
return sizeof(TextureTag) + sizeof(TextureSignature);
}
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index c57abec..50421ed 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -28,6 +28,7 @@ namespace gpu {
namespace gles2 {
class GLES2Decoder;
+class GLStreamTextureImage;
struct ContextState;
struct DecoderFramebufferState;
class Display;
@@ -167,6 +168,14 @@ class GPU_EXPORT Texture {
gl::GLImage* image,
ImageState state);
+ // Set the GLStreamTextureImage for a particular level. This is identical
+ // to SetLevelImage, but it also permits GetLevelStreamTextureImage to return
+ // the image.
+ void SetLevelStreamTextureImage(GLenum target,
+ GLint level,
+ GLStreamTextureImage* image,
+ ImageState state);
+
// Get the image associated with a particular level. Returns NULL if level
// does not exist.
gl::GLImage* GetLevelImage(GLint target,
@@ -174,6 +183,11 @@ class GPU_EXPORT Texture {
ImageState* state) const;
gl::GLImage* GetLevelImage(GLint target, GLint level) const;
+ // Like GetLevelImage, but will return NULL if the image wasn't set via
+ // a call to SetLevelStreamTextureImage.
+ GLStreamTextureImage* GetLevelStreamTextureImage(GLint target,
+ GLint level) const;
+
bool HasImages() const {
return has_images_;
}
@@ -278,6 +292,7 @@ class GPU_EXPORT Texture {
GLenum format;
GLenum type;
scoped_refptr<gl::GLImage> image;
+ scoped_refptr<GLStreamTextureImage> stream_texture_image;
ImageState image_state;
uint32_t estimated_size;
bool internal_workaround;
@@ -293,6 +308,17 @@ class GPU_EXPORT Texture {
std::vector<LevelInfo> level_infos;
};
+ // Helper for SetLevel*Image. |stream_texture_image| may be null.
+ void SetLevelImageInternal(GLenum target,
+ GLint level,
+ gl::GLImage* image,
+ GLStreamTextureImage* stream_texture_image,
+ ImageState state);
+
+ // Helper for GetLevel*Image. Returns the LevelInfo for |target| and |level|
+ // if it's set, else NULL.
+ const LevelInfo* GetLevelInfo(GLint target, GLint level) const;
+
// Set the info for a particular level.
void SetLevelInfo(GLenum target,
GLint level,
@@ -853,6 +879,12 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
gl::GLImage* image,
Texture::ImageState state);
+ void SetLevelStreamTextureImage(TextureRef* ref,
+ GLenum target,
+ GLint level,
+ GLStreamTextureImage* image,
+ Texture::ImageState state);
+
size_t GetSignatureSize() const;
void AddToSignature(
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index b23441c..80251b7 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -15,6 +15,7 @@
#include "gpu/command_buffer/service/error_state_mock.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/gles2_cmd_decoder_mock.h"
#include "gpu/command_buffer/service/gpu_service_test.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
@@ -139,6 +140,38 @@ const GLint TextureManagerTest::kMaxExternalLevels;
const GLint TextureManagerTest::kMax3dLevels;
#endif
+class GLStreamTextureImageStub : public GLStreamTextureImage {
+ public:
+ GLStreamTextureImageStub() {}
+
+ // Overridden from GLImage:
+ void Destroy(bool have_context) override {}
+ gfx::Size GetSize() override { return gfx::Size(); }
+ unsigned GetInternalFormat() override { return 0; }
+ bool BindTexImage(unsigned target) override { return false; }
+ void ReleaseTexImage(unsigned target) override {}
+ bool CopyTexImage(unsigned target) override { return false; }
+ bool CopyTexSubImage(unsigned target,
+ const gfx::Point& offset,
+ const gfx::Rect& rect) override {
+ return false;
+ }
+ bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
+ int z_order,
+ gfx::OverlayTransform transform,
+ const gfx::Rect& bounds_rect,
+ const gfx::RectF& crop_rect) override {
+ return false;
+ }
+ void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
+ uint64_t process_tracing_id,
+ const std::string& dump_name) override {}
+ void GetTextureMatrix(float matrix[16]) override {}
+
+ protected:
+ ~GLStreamTextureImageStub() override {}
+};
+
TEST_F(TextureManagerTest, Basic) {
const GLuint kClient1Id = 1;
const GLuint kService1Id = 11;
@@ -1508,6 +1541,7 @@ TEST_F(TextureTest, GetLevelImage) {
manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get(),
Texture::BOUND);
EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
+ EXPECT_TRUE(texture->GetLevelStreamTextureImage(GL_TEXTURE_2D, 1) == NULL);
// Remove it.
manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, nullptr,
Texture::UNBOUND);
@@ -1518,6 +1552,41 @@ TEST_F(TextureTest, GetLevelImage) {
manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1,
0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(2, 2));
EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
+ EXPECT_TRUE(texture->GetLevelStreamTextureImage(GL_TEXTURE_2D, 1) == NULL);
+}
+
+TEST_F(TextureTest, GetLevelStreamTextureImage) {
+ manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
+ manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES, 0,
+ GL_RGBA, 2, 2, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ gfx::Rect(2, 2));
+ Texture* texture = texture_ref_->texture();
+
+ // Set image.
+ scoped_refptr<GLStreamTextureImage> image(new GLStreamTextureImageStub);
+ manager_->SetLevelStreamTextureImage(texture_ref_.get(),
+ GL_TEXTURE_EXTERNAL_OES, 0, image.get(),
+ Texture::BOUND);
+ EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0) == NULL);
+ EXPECT_FALSE(
+ texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 0) == NULL);
+ // Replace it as a normal image.
+ manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES, 0,
+ image.get(), Texture::BOUND);
+ EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0) == NULL);
+ EXPECT_TRUE(texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 0) ==
+ NULL);
+
+ // Image should be reset when SetLevelInfo is called.
+ manager_->SetLevelStreamTextureImage(texture_ref_.get(),
+ GL_TEXTURE_EXTERNAL_OES, 0, image.get(),
+ Texture::UNBOUND);
+ manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES, 0,
+ GL_RGBA, 2, 2, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ gfx::Rect(2, 2));
+ EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0) == NULL);
+ EXPECT_TRUE(texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 0) ==
+ NULL);
}
namespace {
diff --git a/mojo/gpu/mojo_gles2_impl_autogen.cc b/mojo/gpu/mojo_gles2_impl_autogen.cc
index 453f9e2..09a0d38 100644
--- a/mojo/gpu/mojo_gles2_impl_autogen.cc
+++ b/mojo/gpu/mojo_gles2_impl_autogen.cc
@@ -1921,5 +1921,13 @@ GLint MojoGLES2Impl::GetFragDataIndexEXT(GLuint program, const char* name) {
MojoGLES2MakeCurrent(context_);
return glGetFragDataIndexEXT(program, name);
}
+void MojoGLES2Impl::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) {
+ MojoGLES2MakeCurrent(context_);
+ glUniformMatrix4fvStreamTextureMatrixCHROMIUM(location, transpose,
+ default_value);
+}
} // namespace mojo
diff --git a/mojo/gpu/mojo_gles2_impl_autogen.h b/mojo/gpu/mojo_gles2_impl_autogen.h
index e3de37b..503e392 100644
--- a/mojo/gpu/mojo_gles2_impl_autogen.h
+++ b/mojo/gpu/mojo_gles2_impl_autogen.h
@@ -888,6 +888,10 @@ class MojoGLES2Impl : public gpu::gles2::GLES2Interface {
GLuint colorNumber,
const char* name) override;
GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
+ void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
+ GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value) override;
private:
MojoGLES2Context context_;
diff --git a/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h b/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h
index 9230be3..5f04825 100644
--- a/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h
+++ b/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h
@@ -578,3 +578,9 @@ VISIT_GL_CALL(GetFragDataIndexEXT,
GLint,
(GLuint program, const char* name),
(program, name))
+VISIT_GL_CALL(UniformMatrix4fvStreamTextureMatrixCHROMIUM,
+ void,
+ (GLint location,
+ GLboolean transpose,
+ const GLfloat* default_value),
+ (location, transpose, default_value))