SurfaceVk.h#
The PVRVk Surface class.
Includes#
PVRVk/DebugUtilsVk.h
PVRVk/ForwardDecObjectsVk.h
PVRVk/PVRVkObjectBaseVk.h
PVRVk/TypesVk.h
Included By#
Namespaces#
Classes#
Source Code#
#pragma once
#include "PVRVk/PVRVkObjectBaseVk.h"
#include "PVRVk/DebugUtilsVk.h"
#include "PVRVk/ForwardDecObjectsVk.h"
#include "PVRVk/TypesVk.h"
#if defined(VK_USE_PLATFORM_XCB_KHR)
#include <xcb/xcb.h>
#endif
namespace pvrvk {
namespace impl {
class Surface_ : public PVRVkInstanceObjectBase<VkSurfaceKHR, ObjectType::e_SURFACE_KHR>
{
protected:
Surface_(Instance& instance);
~Surface_();
};
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
class AndroidSurface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend AndroidSurface_;
};
static AndroidSurface constructShared(Instance& instance, ANativeWindow* aNativewindow, AndroidSurfaceCreateFlagsKHR flags = AndroidSurfaceCreateFlagsKHR::e_NONE)
{
return std::make_shared<AndroidSurface_>(make_shared_enabler{}, instance, aNativewindow, flags);
}
ANativeWindow* _aNativeWindow;
AndroidSurfaceCreateFlagsKHR _flags;
public:
DECLARE_NO_COPY_SEMANTICS(AndroidSurface_)
AndroidSurface_(make_shared_enabler, Instance& instance, ANativeWindow* aNativewindow, AndroidSurfaceCreateFlagsKHR flags);
const ANativeWindow* getANativeWindow() const { return _aNativeWindow; }
const AndroidSurfaceCreateFlagsKHR& getFlags() const { return _flags; }
};
#endif
#if defined(VK_USE_PLATFORM_WIN32_KHR)
class Win32Surface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend Win32Surface_;
};
static Win32Surface constructShared(Instance& instance, HINSTANCE hinstance, HWND hwnd, Win32SurfaceCreateFlagsKHR flags = Win32SurfaceCreateFlagsKHR::e_NONE)
{
return std::make_shared<Win32Surface_>(make_shared_enabler{}, instance, hinstance, hwnd, flags);
}
HINSTANCE _hinstance;
HWND _hwnd;
Win32SurfaceCreateFlagsKHR _flags;
public:
DECLARE_NO_COPY_SEMANTICS(Win32Surface_)
Win32Surface_(make_shared_enabler, Instance& instance, HINSTANCE hinstance, HWND hwnd, Win32SurfaceCreateFlagsKHR flags);
const HINSTANCE& getHInstance() const { return _hinstance; }
const HWND& getHwnd() const { return _hwnd; }
const Win32SurfaceCreateFlagsKHR& getFlags() const { return _flags; }
};
#endif
#if defined(VK_USE_PLATFORM_XCB_KHR)
class XcbSurface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend XcbSurface_;
};
static XcbSurface constructShared(Instance& instance, xcb_connection_t* connection, xcb_window_t window, XcbSurfaceCreateFlagsKHR flags = XcbSurfaceCreateFlagsKHR::e_NONE)
{
return std::make_shared<XcbSurface_>(make_shared_enabler{}, instance, connection, window, flags);
}
xcb_connection_t* _connection;
xcb_window_t _window;
XcbSurfaceCreateFlagsKHR _flags;
public:
DECLARE_NO_COPY_SEMANTICS(XcbSurface_)
XcbSurface_(make_shared_enabler, Instance& instance, xcb_connection_t* connection, xcb_window_t window, XcbSurfaceCreateFlagsKHR flags);
const xcb_connection_t& getConnection() const { return *_connection; }
xcb_window_t getWindow() const { return _window; }
const XcbSurfaceCreateFlagsKHR& getFlags() const { return _flags; }
};
#endif
#if defined(VK_USE_PLATFORM_XLIB_KHR)
class XlibSurface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend XlibSurface_;
};
static XlibSurface constructShared(Instance& instance, ::Display* dpy, Window window, XlibSurfaceCreateFlagsKHR flags = XlibSurfaceCreateFlagsKHR::e_NONE)
{
return std::make_shared<XlibSurface_>(make_shared_enabler{}, instance, dpy, window, flags);
}
::Display* _dpy;
Window _window;
XlibSurfaceCreateFlagsKHR _flags;
public:
DECLARE_NO_COPY_SEMANTICS(XlibSurface_)
XlibSurface_(make_shared_enabler, Instance& instance, ::Display* dpy, Window window, XlibSurfaceCreateFlagsKHR flags);
const ::Display& getDpy() const { return *_dpy; }
const Window& getWindow() const { return _window; }
const XlibSurfaceCreateFlagsKHR& getFlags() const { return _flags; }
};
#endif
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
class WaylandSurface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend WaylandSurface_;
};
static WaylandSurface constructShared(Instance& instance, wl_display* display, wl_surface* surface, WaylandSurfaceCreateFlagsKHR flags = WaylandSurfaceCreateFlagsKHR::e_NONE)
{
return std::make_shared<WaylandSurface_>(make_shared_enabler{}, instance, display, surface, flags);
}
wl_display* _display;
wl_surface* _surface;
WaylandSurfaceCreateFlagsKHR _flags;
public:
DECLARE_NO_COPY_SEMANTICS(WaylandSurface_)
WaylandSurface_(make_shared_enabler, Instance& instance, wl_display* display, wl_surface* surface, WaylandSurfaceCreateFlagsKHR flags);
const wl_display* getDisplay() const { return _display; }
const wl_surface* getSurface() const { return _surface; }
const WaylandSurfaceCreateFlagsKHR& getFlags() const { return _flags; }
};
#endif
#if defined(VK_USE_PLATFORM_MACOS_MVK)
class MacOSSurface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend MacOSSurface_;
};
static MacOSSurface constructShared(Instance& instance, void* view)
{
return std::make_shared<MacOSSurface_>(make_shared_enabler{}, instance, view);
}
void* _view;
public:
DECLARE_NO_COPY_SEMANTICS(MacOSSurface_)
MacOSSurface_(make_shared_enabler, Instance& instance, void* view);
const void* getView() const
{
return _view;
}
};
#endif
class DisplayPlaneSurface_ : public Surface_
{
private:
friend class Instance_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend DisplayPlaneSurface_;
};
static DisplayPlaneSurface constructShared(Instance& instance, const DisplayMode& displayMode, Extent2D imageExtent,
const DisplaySurfaceCreateFlagsKHR flags = DisplaySurfaceCreateFlagsKHR::e_NONE, uint32_t planeIndex = 0, uint32_t planeStackIndex = 0,
SurfaceTransformFlagsKHR transformFlags = SurfaceTransformFlagsKHR::e_IDENTITY_BIT_KHR, float globalAlpha = 0.0f,
DisplayPlaneAlphaFlagsKHR alphaFlags = DisplayPlaneAlphaFlagsKHR::e_PER_PIXEL_BIT_KHR)
{
return std::make_shared<DisplayPlaneSurface_>(
make_shared_enabler{}, instance, displayMode, imageExtent, flags, planeIndex, planeStackIndex, transformFlags, globalAlpha, alphaFlags);
}
DisplayModeWeakPtr _displayMode;
DisplaySurfaceCreateFlagsKHR _flags;
uint32_t _planeIndex;
uint32_t _planeStackIndex;
SurfaceTransformFlagsKHR _transformFlags;
float _globalAlpha;
DisplayPlaneAlphaFlagsKHR _alphaFlags;
Extent2D _imageExtent;
public:
DECLARE_NO_COPY_SEMANTICS(DisplayPlaneSurface_)
DisplayPlaneSurface_(make_shared_enabler, Instance& instance, const DisplayMode& displayMode, Extent2D imageExtent, const DisplaySurfaceCreateFlagsKHR flags,
uint32_t planeIndex, uint32_t planeStackIndex, SurfaceTransformFlagsKHR transformFlags, float globalAlpha, DisplayPlaneAlphaFlagsKHR alphaFlags);
const DisplayModeWeakPtr& getDisplayMode() const { return _displayMode; }
const DisplaySurfaceCreateFlagsKHR& getFlags() const { return _flags; }
uint32_t getPlaneIndex() const { return _planeIndex; }
uint32_t getPlaneStackIndex() const { return _planeStackIndex; }
const SurfaceTransformFlagsKHR& getTransformFlags() const { return _transformFlags; }
float getGlobalAlpha() const { return _globalAlpha; }
const DisplayPlaneAlphaFlagsKHR& getAlphaFlags() const { return _alphaFlags; }
const Extent2D& getImageExtent() const { return _imageExtent; }
};
} // namespace impl
} // namespace pvrvk