Commit f618c9e5 by Jamie Madill Committed by Commit Bot

Vulkan: Add depth/stencil surfaces.

This change lets us create egl::Surfaces from a D24S8 config. This is a bit hacky, because the spec only mandates 24 -or- 32 bit depth support, but not both or either individually. Will need follow-up work for proper EGL config setup. A single depth buffer is allocated for the entire set of swapchain images and is used with each. This also might be a problem if we're rendering to multiple frames at the same time. We'll likely have to revisit this in the future as well. This adds a new RenderTargetVk to the SurfaceVk class which points to the Depth/Stencil image. Since ImageViews must refer to either the depth or stencil, but not both, we'll need to address this when we get to implementing depth/stencil texture reads in shaders. Bug: angleproject:2357 Change-Id: Ibed0eed7e1d0efb272758dbfc79fa2c5aa93997f Reviewed-on: https://chromium-review.googlesource.com/919761Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent b92f92a7
...@@ -40,19 +40,8 @@ SampleApplication::SampleApplication(const std::string &name, ...@@ -40,19 +40,8 @@ SampleApplication::SampleApplication(const std::string &name,
mEGLWindow->setConfigGreenBits(8); mEGLWindow->setConfigGreenBits(8);
mEGLWindow->setConfigBlueBits(8); mEGLWindow->setConfigBlueBits(8);
mEGLWindow->setConfigAlphaBits(8); mEGLWindow->setConfigAlphaBits(8);
mEGLWindow->setConfigDepthBits(24);
// The Vulkan back-end currently does not support depth/stencil. mEGLWindow->setConfigStencilBits(8);
// TODO(jmadill): Remove this hack once Vulkan supports more configs.
if (requestedRenderer == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
{
mEGLWindow->setConfigDepthBits(0);
mEGLWindow->setConfigStencilBits(0);
}
else
{
mEGLWindow->setConfigDepthBits(24);
mEGLWindow->setConfigStencilBits(8);
}
// Disable vsync // Disable vsync
mEGLWindow->setSwapInterval(0); mEGLWindow->setSwapInterval(0);
......
...@@ -116,7 +116,8 @@ class WindowSurfaceVk : public SurfaceImpl, public ResourceVk ...@@ -116,7 +116,8 @@ class WindowSurfaceVk : public SurfaceImpl, public ResourceVk
VkSwapchainKHR mSwapchain; VkSwapchainKHR mSwapchain;
RenderTargetVk mRenderTarget; RenderTargetVk mColorRenderTarget;
RenderTargetVk mDepthStencilRenderTarget;
uint32_t mCurrentSwapchainImageIndex; uint32_t mCurrentSwapchainImageIndex;
...@@ -141,6 +142,10 @@ class WindowSurfaceVk : public SurfaceImpl, public ResourceVk ...@@ -141,6 +142,10 @@ class WindowSurfaceVk : public SurfaceImpl, public ResourceVk
}; };
std::vector<SwapchainImage> mSwapchainImages; std::vector<SwapchainImage> mSwapchainImages;
vk::Image mDepthStencilImage;
vk::DeviceMemory mDepthStencilDeviceMemory;
vk::ImageView mDepthStencilImageView;
}; };
} // namespace rx } // namespace rx
......
...@@ -37,45 +37,52 @@ SurfaceImpl *DisplayVkAndroid::createWindowSurfaceVk(const egl::SurfaceState &st ...@@ -37,45 +37,52 @@ SurfaceImpl *DisplayVkAndroid::createWindowSurfaceVk(const egl::SurfaceState &st
egl::ConfigSet DisplayVkAndroid::generateConfigs() egl::ConfigSet DisplayVkAndroid::generateConfigs()
{ {
// TODO(jmadill): Multiple configs, pbuffers, and proper checking of config attribs. // TODO(jmadill): Multiple configs, pbuffers, and proper checking of config attribs.
egl::Config singleton; egl::Config rgba;
singleton.renderTargetFormat = GL_RGBA8; rgba.renderTargetFormat = GL_RGBA8;
singleton.depthStencilFormat = GL_NONE; rgba.depthStencilFormat = GL_NONE;
singleton.bufferSize = 32; rgba.bufferSize = 32;
singleton.redSize = 8; rgba.redSize = 8;
singleton.greenSize = 8; rgba.greenSize = 8;
singleton.blueSize = 8; rgba.blueSize = 8;
singleton.alphaSize = 8; rgba.alphaSize = 8;
singleton.alphaMaskSize = 0; rgba.alphaMaskSize = 0;
singleton.bindToTextureRGB = EGL_FALSE; rgba.bindToTextureRGB = EGL_FALSE;
singleton.bindToTextureRGBA = EGL_FALSE; rgba.bindToTextureRGBA = EGL_FALSE;
singleton.colorBufferType = EGL_RGB_BUFFER; rgba.colorBufferType = EGL_RGB_BUFFER;
singleton.configCaveat = EGL_NONE; rgba.configCaveat = EGL_NONE;
singleton.conformant = 0; rgba.conformant = 0;
singleton.depthSize = 0; rgba.depthSize = 0;
singleton.stencilSize = 0; rgba.stencilSize = 0;
singleton.level = 0; rgba.level = 0;
singleton.matchNativePixmap = EGL_NONE; rgba.matchNativePixmap = EGL_NONE;
singleton.maxPBufferWidth = 0; rgba.maxPBufferWidth = 0;
singleton.maxPBufferHeight = 0; rgba.maxPBufferHeight = 0;
singleton.maxPBufferPixels = 0; rgba.maxPBufferPixels = 0;
singleton.maxSwapInterval = 1; rgba.maxSwapInterval = 1;
singleton.minSwapInterval = 1; rgba.minSwapInterval = 1;
singleton.nativeRenderable = EGL_TRUE; rgba.nativeRenderable = EGL_TRUE;
singleton.nativeVisualID = 0; rgba.nativeVisualID = 0;
singleton.nativeVisualType = EGL_NONE; rgba.nativeVisualType = EGL_NONE;
singleton.renderableType = EGL_OPENGL_ES2_BIT; rgba.renderableType = EGL_OPENGL_ES2_BIT;
singleton.sampleBuffers = 0; rgba.sampleBuffers = 0;
singleton.samples = 0; rgba.samples = 0;
singleton.surfaceType = EGL_WINDOW_BIT; rgba.surfaceType = EGL_WINDOW_BIT;
singleton.optimalOrientation = 0; rgba.optimalOrientation = 0;
singleton.transparentType = EGL_NONE; rgba.transparentType = EGL_NONE;
singleton.transparentRedValue = 0; rgba.transparentRedValue = 0;
singleton.transparentGreenValue = 0; rgba.transparentGreenValue = 0;
singleton.transparentBlueValue = 0; rgba.transparentBlueValue = 0;
singleton.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT; rgba.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
egl::Config rgbaD24S8;
rgbaD24S8 = rgba;
rgbaD24S8.depthStencilFormat = GL_DEPTH24_STENCIL8;
rgbaD24S8.depthSize = 24;
rgbaD24S8.stencilSize = 8;
egl::ConfigSet configSet; egl::ConfigSet configSet;
configSet.add(singleton); configSet.add(rgba);
configSet.add(rgbaD24S8);
return configSet; return configSet;
} }
......
...@@ -211,7 +211,7 @@ void RenderPassDesc::packColorAttachment(const vk::Format &format, GLsizei sampl ...@@ -211,7 +211,7 @@ void RenderPassDesc::packColorAttachment(const vk::Format &format, GLsizei sampl
void RenderPassDesc::packDepthStencilAttachment(const vk::Format &format, GLsizei samples) void RenderPassDesc::packDepthStencilAttachment(const vk::Format &format, GLsizei samples)
{ {
ASSERT(mDepthStencilAttachmentCount == 0); ASSERT(mDepthStencilAttachmentCount == 0);
packAttachment(mDepthStencilAttachmentCount++, format, samples); packAttachment(mColorAttachmentCount + mDepthStencilAttachmentCount++, format, samples);
} }
RenderPassDesc &RenderPassDesc::operator=(const RenderPassDesc &other) RenderPassDesc &RenderPassDesc::operator=(const RenderPassDesc &other)
......
...@@ -472,6 +472,34 @@ void CommandBuffer::clearSingleColorImage(const vk::Image &image, const VkClearC ...@@ -472,6 +472,34 @@ void CommandBuffer::clearSingleColorImage(const vk::Image &image, const VkClearC
vkCmdClearColorImage(mHandle, image.getHandle(), image.getCurrentLayout(), &color, 1, &range); vkCmdClearColorImage(mHandle, image.getHandle(), image.getCurrentLayout(), &color, 1, &range);
} }
void CommandBuffer::clearSingleDepthStencilImage(const vk::Image &image,
VkImageAspectFlags aspectFlags,
const VkClearDepthStencilValue &depthStencil)
{
VkImageSubresourceRange clearRange = {
/*aspectMask*/ aspectFlags,
/*baseMipLevel*/ 0,
/*levelCount*/ 1,
/*baseArrayLayer*/ 0,
/*layerCount*/ 1,
};
clearDepthStencilImage(image, depthStencil, 1, &clearRange);
}
void CommandBuffer::clearDepthStencilImage(const vk::Image &image,
const VkClearDepthStencilValue &depthStencil,
uint32_t rangeCount,
const VkImageSubresourceRange *ranges)
{
ASSERT(valid());
ASSERT(image.getCurrentLayout() == VK_IMAGE_LAYOUT_GENERAL ||
image.getCurrentLayout() == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
vkCmdClearDepthStencilImage(mHandle, image.getHandle(), image.getCurrentLayout(), &depthStencil,
rangeCount, ranges);
}
void CommandBuffer::copySingleImage(const vk::Image &srcImage, void CommandBuffer::copySingleImage(const vk::Image &srcImage,
const vk::Image &destImage, const vk::Image &destImage,
const gl::Box &copyRegion, const gl::Box &copyRegion,
...@@ -1414,7 +1442,7 @@ void ResourceVk::onWriteResource(vk::CommandBufferNode *writeOperation, Serial s ...@@ -1414,7 +1442,7 @@ void ResourceVk::onWriteResource(vk::CommandBufferNode *writeOperation, Serial s
mCurrentReadOperations.clear(); mCurrentReadOperations.clear();
} }
if (mCurrentWriteOperation) if (mCurrentWriteOperation && mCurrentWriteOperation != writeOperation)
{ {
vk::CommandBufferNode::SetHappensBeforeDependency(mCurrentWriteOperation, writeOperation); vk::CommandBufferNode::SetHappensBeforeDependency(mCurrentWriteOperation, writeOperation);
} }
......
...@@ -331,6 +331,14 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer> ...@@ -331,6 +331,14 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer>
const VkBufferMemoryBarrier &bufferBarrier); const VkBufferMemoryBarrier &bufferBarrier);
void clearSingleColorImage(const vk::Image &image, const VkClearColorValue &color); void clearSingleColorImage(const vk::Image &image, const VkClearColorValue &color);
void clearSingleDepthStencilImage(const vk::Image &image,
VkImageAspectFlags aspectFlags,
const VkClearDepthStencilValue &depthStencil);
void clearDepthStencilImage(const vk::Image &image,
const VkClearDepthStencilValue &depthStencil,
uint32_t rangeCount,
const VkImageSubresourceRange *ranges);
void copyBuffer(const vk::Buffer &srcBuffer, void copyBuffer(const vk::Buffer &srcBuffer,
const vk::Buffer &destBuffer, const vk::Buffer &destBuffer,
......
...@@ -36,45 +36,52 @@ SurfaceImpl *DisplayVkWin32::createWindowSurfaceVk(const egl::SurfaceState &stat ...@@ -36,45 +36,52 @@ SurfaceImpl *DisplayVkWin32::createWindowSurfaceVk(const egl::SurfaceState &stat
egl::ConfigSet DisplayVkWin32::generateConfigs() egl::ConfigSet DisplayVkWin32::generateConfigs()
{ {
// TODO(jmadill): Multiple configs, pbuffers, and proper checking of config attribs. // TODO(jmadill): Multiple configs, pbuffers, and proper checking of config attribs.
egl::Config singleton; egl::Config bgra;
singleton.renderTargetFormat = GL_BGRA8_EXT; bgra.renderTargetFormat = GL_BGRA8_EXT;
singleton.depthStencilFormat = GL_NONE; bgra.depthStencilFormat = GL_NONE;
singleton.bufferSize = 32; bgra.bufferSize = 32;
singleton.redSize = 8; bgra.redSize = 8;
singleton.greenSize = 8; bgra.greenSize = 8;
singleton.blueSize = 8; bgra.blueSize = 8;
singleton.alphaSize = 8; bgra.alphaSize = 8;
singleton.alphaMaskSize = 0; bgra.alphaMaskSize = 0;
singleton.bindToTextureRGB = EGL_FALSE; bgra.bindToTextureRGB = EGL_FALSE;
singleton.bindToTextureRGBA = EGL_FALSE; bgra.bindToTextureRGBA = EGL_FALSE;
singleton.colorBufferType = EGL_RGB_BUFFER; bgra.colorBufferType = EGL_RGB_BUFFER;
singleton.configCaveat = EGL_NONE; bgra.configCaveat = EGL_NONE;
singleton.conformant = 0; bgra.conformant = 0;
singleton.depthSize = 0; bgra.depthSize = 0;
singleton.stencilSize = 0; bgra.stencilSize = 0;
singleton.level = 0; bgra.level = 0;
singleton.matchNativePixmap = EGL_NONE; bgra.matchNativePixmap = EGL_NONE;
singleton.maxPBufferWidth = 0; bgra.maxPBufferWidth = 0;
singleton.maxPBufferHeight = 0; bgra.maxPBufferHeight = 0;
singleton.maxPBufferPixels = 0; bgra.maxPBufferPixels = 0;
singleton.maxSwapInterval = 1; bgra.maxSwapInterval = 1;
singleton.minSwapInterval = 1; bgra.minSwapInterval = 1;
singleton.nativeRenderable = EGL_TRUE; bgra.nativeRenderable = EGL_TRUE;
singleton.nativeVisualID = 0; bgra.nativeVisualID = 0;
singleton.nativeVisualType = EGL_NONE; bgra.nativeVisualType = EGL_NONE;
singleton.renderableType = EGL_OPENGL_ES2_BIT; bgra.renderableType = EGL_OPENGL_ES2_BIT;
singleton.sampleBuffers = 0; bgra.sampleBuffers = 0;
singleton.samples = 0; bgra.samples = 0;
singleton.surfaceType = EGL_WINDOW_BIT; bgra.surfaceType = EGL_WINDOW_BIT;
singleton.optimalOrientation = 0; bgra.optimalOrientation = 0;
singleton.transparentType = EGL_NONE; bgra.transparentType = EGL_NONE;
singleton.transparentRedValue = 0; bgra.transparentRedValue = 0;
singleton.transparentGreenValue = 0; bgra.transparentGreenValue = 0;
singleton.transparentBlueValue = 0; bgra.transparentBlueValue = 0;
singleton.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT; bgra.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
egl::Config bgraD24S8;
bgraD24S8 = bgra;
bgraD24S8.depthStencilFormat = GL_DEPTH24_STENCIL8;
bgraD24S8.depthSize = 24;
bgraD24S8.stencilSize = 8;
egl::ConfigSet configSet; egl::ConfigSet configSet;
configSet.add(singleton); configSet.add(bgra);
configSet.add(bgraD24S8);
return configSet; return configSet;
} }
......
...@@ -64,45 +64,52 @@ SurfaceImpl *DisplayVkXcb::createWindowSurfaceVk(const egl::SurfaceState &state, ...@@ -64,45 +64,52 @@ SurfaceImpl *DisplayVkXcb::createWindowSurfaceVk(const egl::SurfaceState &state,
egl::ConfigSet DisplayVkXcb::generateConfigs() egl::ConfigSet DisplayVkXcb::generateConfigs()
{ {
// TODO(jmadill): Multiple configs, pbuffers, and proper checking of config attribs. // TODO(jmadill): Multiple configs, pbuffers, and proper checking of config attribs.
egl::Config singleton; egl::Config bgra;
singleton.renderTargetFormat = GL_BGRA8_EXT; bgra.renderTargetFormat = GL_BGRA8_EXT;
singleton.depthStencilFormat = GL_NONE; bgra.depthStencilFormat = GL_NONE;
singleton.bufferSize = 32; bgra.bufferSize = 32;
singleton.redSize = 8; bgra.redSize = 8;
singleton.greenSize = 8; bgra.greenSize = 8;
singleton.blueSize = 8; bgra.blueSize = 8;
singleton.alphaSize = 8; bgra.alphaSize = 8;
singleton.alphaMaskSize = 0; bgra.alphaMaskSize = 0;
singleton.bindToTextureRGB = EGL_FALSE; bgra.bindToTextureRGB = EGL_FALSE;
singleton.bindToTextureRGBA = EGL_FALSE; bgra.bindToTextureRGBA = EGL_FALSE;
singleton.colorBufferType = EGL_RGB_BUFFER; bgra.colorBufferType = EGL_RGB_BUFFER;
singleton.configCaveat = EGL_NONE; bgra.configCaveat = EGL_NONE;
singleton.conformant = 0; bgra.conformant = 0;
singleton.depthSize = 0; bgra.depthSize = 0;
singleton.stencilSize = 0; bgra.stencilSize = 0;
singleton.level = 0; bgra.level = 0;
singleton.matchNativePixmap = EGL_NONE; bgra.matchNativePixmap = EGL_NONE;
singleton.maxPBufferWidth = 0; bgra.maxPBufferWidth = 0;
singleton.maxPBufferHeight = 0; bgra.maxPBufferHeight = 0;
singleton.maxPBufferPixels = 0; bgra.maxPBufferPixels = 0;
singleton.maxSwapInterval = 1; bgra.maxSwapInterval = 1;
singleton.minSwapInterval = 1; bgra.minSwapInterval = 1;
singleton.nativeRenderable = EGL_TRUE; bgra.nativeRenderable = EGL_TRUE;
singleton.nativeVisualID = 0; bgra.nativeVisualID = 0;
singleton.nativeVisualType = EGL_NONE; bgra.nativeVisualType = EGL_NONE;
singleton.renderableType = EGL_OPENGL_ES2_BIT; bgra.renderableType = EGL_OPENGL_ES2_BIT;
singleton.sampleBuffers = 0; bgra.sampleBuffers = 0;
singleton.samples = 0; bgra.samples = 0;
singleton.surfaceType = EGL_WINDOW_BIT; bgra.surfaceType = EGL_WINDOW_BIT;
singleton.optimalOrientation = 0; bgra.optimalOrientation = 0;
singleton.transparentType = EGL_NONE; bgra.transparentType = EGL_NONE;
singleton.transparentRedValue = 0; bgra.transparentRedValue = 0;
singleton.transparentGreenValue = 0; bgra.transparentGreenValue = 0;
singleton.transparentBlueValue = 0; bgra.transparentBlueValue = 0;
singleton.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT; bgra.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
egl::Config bgraD24S8;
bgraD24S8 = bgra;
bgraD24S8.depthStencilFormat = GL_DEPTH24_STENCIL8;
bgraD24S8.depthSize = 24;
bgraD24S8.stencilSize = 8;
egl::ConfigSet configSet; egl::ConfigSet configSet;
configSet.add(singleton); configSet.add(bgra);
configSet.add(bgraD24S8);
return configSet; return configSet;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include "random_utils.h" #include "random_utils.h"
#include "test_utils/gl_raii.h"
using namespace angle; using namespace angle;
...@@ -117,8 +118,7 @@ TEST_P(ClearTest, RGBA8Framebuffer) ...@@ -117,8 +118,7 @@ TEST_P(ClearTest, RGBA8Framebuffer)
{ {
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLuint texture; GLTexture texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture); glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA,
...@@ -133,6 +133,9 @@ TEST_P(ClearTest, RGBA8Framebuffer) ...@@ -133,6 +133,9 @@ TEST_P(ClearTest, RGBA8Framebuffer)
TEST_P(ClearTest, ClearIssue) TEST_P(ClearTest, ClearIssue)
{ {
// TODO(jmadill): Depth/Stencil clears on Vulkan. http://anglebug.com/2357
ANGLE_SKIP_TEST_IF(IsVulkan());
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
...@@ -144,8 +147,7 @@ TEST_P(ClearTest, ClearIssue) ...@@ -144,8 +147,7 @@ TEST_P(ClearTest, ClearIssue)
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLuint rbo; GLRenderbuffer rbo;
glGenRenderbuffers(1, &rbo);
glBindRenderbuffer(GL_RENDERBUFFER, rbo); glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB565, 16, 16); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB565, 16, 16);
...@@ -179,8 +181,7 @@ TEST_P(ClearTestES3, MaskedClearBufferBug) ...@@ -179,8 +181,7 @@ TEST_P(ClearTestES3, MaskedClearBufferBug)
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLuint textures[2]; GLTexture textures[2];
glGenTextures(2, &textures[0]);
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
...@@ -206,8 +207,6 @@ TEST_P(ClearTestES3, MaskedClearBufferBug) ...@@ -206,8 +207,6 @@ TEST_P(ClearTestES3, MaskedClearBufferBug)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_NEAR(0, 0, 0, 127, 255, 255, 1); EXPECT_PIXEL_NEAR(0, 0, 0, 127, 255, 255, 1);
glDeleteTextures(2, textures);
} }
TEST_P(ClearTestES3, BadFBOSerialBug) TEST_P(ClearTestES3, BadFBOSerialBug)
...@@ -215,8 +214,7 @@ TEST_P(ClearTestES3, BadFBOSerialBug) ...@@ -215,8 +214,7 @@ TEST_P(ClearTestES3, BadFBOSerialBug)
// First make a simple framebuffer, and clear it to green // First make a simple framebuffer, and clear it to green
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLuint textures[2]; GLTexture textures[2];
glGenTextures(2, &textures[0]);
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, getWindowWidth(), getWindowHeight()); glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, getWindowWidth(), getWindowHeight());
...@@ -233,11 +231,9 @@ TEST_P(ClearTestES3, BadFBOSerialBug) ...@@ -233,11 +231,9 @@ TEST_P(ClearTestES3, BadFBOSerialBug)
// Next make a second framebuffer, and draw it to red // Next make a second framebuffer, and draw it to red
// (Triggers bad applied render target serial) // (Triggers bad applied render target serial)
GLuint fbo2; GLFramebuffer fbo2;
glGenFramebuffers(1, &fbo2);
ASSERT_GL_NO_ERROR();
glBindFramebuffer(GL_FRAMEBUFFER, fbo2); glBindFramebuffer(GL_FRAMEBUFFER, fbo2);
ASSERT_GL_NO_ERROR();
glBindTexture(GL_TEXTURE_2D, textures[1]); glBindTexture(GL_TEXTURE_2D, textures[1]);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, getWindowWidth(), getWindowHeight()); glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, getWindowWidth(), getWindowHeight());
...@@ -254,9 +250,6 @@ TEST_P(ClearTestES3, BadFBOSerialBug) ...@@ -254,9 +250,6 @@ TEST_P(ClearTestES3, BadFBOSerialBug)
// Check that the first framebuffer is still green. // Check that the first framebuffer is still green.
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
EXPECT_PIXEL_EQ(0, 0, 0, 255, 0, 255); EXPECT_PIXEL_EQ(0, 0, 0, 255, 0, 255);
glDeleteTextures(2, textures);
glDeleteFramebuffers(1, &fbo2);
} }
// Test that SRGB framebuffers clear to the linearized clear color // Test that SRGB framebuffers clear to the linearized clear color
...@@ -265,8 +258,7 @@ TEST_P(ClearTestES3, SRGBClear) ...@@ -265,8 +258,7 @@ TEST_P(ClearTestES3, SRGBClear)
// First make a simple framebuffer, and clear it // First make a simple framebuffer, and clear it
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLuint texture; GLTexture texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture); glBindTexture(GL_TEXTURE_2D, texture);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_SRGB8_ALPHA8, getWindowWidth(), getWindowHeight()); glTexStorage2D(GL_TEXTURE_2D, 1, GL_SRGB8_ALPHA8, getWindowWidth(), getWindowHeight());
...@@ -284,8 +276,7 @@ TEST_P(ClearTestES3, MixedSRGBClear) ...@@ -284,8 +276,7 @@ TEST_P(ClearTestES3, MixedSRGBClear)
{ {
glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]); glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
GLuint textures[2]; GLTexture textures[2];
glGenTextures(2, &textures[0]);
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_SRGB8_ALPHA8, getWindowWidth(), getWindowHeight()); glTexStorage2D(GL_TEXTURE_2D, 1, GL_SRGB8_ALPHA8, getWindowWidth(), getWindowHeight());
...@@ -481,7 +472,8 @@ ANGLE_INSTANTIATE_TEST(ClearTest, ...@@ -481,7 +472,8 @@ ANGLE_INSTANTIATE_TEST(ClearTest,
ES2_OPENGL(), ES2_OPENGL(),
ES3_OPENGL(), ES3_OPENGL(),
ES2_OPENGLES(), ES2_OPENGLES(),
ES3_OPENGLES()); ES3_OPENGLES(),
ES2_VULKAN());
ANGLE_INSTANTIATE_TEST(ClearTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES()); ANGLE_INSTANTIATE_TEST(ClearTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(ScissoredClearTest, ES2_D3D11(), ES2_OPENGL(), ES2_VULKAN()); ANGLE_INSTANTIATE_TEST(ScissoredClearTest, ES2_D3D11(), ES2_OPENGL(), ES2_VULKAN());
......
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