mirror of
https://github.com/opus-tango/IntroductionToVulkan.git
synced 2026-03-20 12:05:20 +00:00
Renamed "Tutorial" namespace to "ApiWithoutSecrets". Added ApiWithoutSecrets namescape to all files. Placed function pointers in an ApiWithoutSecrets namespace to fix errors on Linux.
This commit is contained in:
@@ -10,22 +10,24 @@
|
|||||||
|
|
||||||
#include "OperatingSystem.h"
|
#include "OperatingSystem.h"
|
||||||
|
|
||||||
namespace OS {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
Window::Window() :
|
namespace OS {
|
||||||
Parameters() {
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowParameters Window::GetParameters() const {
|
Window::Window() :
|
||||||
return Parameters;
|
Parameters() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowParameters Window::GetParameters() const {
|
||||||
|
return Parameters;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||||
|
|
||||||
#define TUTORIAL_NAME "API without Secrets: Introduction to Vulkan"
|
#define TUTORIAL_NAME "API without Secrets: Introduction to Vulkan"
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
|
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
|
||||||
switch( message ) {
|
switch( message ) {
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
case WM_EXITSIZEMOVE:
|
case WM_EXITSIZEMOVE:
|
||||||
PostMessage( hWnd, WM_USER + 1, wParam, lParam );
|
PostMessage( hWnd, WM_USER + 1, wParam, lParam );
|
||||||
@@ -36,68 +38,68 @@ namespace OS {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return DefWindowProc( hWnd, message, wParam, lParam );
|
return DefWindowProc( hWnd, message, wParam, lParam );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
Window::~Window() {
|
|
||||||
if( Parameters.Handle ) {
|
|
||||||
DestroyWindow( Parameters.Handle );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Parameters.Instance ) {
|
Window::~Window() {
|
||||||
UnregisterClass( TUTORIAL_NAME, Parameters.Instance );
|
if( Parameters.Handle ) {
|
||||||
}
|
DestroyWindow( Parameters.Handle );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::Create( const char *title ) {
|
if( Parameters.Instance ) {
|
||||||
Parameters.Instance = GetModuleHandle( nullptr );
|
UnregisterClass( TUTORIAL_NAME, Parameters.Instance );
|
||||||
|
}
|
||||||
// Register window class
|
|
||||||
WNDCLASSEX wcex;
|
|
||||||
|
|
||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
|
||||||
|
|
||||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
|
||||||
wcex.lpfnWndProc = WndProc;
|
|
||||||
wcex.cbClsExtra = 0;
|
|
||||||
wcex.cbWndExtra = 0;
|
|
||||||
wcex.hInstance = Parameters.Instance;
|
|
||||||
wcex.hIcon = NULL;
|
|
||||||
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
|
|
||||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
||||||
wcex.lpszMenuName = NULL;
|
|
||||||
wcex.lpszClassName = TUTORIAL_NAME;
|
|
||||||
wcex.hIconSm = NULL;
|
|
||||||
|
|
||||||
if( !RegisterClassEx( &wcex ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create window
|
bool Window::Create( const char *title ) {
|
||||||
Parameters.Handle = CreateWindow( TUTORIAL_NAME, title, WS_OVERLAPPEDWINDOW, 20, 20, 500, 500, nullptr, nullptr, Parameters.Instance, nullptr );
|
Parameters.Instance = GetModuleHandle( nullptr );
|
||||||
if( !Parameters.Handle ) {
|
|
||||||
return false;
|
// Register window class
|
||||||
|
WNDCLASSEX wcex;
|
||||||
|
|
||||||
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
|
||||||
|
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wcex.lpfnWndProc = WndProc;
|
||||||
|
wcex.cbClsExtra = 0;
|
||||||
|
wcex.cbWndExtra = 0;
|
||||||
|
wcex.hInstance = Parameters.Instance;
|
||||||
|
wcex.hIcon = NULL;
|
||||||
|
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||||
|
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||||
|
wcex.lpszMenuName = NULL;
|
||||||
|
wcex.lpszClassName = TUTORIAL_NAME;
|
||||||
|
wcex.hIconSm = NULL;
|
||||||
|
|
||||||
|
if( !RegisterClassEx( &wcex ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create window
|
||||||
|
Parameters.Handle = CreateWindow( TUTORIAL_NAME, title, WS_OVERLAPPEDWINDOW, 20, 20, 500, 500, nullptr, nullptr, Parameters.Instance, nullptr );
|
||||||
|
if( !Parameters.Handle ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
bool Window::RenderingLoop( TutorialBase &tutorial ) const {
|
||||||
}
|
// Display window
|
||||||
|
ShowWindow( Parameters.Handle, SW_SHOWNORMAL );
|
||||||
|
UpdateWindow( Parameters.Handle );
|
||||||
|
|
||||||
bool Window::RenderingLoop( TutorialBase &tutorial ) const {
|
// Main message loop
|
||||||
// Display window
|
MSG message;
|
||||||
ShowWindow( Parameters.Handle, SW_SHOWNORMAL );
|
bool loop = true;
|
||||||
UpdateWindow( Parameters.Handle );
|
bool resize = false;
|
||||||
|
|
||||||
// Main message loop
|
while( loop ) {
|
||||||
MSG message;
|
if( PeekMessage( &message, NULL, 0, 0, PM_REMOVE ) ) {
|
||||||
bool loop = true;
|
// Process events
|
||||||
bool resize = false;
|
switch( message.message ) {
|
||||||
|
// Resize
|
||||||
while( loop ) {
|
|
||||||
if( PeekMessage( &message, NULL, 0, 0, PM_REMOVE ) ) {
|
|
||||||
// Process events
|
|
||||||
switch( message.message ) {
|
|
||||||
// Resize
|
|
||||||
case WM_USER + 1:
|
case WM_USER + 1:
|
||||||
resize = true;
|
resize = true;
|
||||||
break;
|
break;
|
||||||
@@ -105,124 +107,124 @@ namespace OS {
|
|||||||
case WM_USER + 2:
|
case WM_USER + 2:
|
||||||
loop = false;
|
loop = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TranslateMessage( &message );
|
TranslateMessage( &message );
|
||||||
DispatchMessage( &message );
|
DispatchMessage( &message );
|
||||||
} else {
|
} else {
|
||||||
// Draw
|
// Draw
|
||||||
if( resize ) {
|
if( resize ) {
|
||||||
resize = false;
|
resize = false;
|
||||||
if( !tutorial.OnWindowSizeChanged() ) {
|
if( !tutorial.OnWindowSizeChanged() ) {
|
||||||
|
loop = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !tutorial.Draw() ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !tutorial.Draw() ) {
|
|
||||||
loop = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(VK_USE_PLATFORM_XCB_KHR)
|
#elif defined(VK_USE_PLATFORM_XCB_KHR)
|
||||||
|
|
||||||
Window::~Window() {
|
Window::~Window() {
|
||||||
xcb_destroy_window( Parameters.Connection, Parameters.Handle );
|
xcb_destroy_window( Parameters.Connection, Parameters.Handle );
|
||||||
xcb_disconnect( Parameters.Connection );
|
xcb_disconnect( Parameters.Connection );
|
||||||
}
|
|
||||||
|
|
||||||
bool Window::Create( const char *title ) {
|
|
||||||
int screen_index;
|
|
||||||
Parameters.Connection = xcb_connect( nullptr, &screen_index );
|
|
||||||
|
|
||||||
if( !Parameters.Connection ) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const xcb_setup_t *setup = xcb_get_setup( Parameters.Connection );
|
bool Window::Create( const char *title ) {
|
||||||
xcb_screen_iterator_t screen_iterator = xcb_setup_roots_iterator( setup );
|
int screen_index;
|
||||||
|
Parameters.Connection = xcb_connect( nullptr, &screen_index );
|
||||||
|
|
||||||
while( screen_index-- > 0 ) {
|
if( !Parameters.Connection ) {
|
||||||
xcb_screen_next( &screen_iterator );
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const xcb_setup_t *setup = xcb_get_setup( Parameters.Connection );
|
||||||
|
xcb_screen_iterator_t screen_iterator = xcb_setup_roots_iterator( setup );
|
||||||
|
|
||||||
|
while( screen_index-- > 0 ) {
|
||||||
|
xcb_screen_next( &screen_iterator );
|
||||||
|
}
|
||||||
|
|
||||||
|
xcb_screen_t *screen = screen_iterator.data;
|
||||||
|
|
||||||
|
Parameters.Handle = xcb_generate_id( Parameters.Connection );
|
||||||
|
|
||||||
|
uint32_t value_list[] = {
|
||||||
|
screen->white_pixel,
|
||||||
|
XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_STRUCTURE_NOTIFY
|
||||||
|
};
|
||||||
|
|
||||||
|
xcb_create_window(
|
||||||
|
Parameters.Connection,
|
||||||
|
XCB_COPY_FROM_PARENT,
|
||||||
|
Parameters.Handle,
|
||||||
|
screen->root,
|
||||||
|
20,
|
||||||
|
20,
|
||||||
|
500,
|
||||||
|
500,
|
||||||
|
0,
|
||||||
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
screen->root_visual,
|
||||||
|
XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK,
|
||||||
|
value_list );
|
||||||
|
|
||||||
|
xcb_change_property(
|
||||||
|
Parameters.Connection,
|
||||||
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
Parameters.Handle,
|
||||||
|
XCB_ATOM_WM_NAME,
|
||||||
|
XCB_ATOM_STRING,
|
||||||
|
8,
|
||||||
|
strlen( title ),
|
||||||
|
title );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_screen_t *screen = screen_iterator.data;
|
bool Window::RenderingLoop( TutorialBase &tutorial ) const {
|
||||||
|
// Prepare notification for window destruction
|
||||||
|
xcb_intern_atom_cookie_t protocols_cookie = xcb_intern_atom( Parameters.Connection, 1, 12, "WM_PROTOCOLS" );
|
||||||
|
xcb_intern_atom_reply_t *protocols_reply = xcb_intern_atom_reply( Parameters.Connection, protocols_cookie, 0 );
|
||||||
|
xcb_intern_atom_cookie_t delete_cookie = xcb_intern_atom( Parameters.Connection, 0, 16, "WM_DELETE_WINDOW" );
|
||||||
|
xcb_intern_atom_reply_t *delete_reply = xcb_intern_atom_reply( Parameters.Connection, delete_cookie, 0 );
|
||||||
|
xcb_change_property( Parameters.Connection, XCB_PROP_MODE_REPLACE, Parameters.Handle, (*protocols_reply).atom, 4, 32, 1, &(*delete_reply).atom );
|
||||||
|
free( protocols_reply );
|
||||||
|
|
||||||
Parameters.Handle = xcb_generate_id( Parameters.Connection );
|
// Display window
|
||||||
|
xcb_map_window( Parameters.Connection, Parameters.Handle );
|
||||||
|
xcb_flush( Parameters.Connection );
|
||||||
|
|
||||||
uint32_t value_list[] = {
|
// Main message loop
|
||||||
screen->white_pixel,
|
xcb_generic_event_t *event;
|
||||||
XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_STRUCTURE_NOTIFY
|
bool loop = true;
|
||||||
};
|
bool resize = false;
|
||||||
|
|
||||||
xcb_create_window(
|
while( loop ) {
|
||||||
Parameters.Connection,
|
event = xcb_poll_for_event( Parameters.Connection );
|
||||||
XCB_COPY_FROM_PARENT,
|
|
||||||
Parameters.Handle,
|
|
||||||
screen->root,
|
|
||||||
20,
|
|
||||||
20,
|
|
||||||
500,
|
|
||||||
500,
|
|
||||||
0,
|
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
screen->root_visual,
|
|
||||||
XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK,
|
|
||||||
value_list );
|
|
||||||
|
|
||||||
xcb_change_property(
|
if( event ) {
|
||||||
Parameters.Connection,
|
// Process events
|
||||||
XCB_PROP_MODE_REPLACE,
|
switch (event->response_type & 0x7f) {
|
||||||
Parameters.Handle,
|
// Resize
|
||||||
XCB_ATOM_WM_NAME,
|
|
||||||
XCB_ATOM_STRING,
|
|
||||||
8,
|
|
||||||
strlen( title ),
|
|
||||||
title );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Window::RenderingLoop( TutorialBase &tutorial ) const {
|
|
||||||
// Prepare notification for window destruction
|
|
||||||
xcb_intern_atom_cookie_t protocols_cookie = xcb_intern_atom( Parameters.Connection, 1, 12, "WM_PROTOCOLS" );
|
|
||||||
xcb_intern_atom_reply_t *protocols_reply = xcb_intern_atom_reply( Parameters.Connection, protocols_cookie, 0 );
|
|
||||||
xcb_intern_atom_cookie_t delete_cookie = xcb_intern_atom( Parameters.Connection, 0, 16, "WM_DELETE_WINDOW" );
|
|
||||||
xcb_intern_atom_reply_t *delete_reply = xcb_intern_atom_reply( Parameters.Connection, delete_cookie, 0 );
|
|
||||||
xcb_change_property( Parameters.Connection, XCB_PROP_MODE_REPLACE, Parameters.Handle, (*protocols_reply).atom, 4, 32, 1, &(*delete_reply).atom );
|
|
||||||
free( protocols_reply );
|
|
||||||
|
|
||||||
// Display window
|
|
||||||
xcb_map_window( Parameters.Connection, Parameters.Handle );
|
|
||||||
xcb_flush( Parameters.Connection );
|
|
||||||
|
|
||||||
// Main message loop
|
|
||||||
xcb_generic_event_t *event;
|
|
||||||
bool loop = true;
|
|
||||||
bool resize = false;
|
|
||||||
|
|
||||||
while( loop ) {
|
|
||||||
event = xcb_poll_for_event( Parameters.Connection );
|
|
||||||
|
|
||||||
if( event ) {
|
|
||||||
// Process events
|
|
||||||
switch (event->response_type & 0x7f) {
|
|
||||||
// Resize
|
|
||||||
case XCB_CONFIGURE_NOTIFY: {
|
case XCB_CONFIGURE_NOTIFY: {
|
||||||
xcb_configure_notify_event_t *configure_event = (xcb_configure_notify_event_t*)event;
|
xcb_configure_notify_event_t *configure_event = (xcb_configure_notify_event_t*)event;
|
||||||
static uint16_t width = configure_event->width;
|
static uint16_t width = configure_event->width;
|
||||||
static uint16_t height = configure_event->height;
|
static uint16_t height = configure_event->height;
|
||||||
|
|
||||||
if( ((configure_event->width > 0) && (width != configure_event->width)) ||
|
if( ((configure_event->width > 0) && (width != configure_event->width)) ||
|
||||||
((configure_event->height > 0) && (height != configure_event->height)) ) {
|
((configure_event->height > 0) && (height != configure_event->height)) ) {
|
||||||
resize = true;
|
resize = true;
|
||||||
width = configure_event->width;
|
width = configure_event->width;
|
||||||
height = configure_event->height;
|
height = configure_event->height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
// Close
|
||||||
// Close
|
|
||||||
case XCB_CLIENT_MESSAGE:
|
case XCB_CLIENT_MESSAGE:
|
||||||
if( (*(xcb_client_message_event_t*)event).data.data32[0] == (*delete_reply).atom ) {
|
if( (*(xcb_client_message_event_t*)event).data.data32[0] == (*delete_reply).atom ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
@@ -232,89 +234,89 @@ namespace OS {
|
|||||||
case XCB_KEY_PRESS:
|
case XCB_KEY_PRESS:
|
||||||
loop = false;
|
loop = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free( event );
|
free( event );
|
||||||
} else {
|
} else {
|
||||||
// Draw
|
// Draw
|
||||||
if( resize ) {
|
if( resize ) {
|
||||||
resize = false;
|
resize = false;
|
||||||
if( !tutorial.OnWindowSizeChanged() ) {
|
if( !tutorial.OnWindowSizeChanged() ) {
|
||||||
|
loop = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !tutorial.Draw() ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !tutorial.Draw() ) {
|
|
||||||
loop = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||||
|
|
||||||
Window::~Window() {
|
Window::~Window() {
|
||||||
XDestroyWindow( Parameters.DisplayPtr, Parameters.Handle );
|
XDestroyWindow( Parameters.DisplayPtr, Parameters.Handle );
|
||||||
XCloseDisplay( Parameters.DisplayPtr );
|
XCloseDisplay( Parameters.DisplayPtr );
|
||||||
}
|
|
||||||
|
|
||||||
bool Window::Create( const char *title ) {
|
|
||||||
Parameters.DisplayPtr = XOpenDisplay( nullptr );
|
|
||||||
if( !Parameters.DisplayPtr ) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int default_screen = DefaultScreen( Parameters.DisplayPtr );
|
bool Window::Create( const char *title ) {
|
||||||
|
Parameters.DisplayPtr = XOpenDisplay( nullptr );
|
||||||
|
if( !Parameters.DisplayPtr ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Parameters.Handle = XCreateSimpleWindow(
|
int default_screen = DefaultScreen( Parameters.DisplayPtr );
|
||||||
Parameters.DisplayPtr,
|
|
||||||
DefaultRootWindow( Parameters.DisplayPtr ),
|
|
||||||
20,
|
|
||||||
20,
|
|
||||||
500,
|
|
||||||
500,
|
|
||||||
1,
|
|
||||||
BlackPixel( Parameters.DisplayPtr, default_screen ),
|
|
||||||
WhitePixel( Parameters.DisplayPtr, default_screen ) );
|
|
||||||
|
|
||||||
XSetStandardProperties( Parameters.DisplayPtr, Parameters.Handle, title, title, None, nullptr, 0, nullptr );
|
Parameters.Handle = XCreateSimpleWindow(
|
||||||
XSelectInput( Parameters.DisplayPtr, Parameters.Handle, ExposureMask | KeyPressMask | StructureNotifyMask );
|
Parameters.DisplayPtr,
|
||||||
|
DefaultRootWindow( Parameters.DisplayPtr ),
|
||||||
|
20,
|
||||||
|
20,
|
||||||
|
500,
|
||||||
|
500,
|
||||||
|
1,
|
||||||
|
BlackPixel( Parameters.DisplayPtr, default_screen ),
|
||||||
|
WhitePixel( Parameters.DisplayPtr, default_screen ) );
|
||||||
|
|
||||||
return true;
|
XSetStandardProperties( Parameters.DisplayPtr, Parameters.Handle, title, title, None, nullptr, 0, nullptr );
|
||||||
}
|
XSelectInput( Parameters.DisplayPtr, Parameters.Handle, ExposureMask | KeyPressMask | StructureNotifyMask );
|
||||||
|
|
||||||
bool Window::RenderingLoop( TutorialBase &tutorial ) const {
|
return true;
|
||||||
// Prepare notification for window destruction
|
}
|
||||||
Atom delete_window_atom;
|
|
||||||
delete_window_atom = XInternAtom( Parameters.DisplayPtr, "WM_DELETE_WINDOW", false );
|
|
||||||
XSetWMProtocols( Parameters.DisplayPtr, Parameters.Handle, &delete_window_atom, 1);
|
|
||||||
|
|
||||||
// Display window
|
bool Window::RenderingLoop( TutorialBase &tutorial ) const {
|
||||||
XClearWindow( Parameters.DisplayPtr, Parameters.Handle );
|
// Prepare notification for window destruction
|
||||||
XMapWindow( Parameters.DisplayPtr, Parameters.Handle );
|
Atom delete_window_atom;
|
||||||
|
delete_window_atom = XInternAtom( Parameters.DisplayPtr, "WM_DELETE_WINDOW", false );
|
||||||
|
XSetWMProtocols( Parameters.DisplayPtr, Parameters.Handle, &delete_window_atom, 1);
|
||||||
|
|
||||||
// Main message loop
|
// Display window
|
||||||
XEvent event;
|
XClearWindow( Parameters.DisplayPtr, Parameters.Handle );
|
||||||
bool loop = true;
|
XMapWindow( Parameters.DisplayPtr, Parameters.Handle );
|
||||||
bool resize = false;
|
|
||||||
|
|
||||||
while( loop ) {
|
// Main message loop
|
||||||
if( XPending( Parameters.DisplayPtr ) ) {
|
XEvent event;
|
||||||
XNextEvent( Parameters.DisplayPtr, &event );
|
bool loop = true;
|
||||||
switch( event.type ) {
|
bool resize = false;
|
||||||
//Process events
|
|
||||||
|
while( loop ) {
|
||||||
|
if( XPending( Parameters.DisplayPtr ) ) {
|
||||||
|
XNextEvent( Parameters.DisplayPtr, &event );
|
||||||
|
switch( event.type ) {
|
||||||
|
//Process events
|
||||||
case ConfigureNotify: {
|
case ConfigureNotify: {
|
||||||
static int width = event.xconfigure.width;
|
static int width = event.xconfigure.width;
|
||||||
static int height = event.xconfigure.height;
|
static int height = event.xconfigure.height;
|
||||||
|
|
||||||
if( ((event.xconfigure.width > 0) && (event.xconfigure.width != width)) ||
|
if( ((event.xconfigure.width > 0) && (event.xconfigure.width != width)) ||
|
||||||
((event.xconfigure.height > 0) && (event.xconfigure.width != height)) ) {
|
((event.xconfigure.height > 0) && (event.xconfigure.width != height)) ) {
|
||||||
width = event.xconfigure.width;
|
width = event.xconfigure.width;
|
||||||
height = event.xconfigure.height;
|
height = event.xconfigure.height;
|
||||||
resize = true;
|
resize = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
loop = false;
|
loop = false;
|
||||||
break;
|
break;
|
||||||
@@ -326,24 +328,26 @@ namespace OS {
|
|||||||
loop = false;
|
loop = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Draw
|
// Draw
|
||||||
if( resize ) {
|
if( resize ) {
|
||||||
resize = false;
|
resize = false;
|
||||||
if( !tutorial.OnWindowSizeChanged() ) {
|
if( !tutorial.OnWindowSizeChanged() ) {
|
||||||
|
loop = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !tutorial.Draw() ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !tutorial.Draw() ) {
|
|
||||||
loop = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace OS
|
} // namespace OS
|
||||||
|
|
||||||
|
} // namespace ApiWithoutSecrets
|
||||||
@@ -30,90 +30,94 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace OS {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
namespace OS {
|
||||||
// LibraryHandle //
|
|
||||||
// //
|
// ************************************************************ //
|
||||||
// Dynamic Library OS dependent type //
|
// LibraryHandle //
|
||||||
// ************************************************************ //
|
// //
|
||||||
//
|
// Dynamic Library OS dependent type //
|
||||||
|
// ************************************************************ //
|
||||||
|
//
|
||||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||||
typedef HMODULE LibraryHandle;
|
typedef HMODULE LibraryHandle;
|
||||||
|
|
||||||
#elif defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR)
|
#elif defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||||
typedef void* LibraryHandle;
|
typedef void* LibraryHandle;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// OnWindowSizeChanged //
|
// OnWindowSizeChanged //
|
||||||
// //
|
// //
|
||||||
// Base class for handling window size changes //
|
// Base class for handling window size changes //
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
class TutorialBase {
|
class TutorialBase {
|
||||||
public:
|
public:
|
||||||
virtual bool OnWindowSizeChanged() = 0;
|
virtual bool OnWindowSizeChanged() = 0;
|
||||||
virtual bool Draw() = 0;
|
virtual bool Draw() = 0;
|
||||||
|
|
||||||
virtual ~TutorialBase( ) {
|
virtual ~TutorialBase() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// WindowParameters //
|
// WindowParameters //
|
||||||
// //
|
// //
|
||||||
// OS dependent window parameters //
|
// OS dependent window parameters //
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
struct WindowParameters {
|
struct WindowParameters {
|
||||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||||
HINSTANCE Instance;
|
HINSTANCE Instance;
|
||||||
HWND Handle;
|
HWND Handle;
|
||||||
|
|
||||||
WindowParameters() :
|
WindowParameters() :
|
||||||
Instance(),
|
Instance(),
|
||||||
Handle() {
|
Handle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(VK_USE_PLATFORM_XCB_KHR)
|
#elif defined(VK_USE_PLATFORM_XCB_KHR)
|
||||||
xcb_connection_t *Connection;
|
xcb_connection_t *Connection;
|
||||||
xcb_window_t Handle;
|
xcb_window_t Handle;
|
||||||
|
|
||||||
WindowParameters() :
|
WindowParameters() :
|
||||||
Connection(),
|
Connection(),
|
||||||
Handle() {
|
Handle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||||
Display *DisplayPtr;
|
Display *DisplayPtr;
|
||||||
Window Handle;
|
Window Handle;
|
||||||
|
|
||||||
WindowParameters() :
|
WindowParameters() :
|
||||||
DisplayPtr(),
|
DisplayPtr(),
|
||||||
Handle() {
|
Handle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// Window //
|
// Window //
|
||||||
// //
|
// //
|
||||||
// OS dependent window creation and destruction class //
|
// OS dependent window creation and destruction class //
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
class Window {
|
class Window {
|
||||||
public:
|
public:
|
||||||
Window();
|
Window();
|
||||||
~Window();
|
~Window();
|
||||||
|
|
||||||
bool Create( const char *title );
|
bool Create( const char *title );
|
||||||
bool RenderingLoop( TutorialBase &tutorial ) const;
|
bool RenderingLoop( TutorialBase &tutorial ) const;
|
||||||
WindowParameters GetParameters() const;
|
WindowParameters GetParameters() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WindowParameters Parameters;
|
WindowParameters Parameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace OS
|
||||||
|
|
||||||
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif // OPERATING_SYSTEM_HEADER
|
#endif // OPERATING_SYSTEM_HEADER
|
||||||
@@ -12,27 +12,31 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Tools.h"
|
#include "Tools.h"
|
||||||
|
|
||||||
namespace Tools {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
std::vector<char> GetBinaryFileContents( std::string const &filename ) {
|
namespace Tools {
|
||||||
|
|
||||||
std::ifstream file( filename, std::ios::binary );
|
std::vector<char> GetBinaryFileContents( std::string const &filename ) {
|
||||||
if( file.fail() ) {
|
|
||||||
std::cout << "Could not open \"" << filename << "\" file!" << std::endl;
|
std::ifstream file( filename, std::ios::binary );
|
||||||
return std::vector<char>();
|
if( file.fail() ) {
|
||||||
|
std::cout << "Could not open \"" << filename << "\" file!" << std::endl;
|
||||||
|
return std::vector<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::streampos begin, end;
|
||||||
|
begin = file.tellg();
|
||||||
|
file.seekg( 0, std::ios::end );
|
||||||
|
end = file.tellg();
|
||||||
|
|
||||||
|
std::vector<char> result( static_cast<size_t>(end - begin) );
|
||||||
|
file.seekg( 0, std::ios::beg );
|
||||||
|
file.read( &result[0], end - begin );
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::streampos begin, end;
|
} // namespace Tools
|
||||||
begin = file.tellg();
|
|
||||||
file.seekg( 0, std::ios::end );
|
|
||||||
end = file.tellg();
|
|
||||||
|
|
||||||
std::vector<char> result( static_cast<size_t>(end - begin) );
|
} // namespace ApiWithoutSecrets
|
||||||
file.seekg( 0, std::ios::beg );
|
|
||||||
file.read( &result[0], end - begin );
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -15,73 +15,77 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "vulkan.h"
|
#include "vulkan.h"
|
||||||
|
|
||||||
namespace Tools {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
namespace Tools {
|
||||||
// AutoDeleter //
|
|
||||||
// //
|
|
||||||
// Auto-deleter helper template class responsible for calling //
|
|
||||||
// provided function which deletes given object of type T //
|
|
||||||
// ************************************************************ //
|
|
||||||
template<class T, class F>
|
|
||||||
class AutoDeleter {
|
|
||||||
public:
|
|
||||||
AutoDeleter() :
|
|
||||||
Object( VK_NULL_HANDLE ),
|
|
||||||
Deleter( nullptr ),
|
|
||||||
Device( VK_NULL_HANDLE ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoDeleter( T object, F deleter, VkDevice device ) :
|
// ************************************************************ //
|
||||||
Object( object ),
|
// AutoDeleter //
|
||||||
Deleter( deleter ),
|
// //
|
||||||
Device( device ) {
|
// Auto-deleter helper template class responsible for calling //
|
||||||
}
|
// provided function which deletes given object of type T //
|
||||||
|
// ************************************************************ //
|
||||||
AutoDeleter( AutoDeleter&& other ) {
|
template<class T, class F>
|
||||||
*this = std::move( other );
|
class AutoDeleter {
|
||||||
}
|
public:
|
||||||
|
AutoDeleter() :
|
||||||
~AutoDeleter() {
|
Object( VK_NULL_HANDLE ),
|
||||||
if( (Object != VK_NULL_HANDLE) && (Deleter != nullptr) && (Device != VK_NULL_HANDLE) ) {
|
Deleter( nullptr ),
|
||||||
Deleter( Device, Object, nullptr );
|
Device( VK_NULL_HANDLE ) {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
AutoDeleter& operator=( AutoDeleter&& other ) {
|
AutoDeleter( T object, F deleter, VkDevice device ) :
|
||||||
if( this != &other ) {
|
Object( object ),
|
||||||
Object = other.Object;
|
Deleter( deleter ),
|
||||||
Deleter = other.Deleter;
|
Device( device ) {
|
||||||
Device = other.Device;
|
|
||||||
other.Object = VK_NULL_HANDLE;
|
|
||||||
}
|
}
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
T Get() {
|
AutoDeleter( AutoDeleter&& other ) {
|
||||||
return Object;
|
*this = std::move( other );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator !() const {
|
~AutoDeleter() {
|
||||||
return Object == VK_NULL_HANDLE;
|
if( (Object != VK_NULL_HANDLE) && (Deleter != nullptr) && (Device != VK_NULL_HANDLE) ) {
|
||||||
}
|
Deleter( Device, Object, nullptr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
AutoDeleter& operator=(AutoDeleter&& other) {
|
||||||
AutoDeleter( const AutoDeleter& );
|
if( this != &other ) {
|
||||||
AutoDeleter& operator=( const AutoDeleter& );
|
Object = other.Object;
|
||||||
T Object;
|
Deleter = other.Deleter;
|
||||||
F Deleter;
|
Device = other.Device;
|
||||||
VkDevice Device;
|
other.Object = VK_NULL_HANDLE;
|
||||||
};
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************ //
|
T Get() {
|
||||||
// GetBinaryFileContents //
|
return Object;
|
||||||
// //
|
}
|
||||||
// Function reading binary contents of a file //
|
|
||||||
// ************************************************************ //
|
|
||||||
std::vector<char> GetBinaryFileContents( std::string const &filename );
|
|
||||||
|
|
||||||
}
|
bool operator !() const {
|
||||||
|
return Object == VK_NULL_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
AutoDeleter( const AutoDeleter& );
|
||||||
|
AutoDeleter& operator=(const AutoDeleter&);
|
||||||
|
T Object;
|
||||||
|
F Deleter;
|
||||||
|
VkDevice Device;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ************************************************************ //
|
||||||
|
// GetBinaryFileContents //
|
||||||
|
// //
|
||||||
|
// Function reading binary contents of a file //
|
||||||
|
// ************************************************************ //
|
||||||
|
std::vector<char> GetBinaryFileContents( std::string const &filename );
|
||||||
|
|
||||||
|
} // namespace Tools
|
||||||
|
|
||||||
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
|
|
||||||
#endif // TOOLS_HEADER
|
#endif // TOOLS_HEADER
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "VulkanCommon.h"
|
#include "VulkanCommon.h"
|
||||||
#include "VulkanFunctions.h"
|
#include "VulkanFunctions.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
VulkanCommon::VulkanCommon() :
|
VulkanCommon::VulkanCommon() :
|
||||||
VulkanLibrary(),
|
VulkanLibrary(),
|
||||||
@@ -707,4 +707,4 @@ namespace Tutorial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "vulkan.h"
|
#include "vulkan.h"
|
||||||
#include "OperatingSystem.h"
|
#include "OperatingSystem.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// QueueParameters //
|
// QueueParameters //
|
||||||
@@ -129,6 +129,6 @@ namespace Tutorial {
|
|||||||
VkPresentModeKHR GetSwapChainPresentMode( std::vector<VkPresentModeKHR> &present_modes );
|
VkPresentModeKHR GetSwapChainPresentMode( std::vector<VkPresentModeKHR> &present_modes );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif // VULKAN_COMMON_HEADER
|
#endif // VULKAN_COMMON_HEADER
|
||||||
@@ -10,9 +10,13 @@
|
|||||||
|
|
||||||
#include "vulkan.h"
|
#include "vulkan.h"
|
||||||
|
|
||||||
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
#define VK_EXPORTED_FUNCTION( fun ) PFN_##fun fun;
|
#define VK_EXPORTED_FUNCTION( fun ) PFN_##fun fun;
|
||||||
#define VK_GLOBAL_LEVEL_FUNCTION( fun ) PFN_##fun fun;
|
#define VK_GLOBAL_LEVEL_FUNCTION( fun ) PFN_##fun fun;
|
||||||
#define VK_INSTANCE_LEVEL_FUNCTION( fun ) PFN_##fun fun;
|
#define VK_INSTANCE_LEVEL_FUNCTION( fun ) PFN_##fun fun;
|
||||||
#define VK_DEVICE_LEVEL_FUNCTION( fun ) PFN_##fun fun;
|
#define VK_DEVICE_LEVEL_FUNCTION( fun ) PFN_##fun fun;
|
||||||
|
|
||||||
#include "ListOfFunctions.inl"
|
#include "ListOfFunctions.inl"
|
||||||
|
|
||||||
|
} // namespace ApiWithoutSecrets
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "vulkan.h"
|
#include "vulkan.h"
|
||||||
|
|
||||||
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
#define VK_EXPORTED_FUNCTION( fun ) extern PFN_##fun fun;
|
#define VK_EXPORTED_FUNCTION( fun ) extern PFN_##fun fun;
|
||||||
#define VK_GLOBAL_LEVEL_FUNCTION( fun) extern PFN_##fun fun;
|
#define VK_GLOBAL_LEVEL_FUNCTION( fun) extern PFN_##fun fun;
|
||||||
#define VK_INSTANCE_LEVEL_FUNCTION( fun ) extern PFN_##fun fun;
|
#define VK_INSTANCE_LEVEL_FUNCTION( fun ) extern PFN_##fun fun;
|
||||||
@@ -20,4 +22,6 @@
|
|||||||
|
|
||||||
#include "ListOfFunctions.inl"
|
#include "ListOfFunctions.inl"
|
||||||
|
|
||||||
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "Tutorial01.h"
|
#include "Tutorial01.h"
|
||||||
#include "VulkanFunctions.h"
|
#include "VulkanFunctions.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
Tutorial01::Tutorial01() :
|
Tutorial01::Tutorial01() :
|
||||||
VulkanLibrary(),
|
VulkanLibrary(),
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "vulkan.h"
|
#include "vulkan.h"
|
||||||
#include "OperatingSystem.h"
|
#include "OperatingSystem.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// VulkanTutorial01Parameters //
|
// VulkanTutorial01Parameters //
|
||||||
@@ -65,6 +65,6 @@ namespace Tutorial {
|
|||||||
bool GetDeviceQueue();
|
bool GetDeviceQueue();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif // TUTORIAL_01_HEADER
|
#endif // TUTORIAL_01_HEADER
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#include "Tutorial01.h"
|
#include "Tutorial01.h"
|
||||||
|
|
||||||
int main( int argc, char **argv ) {
|
int main( int argc, char **argv ) {
|
||||||
OS::Window window;
|
ApiWithoutSecrets::OS::Window window;
|
||||||
Tutorial::Tutorial01 tutorial01;
|
ApiWithoutSecrets::Tutorial01 tutorial01;
|
||||||
|
|
||||||
// Window creation
|
// Window creation
|
||||||
if( !window.Create( "01 - The Beginning" ) ) {
|
if( !window.Create( "01 - The Beginning" ) ) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "Tutorial02.h"
|
#include "Tutorial02.h"
|
||||||
#include "VulkanFunctions.h"
|
#include "VulkanFunctions.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
Tutorial02::Tutorial02() :
|
Tutorial02::Tutorial02() :
|
||||||
VulkanLibrary(),
|
VulkanLibrary(),
|
||||||
@@ -851,4 +851,4 @@ namespace Tutorial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "vulkan.h"
|
#include "vulkan.h"
|
||||||
#include "OperatingSystem.h"
|
#include "OperatingSystem.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// VulkanTutorial02Parameters //
|
// VulkanTutorial02Parameters //
|
||||||
@@ -96,6 +96,6 @@ namespace Tutorial {
|
|||||||
VkPresentModeKHR GetSwapChainPresentMode( std::vector<VkPresentModeKHR> &present_modes );
|
VkPresentModeKHR GetSwapChainPresentMode( std::vector<VkPresentModeKHR> &present_modes );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif // TUTORIAL_02_HEADER
|
#endif // TUTORIAL_02_HEADER
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#include "Tutorial02.h"
|
#include "Tutorial02.h"
|
||||||
|
|
||||||
int main( int argc, char **argv ) {
|
int main( int argc, char **argv ) {
|
||||||
OS::Window window;
|
ApiWithoutSecrets::OS::Window window;
|
||||||
Tutorial::Tutorial02 tutorial02;
|
ApiWithoutSecrets::Tutorial02 tutorial02;
|
||||||
|
|
||||||
// Window creation
|
// Window creation
|
||||||
if( !window.Create( "02 - Swap chain" ) ) {
|
if( !window.Create( "02 - Swap chain" ) ) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "Tutorial03.h"
|
#include "Tutorial03.h"
|
||||||
#include "VulkanFunctions.h"
|
#include "VulkanFunctions.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
Tutorial03::Tutorial03() :
|
Tutorial03::Tutorial03() :
|
||||||
Vulkan() {
|
Vulkan() {
|
||||||
@@ -593,4 +593,4 @@ namespace Tutorial {
|
|||||||
ChildClear();
|
ChildClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "VulkanCommon.h"
|
#include "VulkanCommon.h"
|
||||||
#include "Tools.h"
|
#include "Tools.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// FramebufferObject //
|
// FramebufferObject //
|
||||||
@@ -77,6 +77,6 @@ namespace Tutorial {
|
|||||||
bool ChildOnWindowSizeChanged() override;
|
bool ChildOnWindowSizeChanged() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif // TUTORIAL_03_HEADER
|
#endif // TUTORIAL_03_HEADER
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#include "Tutorial03.h"
|
#include "Tutorial03.h"
|
||||||
|
|
||||||
int main( int argc, char **argv ) {
|
int main( int argc, char **argv ) {
|
||||||
OS::Window window;
|
ApiWithoutSecrets::OS::Window window;
|
||||||
Tutorial::Tutorial03 tutorial03;
|
ApiWithoutSecrets::Tutorial03 tutorial03;
|
||||||
|
|
||||||
// Window creation
|
// Window creation
|
||||||
if( !window.Create( "03 - First Triangle" ) ) {
|
if( !window.Create( "03 - First Triangle" ) ) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "Tutorial04.h"
|
#include "Tutorial04.h"
|
||||||
#include "VulkanFunctions.h"
|
#include "VulkanFunctions.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
Tutorial04::Tutorial04() :
|
Tutorial04::Tutorial04() :
|
||||||
Vulkan() {
|
Vulkan() {
|
||||||
@@ -915,4 +915,4 @@ namespace Tutorial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "VulkanCommon.h"
|
#include "VulkanCommon.h"
|
||||||
#include "Tools.h"
|
#include "Tools.h"
|
||||||
|
|
||||||
namespace Tutorial {
|
namespace ApiWithoutSecrets {
|
||||||
|
|
||||||
// ************************************************************ //
|
// ************************************************************ //
|
||||||
// ImageParameters //
|
// ImageParameters //
|
||||||
@@ -127,6 +127,6 @@ namespace Tutorial {
|
|||||||
bool ChildOnWindowSizeChanged() override;
|
bool ChildOnWindowSizeChanged() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tutorial
|
} // namespace ApiWithoutSecrets
|
||||||
|
|
||||||
#endif // TUTORIAL_03_HEADER
|
#endif // TUTORIAL_03_HEADER
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#include "Tutorial04.h"
|
#include "Tutorial04.h"
|
||||||
|
|
||||||
int main( int argc, char **argv ) {
|
int main( int argc, char **argv ) {
|
||||||
OS::Window window;
|
ApiWithoutSecrets::OS::Window window;
|
||||||
Tutorial::Tutorial04 tutorial04;
|
ApiWithoutSecrets::Tutorial04 tutorial04;
|
||||||
|
|
||||||
// Window creation
|
// Window creation
|
||||||
if( !window.Create( "04 - Vertex Attributes" ) ) {
|
if( !window.Create( "04 - Vertex Attributes" ) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user