Branimir Karadžić 9 yıl önce
ebeveyn
işleme
18965f41f7
3 değiştirilmiş dosya ile 32 ekleme ve 26 silme
  1. 2 1
      src/glcontext_eagl.mm
  2. 29 24
      src/glcontext_nsgl.mm
  3. 1 1
      src/renderer_d3d12.cpp

+ 2 - 1
src/glcontext_eagl.mm

@@ -122,7 +122,8 @@ namespace bgfx { namespace gl
 
 		void resize(GLint _width, GLint _height)
 		{
-			if(m_width == _width && m_height == _height)
+			if (m_width  == _width
+			&&  m_height == _height)
 			{
 				return;
 			}

+ 29 - 24
src/glcontext_nsgl.mm

@@ -101,24 +101,24 @@ namespace bgfx { namespace gl
 			NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
 
 			[pixelFormat release];
-            // GLFW creates a helper contentView that handles things like keyboard and drag and
-            // drop events. We don't want to clobber that view if it exists. Instead we just
-            // add ourselves as a subview and make the view resize automatically.
-            NSView *contentView = [nsWindow contentView];
-            if( contentView != nil )
-            {
-                [glView setAutoresizingMask:( NSViewHeightSizable |
-                                              NSViewWidthSizable |
-                                              NSViewMinXMargin |
-                                              NSViewMaxXMargin |
-                                              NSViewMinYMargin |
-                                              NSViewMaxYMargin )];
-                [contentView addSubview:glView];
-            }
-            else
-            {
-                [nsWindow setContentView:glView];
-            }
+			// GLFW creates a helper contentView that handles things like keyboard and drag and
+			// drop events. We don't want to clobber that view if it exists. Instead we just
+			// add ourselves as a subview and make the view resize automatically.
+			NSView *contentView = [nsWindow contentView];
+			if (nil != contentView)
+			{
+				[glView setAutoresizingMask:( NSViewHeightSizable |
+						NSViewWidthSizable |
+						NSViewMinXMargin |
+						NSViewMaxXMargin |
+						NSViewMinYMargin |
+						NSViewMaxYMargin )];
+				[contentView addSubview:glView];
+			}
+			else
+			{
+				[nsWindow setContentView:glView];
+			}
 
 			NSOpenGLContext* glContext = [glView openGLContext];
 			BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
@@ -127,11 +127,11 @@ namespace bgfx { namespace gl
 			GLint interval = 0;
 			[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
 
-            // When initializing NSOpenGLView programatically (as we are), this sometimes doesn't
-            // get hooked up properly (especially when there are existing window elements). This ensures
-            // we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when
-            // trying to glClear() for the first time.
-            [glContext setView:glView];
+			// When initializing NSOpenGLView programatically (as we are), this sometimes doesn't
+			// get hooked up properly (especially when there are existing window elements). This ensures
+			// we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when
+			// trying to glClear() for the first time.
+			[glContext setView:glView];
 
 			m_view    = glView;
 			m_context = glContext;
@@ -226,7 +226,12 @@ namespace bgfx { namespace gl
 	{
 		BX_TRACE("Import:");
 #	define GL_EXTENSION(_optional, _proto, _func, _import) \
-				{ \
+				{ \            // When initializing NSOpenGLView programatically (as we are), this sometimes doesn't
+            // get hooked up properly (especially when there are existing window elements). This ensures
+            // we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when
+            // trying to glClear() for the first time.
+            [glContext setView:glView];
+
 					if (_func == NULL) \
 					{ \
 						_func = (_proto)bx::dlsym(s_opengl, #_import); \

+ 1 - 1
src/renderer_d3d12.cpp

@@ -4247,7 +4247,7 @@ data.NumQualityLevels = 0;
 					m_uavd.Texture2D.PlaneSlice = 0;
 				}
 
-				if( m_type==TextureCube )
+				if (TextureCube == m_type)
 				{
 					m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
 					m_uavd.Texture2DArray.MipSlice   = 0;