aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2021-05-13 13:33:19 -0700
committerLingfeng Yang <lfy@google.com>2021-05-13 13:47:35 -0700
commit0552a41da73b771fa3479b17cf21ffbde883f0aa (patch)
tree21a8092936f152ea03aca33810416076ec68076d
parent980ea215e36aac0cda10dfa6e7adf2f1aac4f3cd (diff)
downloadgoldfish-opengl-0552a41da73b771fa3479b17cf21ffbde883f0aa.tar.gz
gles: fix regressions in negative api
These relate to some bound RBO == 0 invalid errors, and returning the wrong error for wrong internalformat arguments. Also, init the default width/height to zero for each framebuffer props object. Bug: 186021150 Change-Id: Ic2090297cc5679171b96bd6c4a9ec293c87ddc1e
-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 4640e706..717b488d 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -2602,7 +2602,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);
@@ -2753,7 +2754,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);
@@ -2939,6 +2940,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);
@@ -3365,6 +3367,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).
@@ -4237,6 +4240,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) ||
@@ -6575,6 +6579,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);
}