aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2021-05-14 16:05:08 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-14 16:05:08 +0000
commit7d3ed836c9b85ae821b544c1815fa6fe80108f25 (patch)
treec2c1e48e59b5d405e7faa159e203e1b4ac96c231
parent43539203d10397ce2a0ca8f600975b95d93e12d4 (diff)
parentd2eaa4543846f6f410675afcf18f680423fb723a (diff)
downloadgoldfish-opengl-7d3ed836c9b85ae821b544c1815fa6fe80108f25.tar.gz
Merge "gles: fix regressions in negative api" am: 31a0bd2d92 am: d2eaa45438
Original change: https://android-review.googlesource.com/c/device/generic/goldfish-opengl/+/1705068 Change-Id: I13f595398beb7bcc7195225942ffd51bb5f3bccf
-rw-r--r--shared/OpenglCodecCommon/GLClientState.cpp8
-rwxr-xr-xsystem/GLESv2_enc/GL2Encoder.cpp9
2 files changed, 14 insertions, 3 deletions
diff --git a/shared/OpenglCodecCommon/GLClientState.cpp b/shared/OpenglCodecCommon/GLClientState.cpp
index edaa3635..0915341d 100644
--- a/shared/OpenglCodecCommon/GLClientState.cpp
+++ b/shared/OpenglCodecCommon/GLClientState.cpp
@@ -1760,7 +1760,9 @@ GLuint GLClientState::getBoundFramebuffer(GLenum target) const
GLenum GLClientState::checkFramebufferCompleteness(GLenum target) {
// Default framebuffer is complete
// TODO: Check the case where the default framebuffer is 0x0
- if (0 == boundFramebuffer(target)) return GL_FRAMEBUFFER_COMPLETE;
+ if (0 == boundFramebuffer(target)) {
+ return GL_FRAMEBUFFER_COMPLETE;
+ }
bool hasAttachment = false;
FboProps& props = boundFboProps(target);
@@ -2469,6 +2471,10 @@ void GLClientState::addFreshFramebuffer(GLuint name) {
props.depthAttachment_hasRbo = false;
props.stencilAttachment_hasRbo = false;
props.depthstencilAttachment_hasRbo = false;
+
+ props.defaultWidth = 0;
+ props.defaultHeight = 0;
+
mFboState.fboData[name] = props;
}
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 4a90795f..9fcce622 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -2609,7 +2609,8 @@ void GL2Encoder::s_glTexImage2D(void* self, GLenum target, GLint level,
SET_ERROR_IF(!GLESv2Validation::textureTarget(ctx, target), GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validation::pixelType(ctx, type), GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validation::pixelFormat(ctx, format), GL_INVALID_ENUM);
- SET_ERROR_IF(!GLESv2Validation::pixelFormat(ctx, internalformat) && !GLESv2Validation::pixelInternalFormat(internalformat), GL_INVALID_ENUM);
+ SET_ERROR_IF(!GLESv2Validation::pixelFormat(ctx, internalformat) && !GLESv2Validation::pixelInternalFormat(internalformat), GL_INVALID_VALUE);
+ SET_ERROR_IF(!(GLESv2Validation::pixelOp(format,type)),GL_INVALID_OPERATION);
SET_ERROR_IF(!GLESv2Validation::pixelSizedFormat(ctx, internalformat, format, type), GL_INVALID_OPERATION);
// If unpack buffer is nonzero, verify unmapped state.
SET_ERROR_IF(ctx->isBufferTargetMapped(GL_PIXEL_UNPACK_BUFFER), GL_INVALID_OPERATION);
@@ -2760,7 +2761,7 @@ void GL2Encoder::s_glCopyTexImage2D(void* self, GLenum target, GLint level,
GLClientState* state = ctx->m_state;
SET_ERROR_IF(!GLESv2Validation::textureTarget(ctx, target), GL_INVALID_ENUM);
- SET_ERROR_IF(!GLESv2Validation::pixelFormat(ctx, internalformat) && !GLESv2Validation::pixelInternalFormat(internalformat), GL_INVALID_ENUM);
+ SET_ERROR_IF(!GLESv2Validation::pixelFormat(ctx, internalformat) && !GLESv2Validation::pixelInternalFormat(internalformat), GL_INVALID_VALUE);
GLint max_texture_size;
GLint max_cube_map_texture_size;
ctx->glGetIntegerv(ctx, GL_MAX_TEXTURE_SIZE, &max_texture_size);
@@ -2946,6 +2947,7 @@ void GL2Encoder::s_glRenderbufferStorage(void* self,
GLClientState* state = ctx->m_state;
SET_ERROR_IF(target != GL_RENDERBUFFER, GL_INVALID_ENUM);
+ SET_ERROR_IF(0 == ctx->m_state->boundRenderbuffer(), GL_INVALID_OPERATION);
SET_ERROR_IF(
!GLESv2Validation::rboFormat(ctx, internalformat),
GL_INVALID_ENUM);
@@ -3372,6 +3374,7 @@ void GL2Encoder::s_glCompressedTexImage2D(void* self, GLenum target, GLint level
SET_ERROR_IF(!GLESv2Validation::textureTarget(ctx, target), GL_INVALID_ENUM);
SET_ERROR_IF(target == GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM);
+ fprintf(stderr, "%s: format: 0x%x\n", __func__, internalformat);
// Filter compressed formats support.
SET_ERROR_IF(!GLESv2Validation::supportedCompressedFormat(ctx, internalformat), GL_INVALID_ENUM);
// Verify level <= log2(GL_MAX_TEXTURE_SIZE).
@@ -4244,6 +4247,7 @@ void GL2Encoder::s_glTexImage3D(void* self, GLenum target, GLint level, GLint in
GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validation::pixelType(ctx, type), GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validation::pixelFormat(ctx, format), GL_INVALID_ENUM);
+ SET_ERROR_IF(!(GLESv2Validation::pixelOp(format,type)),GL_INVALID_OPERATION);
SET_ERROR_IF(!GLESv2Validation::pixelSizedFormat(ctx, internalFormat, format, type), GL_INVALID_OPERATION);
SET_ERROR_IF(target == GL_TEXTURE_3D &&
((format == GL_DEPTH_COMPONENT) ||
@@ -6582,6 +6586,7 @@ void GL2Encoder::s_glGetRenderbufferParameteriv(void *self , GLenum target, GLen
GL2Encoder* ctx = (GL2Encoder*)self;
SET_ERROR_IF(target != GL_RENDERBUFFER, GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validation::allowedGetRenderbufferParameter(pname), GL_INVALID_ENUM);
+ SET_ERROR_IF(0 == ctx->m_state->boundRenderbuffer(), GL_INVALID_OPERATION);
ctx->m_glGetRenderbufferParameteriv_enc(ctx, target, pname, params);
}