diff --git a/include/boo/IWindow.hpp b/include/boo/IWindow.hpp index 5b42ad1..d5e6c3b 100644 --- a/include/boo/IWindow.hpp +++ b/include/boo/IWindow.hpp @@ -173,18 +173,7 @@ enum class EWindowStyle Default = Titlebar | Resize | Close }; - -inline EWindowStyle operator|(EWindowStyle a, EWindowStyle b) -{ - using T = std::underlying_type_t; - return EWindowStyle(static_cast(a) | static_cast(b)); -} - -inline EWindowStyle operator&(EWindowStyle a, EWindowStyle b) -{ - using T = std::underlying_type_t; - return EWindowStyle(static_cast(a) & static_cast(b)); -} +ENABLE_BITWISE_ENUM(EWindowStyle) class IWindow { diff --git a/include/boo/graphicsdev/Metal.hpp b/include/boo/graphicsdev/Metal.hpp index 2a2744c..7820467 100644 --- a/include/boo/graphicsdev/Metal.hpp +++ b/include/boo/graphicsdev/Metal.hpp @@ -1,5 +1,11 @@ #ifndef GDEV_METAL_HPP #define GDEV_METAL_HPP +#ifdef __APPLE__ + +#include + +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 +#define BOO_HAS_METAL 1 #include "IGraphicsDataFactory.hpp" #include "IGraphicsCommandQueue.hpp" @@ -22,7 +28,7 @@ public: MetalDataFactory(IGraphicsContext* parent, MetalContext* ctx); ~MetalDataFactory() {} - Platform platform() const {return PlatformMetal;} + Platform platform() const {return Platform::Metal;} const char* platformName() const {return "Metal";} IGraphicsBufferS* newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count); @@ -59,4 +65,9 @@ public: } +#else +#define BOO_HAS_METAL 0 +#endif + +#endif // __APPLE__ #endif // GDEV_METAL_HPP diff --git a/lib/graphicsdev/Metal.mm b/lib/graphicsdev/Metal.mm index 007adb5..1a0521f 100644 --- a/lib/graphicsdev/Metal.mm +++ b/lib/graphicsdev/Metal.mm @@ -247,7 +247,7 @@ struct MetalVertexFormat : IVertexFormat for (size_t i=0 ; isemantic]; + stride += SEMANTIC_SIZE_TABLE[int(elemin->semantic)]; } m_vdesc = [MTLVertexDescriptor vertexDescriptor]; @@ -261,10 +261,10 @@ struct MetalVertexFormat : IVertexFormat { const VertexElementDescriptor* elemin = &elements[i]; MTLVertexAttributeDescriptor* attrDesc = m_vdesc.get().attributes[i]; - attrDesc.format = SEMANTIC_TYPE_TABLE[elemin->semantic]; + attrDesc.format = SEMANTIC_TYPE_TABLE[int(elemin->semantic)]; attrDesc.offset = offset; attrDesc.bufferIndex = 0; - offset += SEMANTIC_SIZE_TABLE[elemin->semantic]; + offset += SEMANTIC_SIZE_TABLE[int(elemin->semantic)]; } } }; @@ -302,9 +302,9 @@ class MetalShaderPipeline : public IShaderPipeline desc.get().vertexDescriptor = vtxFmt->m_vdesc.get(); desc.get().sampleCount = target->samples(); desc.get().colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm; - desc.get().colorAttachments[0].blendingEnabled = dstFac != BlendFactorZero; - desc.get().colorAttachments[0].sourceRGBBlendFactor = BLEND_FACTOR_TABLE[srcFac]; - desc.get().colorAttachments[0].destinationRGBBlendFactor = BLEND_FACTOR_TABLE[dstFac]; + desc.get().colorAttachments[0].blendingEnabled = dstFac != BlendFactor::Zero; + desc.get().colorAttachments[0].sourceRGBBlendFactor = BLEND_FACTOR_TABLE[int(srcFac)]; + desc.get().colorAttachments[0].destinationRGBBlendFactor = BLEND_FACTOR_TABLE[int(dstFac)]; desc.get().depthAttachmentPixelFormat = MTLPixelFormatDepth32Float; desc.get().inputPrimitiveTopology = MTLPrimitiveTopologyClassTriangle; NSError* err = nullptr; @@ -350,17 +350,17 @@ static id GetBufferGPUResource(const IGraphicsBuffer* buf, int idx) static id GetTextureGPUResource(const ITexture* tex, int idx) { - if (tex->type() == ITexture::TextureDynamic) + if (tex->type() == TextureType::Dynamic) { const MetalTextureD* ctex = static_cast(tex); return ctex->m_texs[idx].get(); } - else if (tex->type() == ITexture::TextureStatic) + else if (tex->type() == TextureType::Static) { const MetalTextureS* ctex = static_cast(tex); return ctex->m_tex.get(); } - else if (tex->type() == ITexture::TextureRender) + else if (tex->type() == TextureType::Render) { const MetalTextureR* ctex = static_cast(tex); return ctex->m_tex.get(); @@ -409,7 +409,7 @@ struct MetalShaderDataBinding : IShaderDataBinding struct MetalCommandQueue : IGraphicsCommandQueue { - Platform platform() const {return IGraphicsDataFactory::PlatformMetal;} + Platform platform() const {return IGraphicsDataFactory::Platform::Metal;} const char* platformName() const {return "Metal";} MetalContext* m_ctx; IWindow* m_parentWindow; @@ -484,9 +484,9 @@ struct MetalCommandQueue : IGraphicsCommandQueue MTLPrimitiveType m_primType = MTLPrimitiveTypeTriangle; void setDrawPrimitive(Primitive prim) { - if (prim == PrimitiveTriangles) + if (prim == Primitive::Triangles) m_primType = MTLPrimitiveTypeTriangle; - else if (prim == PrimitiveTriStrips) + else if (prim == Primitive::TriStrips) m_primType = MTLPrimitiveTypeTriangleStrip; } diff --git a/lib/inputdev/HIDDeviceIOKit.cpp b/lib/inputdev/HIDDeviceIOKit.cpp index 11e8d72..71cc9b8 100644 --- a/lib/inputdev/HIDDeviceIOKit.cpp +++ b/lib/inputdev/HIDDeviceIOKit.cpp @@ -226,12 +226,12 @@ public: { devImp.m_hidDev = this; std::unique_lock lk(m_initMutex); - DeviceToken::TDeviceType dType = token.getDeviceType(); - if (dType == DeviceToken::DEVTYPE_USB) + DeviceToken::DeviceType dType = token.getDeviceType(); + if (dType == DeviceToken::DeviceType::USB) m_thread = new std::thread(_threadProcUSBLL, this); - else if (dType == DeviceToken::DEVTYPE_BLUETOOTH) + else if (dType == DeviceToken::DeviceType::Bluetooth) m_thread = new std::thread(_threadProcBTLL, this); - else if (dType == DeviceToken::DEVTYPE_GENERICHID) + else if (dType == DeviceToken::DeviceType::GenericHID) m_thread = new std::thread(_threadProcHID, this); else { diff --git a/lib/inputdev/HIDListenerIOKit.cpp b/lib/inputdev/HIDListenerIOKit.cpp index 0e01dc9..9b35408 100644 --- a/lib/inputdev/HIDListenerIOKit.cpp +++ b/lib/inputdev/HIDListenerIOKit.cpp @@ -111,7 +111,7 @@ class HIDListenerIOKit : public IHIDListener getUSBStringDescriptor(dev, vstridx, vstr); getUSBStringDescriptor(dev, pstridx, pstr); - if (!listener->m_finder._insertToken(DeviceToken(DeviceToken::DEVTYPE_USB, + if (!listener->m_finder._insertToken(DeviceToken(DeviceToken::DeviceType::USB, vid, pid, vstr, pstr, devPath))) { /* Matched-insertion failed; see if generic HID interface is available */ diff --git a/lib/mac/ApplicationCocoa.mm b/lib/mac/ApplicationCocoa.mm index 46c3006..9e71041 100644 --- a/lib/mac/ApplicationCocoa.mm +++ b/lib/mac/ApplicationCocoa.mm @@ -116,7 +116,7 @@ public: EPlatformType getPlatformType() const { - return PLAT_COCOA; + return EPlatformType::Cocoa; } std::thread m_clientThread; @@ -192,8 +192,8 @@ int ApplicationRun(IApplication::EPlatformType platform, { if (!APP) { - if (platform != IApplication::PLAT_COCOA && - platform != IApplication::PLAT_AUTO) + if (platform != IApplication::EPlatformType::Cocoa && + platform != IApplication::EPlatformType::Auto) return 1; APP = new ApplicationCocoa(cb, uniqueName, friendlyName, pname, args); } diff --git a/lib/mac/WindowCocoa.mm b/lib/mac/WindowCocoa.mm index ba302ae..e4e67fc 100644 --- a/lib/mac/WindowCocoa.mm +++ b/lib/mac/WindowCocoa.mm @@ -169,7 +169,7 @@ public: NSOpenGLContext* m_lastCtx = nullptr; GraphicsContextCocoaGL(EGraphicsAPI api, IWindow* parentWindow, NSOpenGLContext* lastGLCtx) - : GraphicsContextCocoa(api, PF_RGBA8, parentWindow), + : GraphicsContextCocoa(api, EPixelFormat::RGBA8, parentWindow), m_lastCtx(lastGLCtx) { m_dataFactory = new GLDataFactory(this); @@ -200,7 +200,7 @@ public: void setPixelFormat(EPixelFormat pf) { - if (pf > PF_RGBAF32_Z24) + if (pf > EPixelFormat::RGBAF32_Z24) return; m_pf = pf; } @@ -240,7 +240,7 @@ public: { if (!m_mainCtx) { - NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[m_pf]]; + NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[int(m_pf)]]; m_mainCtx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:[m_nsContext openGLContext]]; [nspf release]; if (!m_mainCtx) @@ -254,7 +254,7 @@ public: { if (!m_loadCtx) { - NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[m_pf]]; + NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[int(m_pf)]]; m_loadCtx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:[m_nsContext openGLContext]]; [nspf release]; if (!m_loadCtx) @@ -274,7 +274,7 @@ public: IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api, IWindow* parentWindow, NSOpenGLContext* lastGLCtx) { - if (api != IGraphicsContext::API_OPENGL_3_3 && api != IGraphicsContext::API_OPENGL_4_2) + if (api != IGraphicsContext::EGraphicsAPI::OpenGL3_3 && api != IGraphicsContext::EGraphicsAPI::OpenGL4_2) return NULL; /* Create temporary context to query GL version */ @@ -300,9 +300,9 @@ IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api, return NULL; if (major > 4 || (major == 4 && minor >= 2)) - api = IGraphicsContext::API_OPENGL_4_2; + api = IGraphicsContext::EGraphicsAPI::OpenGL4_2; else if (major == 3 && minor >= 3) - if (api == IGraphicsContext::API_OPENGL_4_2) + if (api == IGraphicsContext::EGraphicsAPI::OpenGL4_2) return NULL; return new GraphicsContextCocoaGL(api, parentWindow, lastGLCtx); @@ -321,7 +321,7 @@ public: GraphicsContextCocoaMetal(EGraphicsAPI api, IWindow* parentWindow, MetalContext* metalCtx) - : GraphicsContextCocoa(api, PF_RGBA8, parentWindow), + : GraphicsContextCocoa(api, EPixelFormat::RGBA8, parentWindow), m_metalCtx(metalCtx) { m_dataFactory = new MetalDataFactory(this, metalCtx); @@ -352,7 +352,7 @@ public: void setPixelFormat(EPixelFormat pf) { - if (pf > PF_RGBAF32_Z24) + if (pf > EPixelFormat::RGBAF32_Z24) return; m_pf = pf; } @@ -409,7 +409,7 @@ IGraphicsContext* _GraphicsContextCocoaMetalNew(IGraphicsContext::EGraphicsAPI a IWindow* parentWindow, MetalContext* metalCtx) { - if (api != IGraphicsContext::API_METAL) + if (api != IGraphicsContext::EGraphicsAPI::Metal) return nullptr; return new GraphicsContextCocoaMetal(api, parentWindow, metalCtx); } @@ -428,28 +428,28 @@ IGraphicsContext* _GraphicsContextCocoaMetalNew(IGraphicsContext::EGraphicsAPI a static inline boo::EModifierKey getMod(NSUInteger flags) { - int ret = boo::MKEY_NONE; + boo::EModifierKey ret = boo::EModifierKey::None; if (flags & NSControlKeyMask) - ret |= boo::MKEY_CTRL; + ret |= boo::EModifierKey::Ctrl; if (flags & NSAlternateKeyMask) - ret |= boo::MKEY_ALT; + ret |= boo::EModifierKey::Alt; if (flags & NSShiftKeyMask) - ret |= boo::MKEY_SHIFT; + ret |= boo::EModifierKey::Shift; if (flags & NSCommandKeyMask) - ret |= boo::MKEY_COMMAND; - return static_cast(ret); + ret |= boo::EModifierKey::Command; + return ret; } static inline boo::EMouseButton getButton(NSEvent* event) { NSInteger buttonNumber = event.buttonNumber; if (buttonNumber == 3) - return boo::BUTTON_MIDDLE; + return boo::EMouseButton::Middle; else if (buttonNumber == 4) - return boo::BUTTON_AUX1; + return boo::EMouseButton::Aux1; else if (buttonNumber == 5) - return boo::BUTTON_AUX2; - return boo::BUTTON_NONE; + return boo::EMouseButton::Aux2; + return boo::EMouseButton::None; } - (void)mouseDown:(NSEvent*)theEvent @@ -465,7 +465,7 @@ static inline boo::EMouseButton getButton(NSEvent* event) {(unsigned)liw.x, (unsigned)liw.y}, {(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} }; - booContext->m_callback->mouseDown(coord, boo::BUTTON_PRIMARY, + booContext->m_callback->mouseDown(coord, boo::EMouseButton::Primary, getMod([theEvent modifierFlags])); } @@ -482,7 +482,7 @@ static inline boo::EMouseButton getButton(NSEvent* event) {(unsigned)liw.x, (unsigned)liw.y}, {(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} }; - booContext->m_callback->mouseUp(coord, boo::BUTTON_PRIMARY, + booContext->m_callback->mouseUp(coord, boo::EMouseButton::Primary, getMod([theEvent modifierFlags])); } @@ -499,7 +499,7 @@ static inline boo::EMouseButton getButton(NSEvent* event) {(unsigned)liw.x, (unsigned)liw.y}, {(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} }; - booContext->m_callback->mouseDown(coord, boo::BUTTON_SECONDARY, + booContext->m_callback->mouseDown(coord, boo::EMouseButton::Secondary, getMod([theEvent modifierFlags])); } @@ -516,7 +516,7 @@ static inline boo::EMouseButton getButton(NSEvent* event) {(unsigned)liw.x, (unsigned)liw.y}, {(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} }; - booContext->m_callback->mouseUp(coord, boo::BUTTON_SECONDARY, + booContext->m_callback->mouseUp(coord, boo::EMouseButton::Secondary, getMod([theEvent modifierFlags])); } @@ -525,7 +525,7 @@ static inline boo::EMouseButton getButton(NSEvent* event) if (!booContext->m_callback) return; boo::EMouseButton button = getButton(theEvent); - if (!button) + if (button == boo::EMouseButton::None) return; NSPoint liw = [parentView convertPoint:[theEvent locationInWindow] fromView:nil]; float pixelFactor = [[parentView window] backingScaleFactor]; @@ -544,7 +544,7 @@ static inline boo::EMouseButton getButton(NSEvent* event) if (!booContext->m_callback) return; boo::EMouseButton button = getButton(theEvent); - if (!button) + if (button == boo::EMouseButton::None) return; NSPoint liw = [parentView convertPoint:[theEvent locationInWindow] fromView:nil]; float pixelFactor = [[parentView window] backingScaleFactor]; @@ -728,55 +728,55 @@ static boo::ESpecialKey translateKeycode(short code) { switch (code) { case kVK_F1: - return boo::KEY_F1; + return boo::ESpecialKey::F1; case kVK_F2: - return boo::KEY_F2; + return boo::ESpecialKey::F2; case kVK_F3: - return boo::KEY_F3; + return boo::ESpecialKey::F3; case kVK_F4: - return boo::KEY_F4; + return boo::ESpecialKey::F4; case kVK_F5: - return boo::KEY_F5; + return boo::ESpecialKey::F5; case kVK_F6: - return boo::KEY_F6; + return boo::ESpecialKey::F6; case kVK_F7: - return boo::KEY_F7; + return boo::ESpecialKey::F7; case kVK_F8: - return boo::KEY_F8; + return boo::ESpecialKey::F8; case kVK_F9: - return boo::KEY_F9; + return boo::ESpecialKey::F9; case kVK_F10: - return boo::KEY_F10; + return boo::ESpecialKey::F10; case kVK_F11: - return boo::KEY_F11; + return boo::ESpecialKey::F11; case kVK_F12: - return boo::KEY_F12; + return boo::ESpecialKey::F12; case kVK_Escape: - return boo::KEY_ESC; + return boo::ESpecialKey::Esc; case kVK_Return: - return boo::KEY_ENTER; + return boo::ESpecialKey::Enter; case kVK_Delete: - return boo::KEY_BACKSPACE; + return boo::ESpecialKey::Backspace; case kVK_ForwardDelete: - return boo::KEY_DELETE; + return boo::ESpecialKey::Delete; case kVK_Home: - return boo::KEY_HOME; + return boo::ESpecialKey::Home; case kVK_End: - return boo::KEY_END; + return boo::ESpecialKey::End; case kVK_PageUp: - return boo::KEY_PGUP; + return boo::ESpecialKey::PgUp; case kVK_PageDown: - return boo::KEY_PGDOWN; + return boo::ESpecialKey::PgDown; case kVK_LeftArrow: - return boo::KEY_LEFT; + return boo::ESpecialKey::Left; case kVK_RightArrow: - return boo::KEY_RIGHT; + return boo::ESpecialKey::Right; case kVK_UpArrow: - return boo::KEY_UP; + return boo::ESpecialKey::Up; case kVK_DownArrow: - return boo::KEY_DOWN; + return boo::ESpecialKey::Down; default: - return boo::KEY_NONE; + return boo::ESpecialKey::None; } } @@ -821,23 +821,23 @@ static boo::ESpecialKey translateKeycode(short code) NSUInteger downFlags = changedFlags & modFlags; if (downFlags & NSControlKeyMask) - booContext->m_callback->modKeyDown(boo::MKEY_CTRL, false); + booContext->m_callback->modKeyDown(boo::EModifierKey::Ctrl, false); if (downFlags & NSAlternateKeyMask) - booContext->m_callback->modKeyDown(boo::MKEY_ALT, false); + booContext->m_callback->modKeyDown(boo::EModifierKey::Alt, false); if (downFlags & NSShiftKeyMask) - booContext->m_callback->modKeyDown(boo::MKEY_SHIFT, false); + booContext->m_callback->modKeyDown(boo::EModifierKey::Shift, false); if (downFlags & NSCommandKeyMask) - booContext->m_callback->modKeyDown(boo::MKEY_COMMAND, false); + booContext->m_callback->modKeyDown(boo::EModifierKey::Command, false); NSUInteger upFlags = changedFlags & ~modFlags; if (upFlags & NSControlKeyMask) - booContext->m_callback->modKeyUp(boo::MKEY_CTRL); + booContext->m_callback->modKeyUp(boo::EModifierKey::Ctrl); if (upFlags & NSAlternateKeyMask) - booContext->m_callback->modKeyUp(boo::MKEY_ALT); + booContext->m_callback->modKeyUp(boo::EModifierKey::Alt); if (upFlags & NSShiftKeyMask) - booContext->m_callback->modKeyUp(boo::MKEY_SHIFT); + booContext->m_callback->modKeyUp(boo::EModifierKey::Shift); if (upFlags & NSCommandKeyMask) - booContext->m_callback->modKeyUp(boo::MKEY_COMMAND); + booContext->m_callback->modKeyUp(boo::EModifierKey::Command); lastModifiers = modFlags; } @@ -860,7 +860,7 @@ static boo::ESpecialKey translateKeycode(short code) { resp = [[BooCocoaResponder alloc] initWithBooContext:bctx View:self]; boo::IGraphicsContext::EPixelFormat pf = bctx->getPixelFormat(); - NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[pf]]; + NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[int(pf)]]; self = [self initWithFrame:NSMakeRect(0, 0, 100, 100) pixelFormat:nspf]; if (bctx->m_lastCtx) { @@ -965,10 +965,10 @@ public: m_nsWindow = [[WindowCocoaInternal alloc] initWithBooWindow:this title:title]; #if BOO_HAS_METAL if (metalCtx->m_dev) - m_gfxCtx = _GraphicsContextCocoaMetalNew(IGraphicsContext::API_METAL, this, metalCtx); + m_gfxCtx = _GraphicsContextCocoaMetalNew(IGraphicsContext::EGraphicsAPI::Metal, this, metalCtx); else #endif - m_gfxCtx = _GraphicsContextCocoaGLNew(IGraphicsContext::API_OPENGL_3_3, this, lastGLCtx); + m_gfxCtx = _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, lastGLCtx); m_gfxCtx->initializeContext(); }); } @@ -1089,24 +1089,24 @@ public: ETouchType getTouchType() const { - return TOUCH_TRACKPAD; + return ETouchType::Trackpad; } void setStyle(EWindowStyle style) { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 - if (style & STYLE_TITLEBAR) + if ((style & EWindowStyle::Titlebar) != EWindowStyle::None) m_nsWindow.titleVisibility = NSWindowTitleVisible; else m_nsWindow.titleVisibility = NSWindowTitleHidden; #endif - if (style & STYLE_CLOSE) + if ((style & EWindowStyle::Close) != EWindowStyle::None) m_nsWindow.styleMask |= NSClosableWindowMask; else m_nsWindow.styleMask &= ~NSClosableWindowMask; - if (style & STYLE_RESIZE) + if ((style & EWindowStyle::Resize) != EWindowStyle::None) m_nsWindow.styleMask |= NSResizableWindowMask; else m_nsWindow.styleMask &= ~NSResizableWindowMask; @@ -1114,15 +1114,15 @@ public: EWindowStyle getStyle() const { - int retval = 0; + EWindowStyle retval = EWindowStyle::None; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 - retval |= m_nsWindow.titleVisibility == NSWindowTitleVisible ? STYLE_TITLEBAR : 0; + retval |= m_nsWindow.titleVisibility == NSWindowTitleVisible ? EWindowStyle::Titlebar : EWindowStyle::None; #else - retval |= STYLE_TITLEBAR; + retval |= EWindowStyle::Titlebar; #endif - retval |= (m_nsWindow.styleMask & NSClosableWindowMask) ? STYLE_CLOSE : 0; - retval |= (m_nsWindow.styleMask & NSResizableWindowMask) ? STYLE_RESIZE: 0; - return EWindowStyle(retval); + retval |= (m_nsWindow.styleMask & NSClosableWindowMask) ? EWindowStyle::Close : EWindowStyle::None; + retval |= (m_nsWindow.styleMask & NSResizableWindowMask) ? EWindowStyle::Resize: EWindowStyle::None; + return retval; } void waitForRetrace() diff --git a/test/main.cpp b/test/main.cpp index 47da89b..d0c00f1 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -339,8 +339,8 @@ struct TestApplicationCallback : IApplicationCallback pipeline = d3dF->newShaderPipeline(VS, PS, vsCompile, psCompile, cachedPipeline, vfmt, BlendFactorOne, BlendFactorZero, true, true, false); } -#elif __APPLE__ - else if (factory->platform() == IGraphicsDataFactory::PlatformMetal) +#elif BOO_HAS_METAL + else if (factory->platform() == IGraphicsDataFactory::Platform::Metal) { MetalDataFactory* metalF = dynamic_cast(factory); @@ -368,12 +368,10 @@ struct TestApplicationCallback : IApplicationCallback "}\n"; pipeline = metalF->newShaderPipeline(VS, FS, vfmt, self->m_renderTarget, - BlendFactorOne, BlendFactorZero, true, true, false); + BlendFactor::One, BlendFactor::Zero, true, true, false); } #endif - - /* Make shader data binding */ self->m_binding = factory->newShaderDataBinding(pipeline, vfmt, vbo, nullptr, 0, nullptr, 1, &texture); @@ -388,12 +386,10 @@ struct TestApplicationCallback : IApplicationCallback /* Wait for exit */ while (self->running) { - { - std::unique_lock lk(self->m_mt); - self->m_cv.wait(lk); - if (!self->running) - break; - } + std::unique_lock lk(self->m_mt); + self->m_cv.wait(lk); + if (!self->running) + break; } }