Commit 659d89e9 by Nicolas Capens Committed by Nicolas Capens

Support glCopyTexImage2D for float formats.

Bug chromium:853424 Change-Id: I9b2de054baf6b042bcd04c5d023099a39ca20d2a Reviewed-on: https://swiftshader-review.googlesource.com/19569Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 83463115
...@@ -953,6 +953,10 @@ void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, ...@@ -953,6 +953,10 @@ void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x,
{ {
internalformat = gl::GetSizedInternalFormat(internalformat, GL_HALF_FLOAT_OES); internalformat = gl::GetSizedInternalFormat(internalformat, GL_HALF_FLOAT_OES);
} }
else if(GetColorComponentType(colorbufferFormat) == GL_FLOAT && GetRedSize(colorbufferFormat) == 32) // GL_EXT_color_buffer_float
{
internalformat = gl::GetSizedInternalFormat(internalformat, GL_FLOAT);
}
else else
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
...@@ -6350,6 +6354,7 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP ...@@ -6350,6 +6354,7 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP
FUNCTION(glDeleteVertexArrays), FUNCTION(glDeleteVertexArrays),
FUNCTION(glDeleteVertexArraysOES), FUNCTION(glDeleteVertexArraysOES),
FUNCTION(glDepthFunc), FUNCTION(glDepthFunc),
//FUNCTION(DepthFunc),
FUNCTION(glDepthMask), FUNCTION(glDepthMask),
FUNCTION(glDepthRangef), FUNCTION(glDepthRangef),
FUNCTION(glDetachShader), FUNCTION(glDetachShader),
......
...@@ -190,6 +190,8 @@ protected: ...@@ -190,6 +190,8 @@ protected:
void Uninitialize() void Uninitialize()
{ {
EXPECT_GLENUM_EQ(GL_NO_ERROR, glGetError());
EGLBoolean success = eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); EGLBoolean success = eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
EXPECT_EQ(EGL_SUCCESS, eglGetError()); EXPECT_EQ(EGL_SUCCESS, eglGetError());
EXPECT_EQ((EGLBoolean)EGL_TRUE, success); EXPECT_EQ((EGLBoolean)EGL_TRUE, success);
...@@ -556,6 +558,35 @@ TEST_F(SwiftShaderTest, ClearDirtyTexture) ...@@ -556,6 +558,35 @@ TEST_F(SwiftShaderTest, ClearDirtyTexture)
Uninitialize(); Uninitialize();
} }
// Tests copying between textures of different floating-point formats using a framebuffer object.
TEST_F(SwiftShaderTest, CopyTexImage)
{
Initialize(3, false);
GLuint tex1 = 1;
float green[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
glBindTexture(GL_TEXTURE_2D, tex1);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, 16, 16);
glTexSubImage2D(GL_TEXTURE_2D, 0, 5, 10, 1, 1, GL_RGBA, GL_FLOAT, &green);
EXPECT_GLENUM_EQ(GL_NONE, glGetError());
GLuint fbo = 1;
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex1, 0);
EXPECT_GLENUM_EQ(GL_NONE, glGetError());
GLuint tex2 = 2;
glBindTexture(GL_TEXTURE_2D, tex2);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 6, 8, 8, 0);
EXPECT_GLENUM_EQ(GL_NONE, glGetError());
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2, 0);
expectFramebufferColor(green, 3, 4);
EXPECT_GLENUM_EQ(GL_NONE, glGetError());
Uninitialize();
}
// Tests construction of a structure containing a single matrix // Tests construction of a structure containing a single matrix
TEST_F(SwiftShaderTest, MatrixInStruct) TEST_F(SwiftShaderTest, MatrixInStruct)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment