Commit 5883a44b by Jamie Madill Committed by Commit Bot

Vulkan: Don't pass width/height to Surface constructors.

These values are accessible already from the Surface state. Sometimes they don't apply (e.g. GGP). Remove them to keep the code clearer. Updates the offscreen surface constructor to pull width and height from the attributes map instead of using parameters. Otherwise they weren't used. Refactoring change only. Bug: angleproject:4078 Change-Id: I9e49eadc7116562f62bd8d11342d6b8835376719 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1895762Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 2f6a9afd
......@@ -98,21 +98,14 @@ SurfaceImpl *DisplayVk::createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs)
{
EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
return createWindowSurfaceVk(state, window, width, height);
return createWindowSurfaceVk(state, window);
}
SurfaceImpl *DisplayVk::createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs)
{
ASSERT(mRenderer);
EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
return new OffscreenSurfaceVk(state, width, height);
return new OffscreenSurfaceVk(state);
}
SurfaceImpl *DisplayVk::createPbufferFromClientBuffer(const egl::SurfaceState &state,
......
......@@ -97,9 +97,7 @@ class DisplayVk : public DisplayImpl, public vk::Context
private:
virtual SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height) = 0;
EGLNativeWindowType window) = 0;
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
void generateCaps(egl::Caps *outCaps) const override;
......
......@@ -167,10 +167,10 @@ void OffscreenSurfaceVk::AttachmentImage::destroy(const egl::Display *display)
imageViews.destroy(device);
}
OffscreenSurfaceVk::OffscreenSurfaceVk(const egl::SurfaceState &surfaceState,
EGLint width,
EGLint height)
: SurfaceVk(surfaceState), mWidth(width), mHeight(height)
OffscreenSurfaceVk::OffscreenSurfaceVk(const egl::SurfaceState &surfaceState)
: SurfaceVk(surfaceState),
mWidth(mState.attributes.getAsInt(EGL_WIDTH, 0)),
mHeight(mState.attributes.getAsInt(EGL_HEIGHT, 0))
{
mColorRenderTarget.init(&mColorAttachment.image, &mColorAttachment.imageViews, 0, 0);
mDepthStencilRenderTarget.init(&mDepthStencilAttachment.image,
......@@ -387,10 +387,7 @@ angle::Result SwapHistory::waitFence(ContextVk *contextVk)
using namespace impl;
WindowSurfaceVk::WindowSurfaceVk(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height)
WindowSurfaceVk::WindowSurfaceVk(const egl::SurfaceState &surfaceState, EGLNativeWindowType window)
: SurfaceVk(surfaceState),
mNativeWindowType(window),
mSurface(VK_NULL_HANDLE),
......
......@@ -40,7 +40,7 @@ class SurfaceVk : public SurfaceImpl
class OffscreenSurfaceVk : public SurfaceVk
{
public:
OffscreenSurfaceVk(const egl::SurfaceState &surfaceState, EGLint width, EGLint height);
OffscreenSurfaceVk(const egl::SurfaceState &surfaceState);
~OffscreenSurfaceVk() override;
egl::Error initialize(const egl::Display *display) override;
......@@ -175,10 +175,7 @@ struct SwapchainImage : angle::NonCopyable
class WindowSurfaceVk : public SurfaceVk
{
public:
WindowSurfaceVk(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height);
WindowSurfaceVk(const egl::SurfaceState &surfaceState, EGLNativeWindowType window);
~WindowSurfaceVk() override;
void destroy(const egl::Display *display) override;
......
......@@ -42,11 +42,9 @@ bool DisplayVkAndroid::isValidNativeWindow(EGLNativeWindowType window) const
}
SurfaceImpl *DisplayVkAndroid::createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height)
EGLNativeWindowType window)
{
return new WindowSurfaceVkAndroid(state, window, width, height);
return new WindowSurfaceVkAndroid(state, window);
}
egl::ConfigSet DisplayVkAndroid::generateConfigs()
......
......@@ -24,9 +24,7 @@ class DisplayVkAndroid : public DisplayVk
bool isValidNativeWindow(EGLNativeWindowType window) const override;
SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height) override;
EGLNativeWindowType window) override;
egl::ConfigSet generateConfigs() override;
bool checkConfigSupport(egl::Config *config) override;
......
......@@ -17,10 +17,8 @@ namespace rx
{
WindowSurfaceVkAndroid::WindowSurfaceVkAndroid(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height)
: WindowSurfaceVk(surfaceState, window, width, height)
EGLNativeWindowType window)
: WindowSurfaceVk(surfaceState, window)
{}
angle::Result WindowSurfaceVkAndroid::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
......
......@@ -18,10 +18,7 @@ namespace rx
class WindowSurfaceVkAndroid : public WindowSurfaceVk
{
public:
WindowSurfaceVkAndroid(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height);
WindowSurfaceVkAndroid(const egl::SurfaceState &surfaceState, EGLNativeWindowType window);
private:
angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) override;
......
......@@ -23,12 +23,10 @@ bool DisplayVkFuchsia::isValidNativeWindow(EGLNativeWindowType window) const
}
SurfaceImpl *DisplayVkFuchsia::createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height)
EGLNativeWindowType window)
{
ASSERT(isValidNativeWindow(window));
return new WindowSurfaceVkFuchsia(state, window, width, height);
return new WindowSurfaceVkFuchsia(state, window);
}
egl::ConfigSet DisplayVkFuchsia::generateConfigs()
......
......@@ -23,9 +23,7 @@ class DisplayVkFuchsia : public DisplayVk
bool isValidNativeWindow(EGLNativeWindowType window) const override;
SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height) override;
EGLNativeWindowType window) override;
egl::ConfigSet generateConfigs() override;
bool checkConfigSupport(egl::Config *config) override;
......
......@@ -21,10 +21,8 @@ namespace rx
{
WindowSurfaceVkFuchsia::WindowSurfaceVkFuchsia(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height)
: WindowSurfaceVk(surfaceState, window, width, height)
EGLNativeWindowType window)
: WindowSurfaceVk(surfaceState, window)
{}
WindowSurfaceVkFuchsia::~WindowSurfaceVkFuchsia() {}
......
......@@ -18,10 +18,7 @@ namespace rx
class WindowSurfaceVkFuchsia : public WindowSurfaceVk
{
public:
WindowSurfaceVkFuchsia(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height);
WindowSurfaceVkFuchsia(const egl::SurfaceState &surfaceState, EGLNativeWindowType window);
~WindowSurfaceVkFuchsia() override;
static bool isValidNativeWindow(EGLNativeWindowType window);
......
......@@ -25,11 +25,9 @@ bool DisplayVkWin32::isValidNativeWindow(EGLNativeWindowType window) const
}
SurfaceImpl *DisplayVkWin32::createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height)
EGLNativeWindowType window)
{
return new WindowSurfaceVkWin32(state, window, width, height);
return new WindowSurfaceVkWin32(state, window);
}
egl::ConfigSet DisplayVkWin32::generateConfigs()
......
......@@ -22,9 +22,7 @@ class DisplayVkWin32 : public DisplayVk
bool isValidNativeWindow(EGLNativeWindowType window) const override;
SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height) override;
EGLNativeWindowType window) override;
egl::ConfigSet generateConfigs() override;
bool checkConfigSupport(egl::Config *config) override;
......
......@@ -15,10 +15,8 @@ namespace rx
{
WindowSurfaceVkWin32::WindowSurfaceVkWin32(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height)
: WindowSurfaceVk(surfaceState, window, width, height)
EGLNativeWindowType window)
: WindowSurfaceVk(surfaceState, window)
{}
angle::Result WindowSurfaceVkWin32::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
......
......@@ -18,10 +18,7 @@ namespace rx
class WindowSurfaceVkWin32 : public WindowSurfaceVk
{
public:
WindowSurfaceVkWin32(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height);
WindowSurfaceVkWin32(const egl::SurfaceState &surfaceState, EGLNativeWindowType window);
private:
angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) override;
......
......@@ -77,11 +77,9 @@ bool DisplayVkXcb::isValidNativeWindow(EGLNativeWindowType window) const
}
SurfaceImpl *DisplayVkXcb::createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height)
EGLNativeWindowType window)
{
return new WindowSurfaceVkXcb(state, window, width, height, mXcbConnection);
return new WindowSurfaceVkXcb(state, window, mXcbConnection);
}
egl::ConfigSet DisplayVkXcb::generateConfigs()
......
......@@ -28,9 +28,7 @@ class DisplayVkXcb : public DisplayVk
bool isValidNativeWindow(EGLNativeWindowType window) const override;
SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,
EGLint width,
EGLint height) override;
EGLNativeWindowType window) override;
egl::ConfigSet generateConfigs() override;
bool checkConfigSupport(egl::Config *config) override;
......
......@@ -16,10 +16,8 @@ namespace rx
WindowSurfaceVkXcb::WindowSurfaceVkXcb(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height,
xcb_connection_t *conn)
: WindowSurfaceVk(surfaceState, window, width, height), mXcbConnection(conn)
: WindowSurfaceVk(surfaceState, window), mXcbConnection(conn)
{}
angle::Result WindowSurfaceVkXcb::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
......
......@@ -22,8 +22,6 @@ class WindowSurfaceVkXcb : public WindowSurfaceVk
public:
WindowSurfaceVkXcb(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height,
xcb_connection_t *conn);
private:
......
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