Branimir Karadžić преди 7 години
родител
ревизия
9eaa42adc8
променени са 10 файла, в които са добавени 26 реда и са изтрити 17 реда
  1. 4 1
      src/bgfx.cpp
  2. 8 2
      src/bgfx_p.h
  3. 2 2
      src/dxgi.cpp
  4. 2 2
      src/renderer_d3d11.cpp
  5. 2 2
      src/renderer_d3d12.cpp
  6. 2 2
      src/renderer_d3d9.cpp
  7. 2 2
      src/renderer_gl.cpp
  8. 2 2
      src/renderer_mtl.mm
  9. 1 1
      src/renderer_noop.cpp
  10. 1 1
      src/renderer_vk.cpp

+ 4 - 1
src/bgfx.cpp

@@ -2615,7 +2615,10 @@ namespace bgfx
 					uint8_t numMips;
 					_cmdbuf.read(numMips);
 
-					m_renderCtx->resizeTexture(handle, width, height, numMips);
+					uint16_t numLayers;
+					_cmdbuf.read(numLayers);
+
+					m_renderCtx->resizeTexture(handle, width, height, numMips, numLayers);
 				}
 				break;
 

+ 8 - 2
src/bgfx_p.h

@@ -2654,7 +2654,7 @@ namespace bgfx
 		virtual void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) = 0;
 		virtual void updateTextureEnd() = 0;
 		virtual void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) = 0;
-		virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) = 0;
+		virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) = 0;
 		virtual void overrideInternal(TextureHandle _handle, uintptr_t _ptr) = 0;
 		virtual uintptr_t getInternal(TextureHandle _handle) = 0;
 		virtual void destroyTexture(TextureHandle _handle) = 0;
@@ -2770,6 +2770,7 @@ namespace bgfx
 						, uint16_t(m_init.resolution.width)
 						, uint16_t(m_init.resolution.height)
 						, textureRef.m_numMips
+						, textureRef.m_numLayers
 						);
 					m_init.resolution.reset |= BGFX_RESET_INTERNAL_FORCE;
 				}
@@ -3912,6 +3913,7 @@ namespace bgfx
 				, _info->format
 				, _info->storageSize
 				, imageContainer.m_numMips
+				, imageContainer.m_numLayers
 				, 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_DIRECT_ACCESS)
 				, _immutable
 				, 0 != (_flags & BGFX_TEXTURE_RT_MASK)
@@ -3992,7 +3994,7 @@ namespace bgfx
 			return m_frames + 2;
 		}
 
-		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips)
+		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers)
 		{
 			const TextureRef& textureRef = m_textureRef[_handle.idx];
 			BX_CHECK(BackbufferRatio::Count != textureRef.m_bbRatio, "");
@@ -4012,6 +4014,7 @@ namespace bgfx
 			cmdbuf.write(_width);
 			cmdbuf.write(_height);
 			cmdbuf.write(_numMips);
+			cmdbuf.write(_numLayers);
 		}
 
 		void textureTakeOwnership(TextureHandle _handle)
@@ -4706,6 +4709,7 @@ namespace bgfx
 				, TextureFormat::Enum _format
 				, uint32_t _storageSize
 				, uint8_t _numMips
+				, uint16_t _numLayers
 				, bool _ptrPending
 				, bool _immutable
 				, bool _rt
@@ -4717,6 +4721,7 @@ namespace bgfx
 				m_bbRatio     = uint8_t(_ratio);
 				m_format      = uint8_t(_format);
 				m_numMips     = _numMips;
+				m_numLayers   = _numLayers;
 				m_owned       = false;
 				m_immutable   = _immutable;
 				m_rt          = _rt;
@@ -4729,6 +4734,7 @@ namespace bgfx
 			uint8_t  m_bbRatio;
 			uint8_t  m_format;
 			uint8_t  m_numMips;
+			uint16_t m_numLayers;
 			bool     m_owned;
 			bool     m_immutable;
 			bool     m_rt;

+ 2 - 2
src/dxgi.cpp

@@ -358,7 +358,7 @@ namespace bgfx
 			DX_CHECK(m_adapter->GetParent(IID_IDXGIFactory2, (void**)&m_factory) );
 		}
 
-		DX_RELEASE(dxgiDevice, 1);
+		DX_RELEASE(dxgiDevice, 2);
 	}
 
 	static const GUID IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } };
