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

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

Issue 2182443003: WebGL 2: Fix bugs in negativetextureapi.html for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code per zmo's review: fix the bug in cmd buffer, instead of Blink WebGL 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 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 849edbb3f448213cd00b13a8d99f2b0a3755f803..6a859ae9a137ab61f85feba1b8bbcf216662c694 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -969,6 +969,18 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
GLsizei image_size,
const void* data);
+ // Wrapper for CopyTexSubImage3D.
+ void DoCopyTexSubImage3D(
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+
// Validate if |format| is valid for CopyTex{Sub}Image functions.
// If not, generate a GL error and return false.
bool ValidateCopyTexFormat(const char* func_name, GLenum internal_format,
@@ -12583,6 +12595,33 @@ void GLES2DecoderImpl::DoCompressedTexSubImage3D(
ExitCommandProcessingEarly();
}
+void GLES2DecoderImpl::DoCopyTexSubImage3D(
+ GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height) {
+ if (!texture_manager()->ValidForTarget(target, level, width, height, 1)) {
Zhenyao Mo 2016/07/26 13:25:55 Please look at CopyTexSubImage2D. You will need m
yunchao 2016/07/26 13:30:50 Acknowledged.
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_VALUE,
+ "glCopyTexSubImage3D", "dimensions out of range");
Zhenyao Mo 2016/07/26 13:25:55 nit: define a const char* function_name, so you do
yunchao 2016/07/26 13:30:50 Acknowledged.
+ return;
+ }
+ TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
+ &state_, target);
+ if (!texture_ref) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopyTexSubImage3D",
+ "unknown texture for target");
+ return;
+ }
+ Texture* texture = texture_ref->texture();
+ if (!texture->ValidForTexture(target, level, xoffset, yoffset, zoffset,
+ width, height, 1)) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTexSubImage3D",
+ "bad dimensions");
+ return;
+ }
+ glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width,
+ height);
+}
+
error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size,
const void* cmd_data) {
const gles2::cmds::TexImage2D& c =

Powered by Google App Engine
This is Rietveld 408576698