Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp |
index 76d1b49a8f60821dede75ab000d8288ecc58c148..2ced4a116c3135b980e5f9feba4534a58380408d 100644 |
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp |
@@ -567,19 +567,45 @@ TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) |
testing::Mock::VerifyAndClearExpectations(webContext()); |
} |
+class DepthStencilTrackingGLES2Interface : public gpu::gles2::GLES2InterfaceStub { |
+public: |
+ void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override |
+ { |
+ switch (attachment) { |
+ case GL_DEPTH_ATTACHMENT: |
+ m_depthAttachment = renderbuffer; |
+ break; |
+ case GL_STENCIL_ATTACHMENT: |
+ m_stencilAttachment = renderbuffer; |
+ break; |
+ case GL_DEPTH_STENCIL_ATTACHMENT: |
+ m_depthStencilAttachment = renderbuffer; |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ break; |
+ } |
+ } |
+ |
+ uint32_t stencilAttachment() const { return m_stencilAttachment; } |
+ uint32_t depthAttachment() const { return m_depthAttachment; } |
+ uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; } |
+ |
+private: |
+ uint32_t m_depthAttachment = 0; |
+ uint32_t m_stencilAttachment = 0; |
+ uint32_t m_depthStencilAttachment = 0; |
+}; |
+ |
class DepthStencilTrackingContext : public MockWebGraphicsContext3D { |
public: |
- DepthStencilTrackingContext() |
- : m_nextRenderBufferId(1) |
- , m_stencilAttachment(0) |
- , m_depthAttachment(0) |
- , m_depthStencilAttachment(0) {} |
+ DepthStencilTrackingContext() : m_nextRenderBufferId(1) {} |
~DepthStencilTrackingContext() override {} |
int numAllocatedRenderBuffer() const { return m_nextRenderBufferId - 1; } |
- WebGLId stencilAttachment() const { return m_stencilAttachment; } |
- WebGLId depthAttachment() const { return m_depthAttachment; } |
- WebGLId depthStencilAttachment() const { return m_depthStencilAttachment; } |
+ WebGLId stencilAttachment() const { return m_contextGL.stencilAttachment(); } |
+ WebGLId depthAttachment() const { return m_contextGL.depthAttachment(); } |
+ WebGLId depthStencilAttachment() const { return m_contextGL.depthStencilAttachment(); } |
WebString getString(WGC3Denum type) override |
{ |
@@ -594,32 +620,14 @@ public: |
return ++m_nextRenderBufferId; |
} |
- void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) override |
- { |
- switch (attachment) { |
- case GL_DEPTH_ATTACHMENT: |
- m_depthAttachment = renderbuffer; |
- break; |
- case GL_STENCIL_ATTACHMENT: |
- m_stencilAttachment = renderbuffer; |
- break; |
- case GL_DEPTH_STENCIL_ATTACHMENT: |
- m_depthStencilAttachment = renderbuffer; |
- break; |
- default: |
- ASSERT_NOT_REACHED(); |
- break; |
- } |
- } |
- |
void getIntegerv(WGC3Denum ptype, WGC3Dint* value) override |
{ |
switch (ptype) { |
case GL_DEPTH_BITS: |
- *value = (m_depthAttachment || m_depthStencilAttachment) ? 24 : 0; |
+ *value = (depthAttachment() || depthStencilAttachment()) ? 24 : 0; |
return; |
case GL_STENCIL_BITS: |
- *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0; |
+ *value = (stencilAttachment() || depthStencilAttachment()) ? 8 : 0; |
return; |
} |
MockWebGraphicsContext3D::getIntegerv(ptype, value); |
@@ -629,10 +637,7 @@ public: |
private: |
WebGLId m_nextRenderBufferId; |
- WebGLId m_stencilAttachment; |
- WebGLId m_depthAttachment; |
- WebGLId m_depthStencilAttachment; |
- gpu::gles2::GLES2InterfaceStub m_contextGL; |
+ DepthStencilTrackingGLES2Interface m_contextGL; |
}; |
struct DepthStencilTestCase { |