Fixed framebuffer-object-attachment WebGL conformance test.
We updated it with WebGL conformance test r14153 to exercise zero-size FBO attachments, which failed with ANGLE. The new conformance test passes with OpenGL and Mesa.
See this Chromium bug:
http://code.google.com/p/chromium/issues/detail?id=75666
D3D fails if you try to create a zero size depth buffer but OpenGL ES2 allows it. D3D / drivers seem to sometimes crash rather than fail normally, though this might just be because some users have enabled the D3D debug runtime and break on error and we're getting the reports.
It was also returning unexpected results when calling GetRenderbufferParameter for parameters that do not apply to a particular buffer. For example, RED_SIZE for a zero sized depth buffer should be 0.
Tested by running WebGL conformance test with retail D3D runtime (passes) and debug D3D runtime (passes and does not assert in D3D or ANGLE).
Review URL: http://codereview.appspot.com/4284053
git-svn-id: https://angleproject.googlecode.com/svn/trunk@577 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index e810b29..be5c07f 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
-#define BUILD_REVISION 576
+#define BUILD_REVISION 577
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/Renderbuffer.cpp b/src/libGLESv2/Renderbuffer.cpp
index 7597504..fed235c 100644
--- a/src/libGLESv2/Renderbuffer.cpp
+++ b/src/libGLESv2/Renderbuffer.cpp
@@ -280,14 +280,11 @@
ASSERT(SUCCEEDED(result));
}
- if (mRenderTarget)
- {
- mWidth = width;
- mHeight = height;
- mInternalFormat = format;
- mD3DFormat = requestedFormat;
- mSamples = supportedSamples;
- }
+ mWidth = width;
+ mHeight = height;
+ mInternalFormat = format;
+ mD3DFormat = requestedFormat;
+ mSamples = supportedSamples;
}
Colorbuffer::~Colorbuffer()
@@ -400,26 +397,26 @@
return;
}
- HRESULT result = device->CreateDepthStencilSurface(width, height, D3DFMT_D24S8, es2dx::GetMultisampleTypeFromSamples(supportedSamples),
- 0, FALSE, &mDepthStencil, 0);
-
- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ if (width > 0 && height > 0)
{
- error(GL_OUT_OF_MEMORY);
+ HRESULT result = device->CreateDepthStencilSurface(width, height, D3DFMT_D24S8, es2dx::GetMultisampleTypeFromSamples(supportedSamples),
+ 0, FALSE, &mDepthStencil, 0);
- return;
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ ASSERT(SUCCEEDED(result));
}
- ASSERT(SUCCEEDED(result));
-
- if (mDepthStencil)
- {
- mWidth = width;
- mHeight = height;
- mInternalFormat = GL_DEPTH24_STENCIL8_OES;
- mD3DFormat = D3DFMT_D24S8;
- mSamples = supportedSamples;
- }
+ mWidth = width;
+ mHeight = height;
+ mInternalFormat = GL_DEPTH24_STENCIL8_OES;
+ mD3DFormat = D3DFMT_D24S8;
+ mSamples = supportedSamples;
}
DepthStencilbuffer::~DepthStencilbuffer()
diff --git a/src/libGLESv2/utilities.cpp b/src/libGLESv2/utilities.cpp
index ae1df8e..ba23fd3 100644
--- a/src/libGLESv2/utilities.cpp
+++ b/src/libGLESv2/utilities.cpp
@@ -696,9 +696,9 @@
return 0;
//case D3DFMT_D32_LOCKABLE: return 0; // DirectX 9Ex only
//case D3DFMT_S8_LOCKABLE: return 8; // DirectX 9Ex only
- default: UNREACHABLE();
+ default:
+ return 0;
}
- return 0;
}
unsigned int GetAlphaSize(D3DFORMAT colorFormat)
@@ -718,9 +718,9 @@
case D3DFMT_X8R8G8B8:
case D3DFMT_R5G6B5:
return 0;
- default: UNREACHABLE();
+ default:
+ return 0;
}
- return 0;
}
unsigned int GetRedSize(D3DFORMAT colorFormat)
@@ -739,9 +739,9 @@
case D3DFMT_A1R5G5B5:
case D3DFMT_R5G6B5:
return 5;
- default: UNREACHABLE();
+ default:
+ return 0;
}
- return 0;
}
unsigned int GetGreenSize(D3DFORMAT colorFormat)
@@ -761,9 +761,9 @@
return 5;
case D3DFMT_R5G6B5:
return 6;
- default: UNREACHABLE();
+ default:
+ return 0;
}
- return 0;
}
unsigned int GetBlueSize(D3DFORMAT colorFormat)
@@ -782,9 +782,9 @@
case D3DFMT_A1R5G5B5:
case D3DFMT_R5G6B5:
return 5;
- default: UNREACHABLE();
+ default:
+ return 0;
}
- return 0;
}
unsigned int GetDepthSize(D3DFORMAT depthFormat)
@@ -802,10 +802,8 @@
case D3DFMT_D24FS8: return 24;
//case D3DFMT_D32_LOCKABLE: return 32; // D3D9Ex only
//case D3DFMT_S8_LOCKABLE: return 0; // D3D9Ex only
- default:
- UNREACHABLE();
+ default: return 0;
}
- return 0;
}
GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type)