Apply Chromium style fixes.
This addresses several minor code quality issues that are validated
in Chromium, but not yet applied to ANGLE:
* constructors and destructors must be defined out-of-line
* auto is not allowed for simple pointer types
* use override everywhere instead of virtual
* virtual functions must also be defined out-of-line
Slightly reduces binary size for me (~2k on Win, 150k on Linux).
Bug: angleproject:1569
Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6
Reviewed-on: https://chromium-review.googlesource.com/779959
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/BufferVk.cpp b/src/libANGLE/renderer/vulkan/BufferVk.cpp
index fb828c8..4b35e0f 100644
--- a/src/libANGLE/renderer/vulkan/BufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/BufferVk.cpp
@@ -47,7 +47,7 @@
gl::BufferUsage usage)
{
ContextVk *contextVk = vk::GetImpl(context);
- auto device = contextVk->getDevice();
+ VkDevice device = contextVk->getDevice();
if (size > mCurrentRequiredSize)
{
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index 6972e6f..0ba2082 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -255,9 +255,9 @@
VkDevice device = mRenderer->getDevice();
const auto &state = mState.getState();
- const auto &programGL = state.getProgram();
- const auto &vao = state.getVertexArray();
- const auto *drawFBO = state.getDrawFramebuffer();
+ const gl::Program *programGL = state.getProgram();
+ const gl::VertexArray *vao = state.getVertexArray();
+ const gl::Framebuffer *drawFBO = state.getDrawFramebuffer();
ProgramVk *programVk = vk::GetImpl(programGL);
FramebufferVk *vkFBO = vk::GetImpl(drawFBO);
VertexArrayVk *vkVAO = vk::GetImpl(vao);
@@ -308,9 +308,9 @@
}
const auto &state = mState.getState();
- const auto &programGL = state.getProgram();
+ const gl::Program *programGL = state.getProgram();
ProgramVk *programVk = vk::GetImpl(programGL);
- const auto &vao = state.getVertexArray();
+ const gl::VertexArray *vao = state.getVertexArray();
VertexArrayVk *vkVAO = vk::GetImpl(vao);
const auto *drawFBO = state.getDrawFramebuffer();
FramebufferVk *vkFBO = vk::GetImpl(drawFBO);
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index 01d11a3..c102ae9 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -134,6 +134,10 @@
{
}
+ProgramVk::DefaultUniformBlock::~DefaultUniformBlock()
+{
+}
+
ProgramVk::ProgramVk(const gl::ProgramState &state)
: ProgramImpl(state), mDefaultUniformBlocks(), mDescriptorSetOffset(0), mDirtyTextures(true)
{
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.h b/src/libANGLE/renderer/vulkan/ProgramVk.h
index aa382dd..4da6d38 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.h
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.h
@@ -135,6 +135,7 @@
struct DefaultUniformBlock final : private angle::NonCopyable
{
DefaultUniformBlock();
+ ~DefaultUniformBlock();
vk::BufferAndMemory storage;
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 7289f0d..f98f242 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -41,7 +41,7 @@
extensionNames.insert(extensionProp.extensionName);
}
- for (const auto &extensionName : enabledExtensionNames)
+ for (const char *extensionName : enabledExtensionNames)
{
if (extensionNames.count(extensionName) == 0)
{
diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
index 76b5290..ed2ed95 100644
--- a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
+++ b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
@@ -157,6 +157,10 @@
return gl::NoError();
}
+WindowSurfaceVk::SwapchainImage::SwapchainImage() = default;
+WindowSurfaceVk::SwapchainImage::SwapchainImage(WindowSurfaceVk::SwapchainImage &&other) = default;
+WindowSurfaceVk::SwapchainImage::~SwapchainImage() = default;
+
WindowSurfaceVk::WindowSurfaceVk(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
@@ -230,7 +234,7 @@
uint32_t presentQueue = 0;
ANGLE_TRY_RESULT(renderer->selectPresentQueueForSurface(mSurface), presentQueue);
- const auto &physicalDevice = renderer->getPhysicalDevice();
+ const VkPhysicalDevice &physicalDevice = renderer->getPhysicalDevice();
VkSurfaceCapabilitiesKHR surfaceCaps;
ANGLE_VK_TRY(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, mSurface, &surfaceCaps));
diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.h b/src/libANGLE/renderer/vulkan/SurfaceVk.h
index 0388f0d..531f5ea 100644
--- a/src/libANGLE/renderer/vulkan/SurfaceVk.h
+++ b/src/libANGLE/renderer/vulkan/SurfaceVk.h
@@ -129,6 +129,10 @@
struct SwapchainImage
{
+ SwapchainImage();
+ SwapchainImage(SwapchainImage &&other);
+ ~SwapchainImage();
+
vk::Image image;
vk::ImageView imageView;
vk::Framebuffer framebuffer;
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
index 02c24ad..eab9749 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
@@ -29,6 +29,10 @@
mCurrentVertexAttribDescs.reserve(state.getMaxAttribs());
}
+VertexArrayVk::~VertexArrayVk()
+{
+}
+
void VertexArrayVk::destroy(const gl::Context *context)
{
}
@@ -40,7 +44,7 @@
// Invalidate current pipeline.
// TODO(jmadill): Use pipeline cache.
- auto contextVk = vk::GetImpl(context);
+ ContextVk *contextVk = vk::GetImpl(context);
contextVk->invalidateCurrentPipeline();
// Invalidate the vertex descriptions.
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.h b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
index b103d06..1c70abe 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.h
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
@@ -21,6 +21,8 @@
{
public:
VertexArrayVk(const gl::VertexArrayState &state);
+ ~VertexArrayVk() override;
+
void destroy(const gl::Context *context) override;
void syncState(const gl::Context *context,