Added HiDPI reset flag.

This commit is contained in:
Branimir Karadžić 2015-08-17 16:43:56 -07:00
parent f4143b3064
commit 77b3c3843e
3 changed files with 17 additions and 8 deletions

View File

@ -233,6 +233,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv)
|| setOrToggle(s_reset, "flush", BGFX_RESET_FLUSH_AFTER_RENDER, 1, _argc, _argv)
|| setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv)
|| setOrToggle(s_reset, "hidpi", BGFX_RESET_HIDPI, 1, _argc, _argv)
)
{
return 0;
@ -297,6 +298,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{ entry::Key::F7, entry::Modifier::None, 1, NULL, "graphics vsync" },
{ entry::Key::F8, entry::Modifier::None, 1, NULL, "graphics msaa" },
{ entry::Key::F9, entry::Modifier::None, 1, NULL, "graphics flush" },
{ entry::Key::F10, entry::Modifier::None, 1, NULL, "graphics hidpi" },
{ entry::Key::Print, entry::Modifier::None, 1, NULL, "graphics screenshot" },
INPUT_BINDING_END

View File

@ -338,6 +338,7 @@
#define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU.
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) //!< This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
#define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer.
#define BGFX_RESET_HIDPI UINT32_C(0x00010000) //!< Enable HiDPI rendering.
///
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001) //!< Texture compare less equal mode is supported.
@ -355,15 +356,16 @@
#define BGFX_CAPS_HMD UINT64_C(0x0000000000001000) //!< Head Mounted Display is available.
#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000002000) //!< 32-bit indices are supported.
#define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000004000) //!< Draw indirect is supported.
#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000008000) //!< HiDPI rendering is supported.
///
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT8_C(0x00) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR UINT8_C(0x01) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB UINT8_C(0x02) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_EMULATED UINT8_C(0x04) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT8_C(0x08) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_IMAGE UINT8_C(0x10) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER UINT8_C(0x20) //!<
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT8_C(0x00) //!< Texture format is not supported.
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR UINT8_C(0x01) //!< Texture format is supported.
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB UINT8_C(0x02) //!< Texture as sRGB format is supported.
#define BGFX_CAPS_FORMAT_TEXTURE_EMULATED UINT8_C(0x04) //!< Texture format is emulated.
#define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT8_C(0x08) //!< Texture format can be used from vertex shader.
#define BGFX_CAPS_FORMAT_TEXTURE_IMAGE UINT8_C(0x10) //!< Texture format can be used as image from compute shader.
#define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER UINT8_C(0x20) //!< Texture format can be used as frame buffer.
///
#define BGFX_VIEW_NONE UINT8_C(0x00) //!<

View File

@ -101,7 +101,6 @@ namespace bgfx { namespace gl
NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
[pixelFormat release];
// [glView setWantsBestResolutionOpenGLSurface:YES];
[nsWindow setContentView:glView];
NSOpenGLContext* glContext = [glView openGLContext];
@ -115,6 +114,8 @@ namespace bgfx { namespace gl
m_context = glContext;
}
// float x = [nsWindow backingScaleFactor];
import();
}
@ -135,6 +136,10 @@ namespace bgfx { namespace gl
{
BX_UNUSED(_width, _height);
bool hidpi = !!(_flags&BGFX_RESET_HIDPI);
NSOpenGLView* glView = (NSOpenGLView*)m_view;
[glView setWantsBestResolutionOpenGLSurface:hidpi];
bool vsync = !!(_flags&BGFX_RESET_VSYNC);
GLint interval = vsync ? 1 : 0;
NSOpenGLContext* glContext = (NSOpenGLContext*)m_context;