Skip to content

Commit 0752520

Browse files
small template fix, lets see if android compiles
1 parent b638e2b commit 0752520

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

include/nbl/video/surface/CSurfaceGL.h

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
namespace nbl::video
1313
{
1414

15-
template<class Window, template<typename> typename Base, class CRTP = void>
16-
class CSurfaceGLImpl : public Base<Window>
15+
template<class Window, template<typename,typename> typename Base, class CRTP = void>
16+
class CSurfaceGLImpl : public Base<Window,ISurface>
1717
{
1818
public:
1919
using this_t = std::conditional_t<std::is_void_v<CRTP>,CSurfaceGLImpl<Window,Base>,CRTP>;
20-
using base_t = Base<Window>;
20+
using base_t = Base<Window,ISurface>;
2121

2222
template<video::E_API_TYPE API_TYPE>
2323
static inline core::smart_refctd_ptr<this_t> create(core::smart_refctd_ptr<video::COpenGL_Connection<API_TYPE>>&& api, core::smart_refctd_ptr<Window>&& window)
@@ -96,36 +96,31 @@ using CSurfaceNativeGL = CSurfaceGLImpl<Window, CSurfaceNative, CRTP>;
9696
// TODO: conditional defines
9797
#ifdef _NBL_PLATFORM_WINDOWS_
9898
using CSurfaceGLWin32 = CSurfaceGL<ui::IWindowWin32>;
99-
class CSurfaceNativeGLWin32 : public CSurfaceNativeGL<ui::IWindowWin32, CSurfaceNativeGLWin32>
99+
class CSurfaceNativeGLWin32 : public CSurfaceNativeGL<ui::IWindowWin32,CSurfaceNativeGLWin32>
100100
{
101-
protected:
102-
using base_t = CSurfaceNativeGL<ui::IWindowWin32, CSurfaceNativeGLWin32>;
103-
using base_t::base_t;
104-
105-
uint32_t getWidth() const override
106-
{
107-
RECT wr;
108-
GetWindowRect(m_handle, &wr);
109-
return wr.right - wr.left;
110-
}
111-
uint32_t getHeight() const override
112-
{
113-
RECT wr;
114-
GetWindowRect(m_handle, &wr);
115-
return wr.top - wr.bottom;
116-
}
101+
protected:
102+
using base_t = CSurfaceNativeGL<ui::IWindowWin32,CSurfaceNativeGLWin32>;
103+
using base_t::base_t;
104+
105+
uint32_t getWidth() const override
106+
{
107+
RECT wr;
108+
GetWindowRect(m_handle, &wr);
109+
return wr.right - wr.left;
110+
}
111+
uint32_t getHeight() const override
112+
{
113+
RECT wr;
114+
GetWindowRect(m_handle, &wr);
115+
return wr.top - wr.bottom;
116+
}
117117
};
118118
#elif defined(_NBL_PLATFORM_LINUX_)
119119
using CSurfaceGLX11 = CSurfaceGL<ui::IWindowX11>;
120120
#elif defined(_NBL_PLATFORM_ANDROID_)
121121
using CSurfaceGLAndroid = CSurfaceGL<ui::IWindowAndroid>;
122122
#endif
123123

124-
125-
//using CSurfaceGLAndroid = CSurfaceGL<ui::IWindowAndroid>;
126-
//using CSurfaceGLX11 = CSurfaceGL<ui::IWindowX11>;
127-
//using CSurfaceGLWayland = CSurfaceGL<ui::IWindowWayland>;
128-
129124
}
130125

131126
#endif

include/nbl/video/surface/ISurface.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ class ISurface : public core::IReferenceCounted
109109
virtual const void* getNativeWindowHandle() const = 0;
110110
};
111111

112-
template<class Window, class ImmediateBase = ISurface>
112+
// Base for use with Nabla's window wrappers
113+
template<class Window, class ImmediateBase>
113114
class CSurface : public ImmediateBase
114115
{
115116
public:
@@ -129,7 +130,8 @@ class CSurface : public ImmediateBase
129130
core::smart_refctd_ptr<Window> m_window;
130131
};
131132

132-
template<class Window, class ImmediateBase = ISurface>
133+
// Base to make surfaces directly from Native OS window handles
134+
template<class Window, class ImmediateBase>
133135
class CSurfaceNative : public ImmediateBase
134136
{
135137
public:

0 commit comments

Comments
 (0)