@@ -411,7 +411,7 @@ namespace bgfx
 			if (NULL != dxgiDevice1)
 			{
 				dxgiDevice1->SetMaximumFrameLatency(_scd.maxFrameLatency);
-				DX_RELEASE(dxgiDevice1, 1);
+				DX_RELEASE(dxgiDevice1, 3);
 			}
 		}
 #else

+ 2 - 2
src/renderer_d3d11.cpp

@@ -1772,7 +1772,7 @@ namespace bgfx { namespace d3d11
 			m_deviceCtx->Unmap(texture.m_ptr, _mip);
 		}
 
-		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override
+		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override
 		{
 			TextureD3D11& texture = m_textures[_handle.idx];
 
@@ -1787,7 +1787,7 @@ namespace bgfx { namespace d3d11
 			tc.m_width     = _width;
 			tc.m_height    = _height;
 			tc.m_depth     = 0;
-			tc.m_numLayers = 1;
+			tc.m_numLayers = _numLayers;
 			tc.m_numMips   = _numMips;
 			tc.m_format    = TextureFormat::Enum(texture.m_requestedFormat);
 			tc.m_cubeMap   = false;

+ 2 - 2
src/renderer_d3d12.cpp

@@ -1630,7 +1630,7 @@ namespace bgfx { namespace d3d12
 			DX_RELEASE(readback, 0);
 		}
 
-		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override
+		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override
 		{
 			TextureD3D12& texture = m_textures[_handle.idx];
 
@@ -1645,7 +1645,7 @@ namespace bgfx { namespace d3d12
 			tc.m_width     = _width;
 			tc.m_height    = _height;
 			tc.m_depth     = 0;
-			tc.m_numLayers = 1;
+			tc.m_numLayers = _numLayers;
 			tc.m_numMips   = _numMips;
 			tc.m_format    = TextureFormat::Enum(texture.m_requestedFormat);
 			tc.m_cubeMap   = false;

+ 2 - 2
src/renderer_d3d9.cpp

@@ -1091,7 +1091,7 @@ namespace bgfx { namespace d3d9
 			DX_CHECK(texture.m_texture2d->UnlockRect(_mip) );
 		}
 
-		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override
+		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override
 		{
 			TextureD3D9& texture = m_textures[_handle.idx];
 
@@ -1106,7 +1106,7 @@ namespace bgfx { namespace d3d9
 			tc.m_width     = _width;
 			tc.m_height    = _height;
 			tc.m_depth     = 0;
-			tc.m_numLayers = 1;
+			tc.m_numLayers = _numLayers;
 			tc.m_numMips   = _numMips;
 			tc.m_format    = TextureFormat::Enum(texture.m_requestedFormat);
 			tc.m_cubeMap   = false;

+ 2 - 2
src/renderer_gl.cpp

@@ -2818,7 +2818,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
 			}
 		}
 
-		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override
+		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override
 		{
 			TextureGL& texture = m_textures[_handle.idx];
 
@@ -2833,7 +2833,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
 			tc.m_width     = _width;
 			tc.m_height    = _height;
 			tc.m_depth     = 0;
-			tc.m_numLayers = 1;
+			tc.m_numLayers = _numLayers;
 			tc.m_numMips   = _numMips;
 			tc.m_format    = TextureFormat::Enum(texture.m_requestedFormat);
 			tc.m_cubeMap   = false;

+ 2 - 2
src/renderer_mtl.mm

@@ -872,7 +872,7 @@ namespace bgfx { namespace mtl
 			texture.m_ptr.getBytes(_data, srcWidth*bpp/8, 0, region, _mip, 0);
 		}
 
-		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override
+		void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override
 		{
 			TextureMtl& texture = m_textures[_handle.idx];
 
@@ -887,7 +887,7 @@ namespace bgfx { namespace mtl
 			tc.m_width     = _width;
 			tc.m_height    = _height;
 			tc.m_depth     = 0;
-			tc.m_numLayers = 1;
+			tc.m_numLayers = _numLayers;
 			tc.m_numMips   = _numMips;
 			tc.m_format    = TextureFormat::Enum(texture.m_requestedFormat);
 			tc.m_cubeMap   = false;

+ 1 - 1
src/renderer_noop.cpp

@@ -176,7 +176,7 @@ namespace bgfx { namespace noop
 		{
 		}
 
-		void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) override
+		void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/, uint16_t /*_numLayers*/) override
 		{
 		}
 

+ 1 - 1
src/renderer_vk.cpp

@@ -2082,7 +2082,7 @@ VK_IMPORT_DEVICE
 		{
 		}
 
-		void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) override
+		void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/, uint16_t /*_numLayers*/) override
 		{
 		}