Forráskód Böngészése

Minor fixes. (#1390)

* Moved greedy generic release(Ty) below release(const Memory*).

* OGL: Resolve all color attachments, not only the first one.
Dario Manesku 7 éve
szülő
commit
2d1c2987ec
2 módosított fájl, 45 hozzáadás és 31 törlés
  1. 9 9
      src/bgfx_p.h
  2. 36 22
      src/renderer_gl.cpp

+ 9 - 9
src/bgfx_p.h

@@ -454,6 +454,15 @@ namespace bgfx
 		}
 	};
 
+	void setGraphicsDebuggerPresent(bool _present);
+	bool isGraphicsDebuggerPresent();
+	void release(const Memory* _mem);
+	const char* getAttribName(Attrib::Enum _attr);
+	void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height);
+	TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer);
+	const char* getName(TextureFormat::Enum _fmt);
+	const char* getName(UniformHandle _handle);
+
 	template<typename Ty>
 	inline void release(Ty)
 	{
@@ -465,15 +474,6 @@ namespace bgfx
 		release( (const Memory*)_mem);
 	}
 
-	void setGraphicsDebuggerPresent(bool _present);
-	bool isGraphicsDebuggerPresent();
-	void release(const Memory* _mem);
-	const char* getAttribName(Attrib::Enum _attr);
-	void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height);
-	TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer);
-	const char* getName(TextureFormat::Enum _fmt);
-	const char* getName(UniformHandle _handle);
-
 	inline uint32_t castfu(float _value)
 	{
 		union {	float fl; uint32_t ui; } un;

+ 36 - 22
src/renderer_gl.cpp

@@ -6343,36 +6343,50 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
 	{
 		if (0 != m_fbo[1])
 		{
-			GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) );
-			GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0) );
-			GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[1]) );
-			GL_CHECK(glBlitFramebuffer(0
-				, 0
-				, m_width
-				, m_height
-				, 0
-				, 0
-				, m_width
-				, m_height
-				, GL_COLOR_BUFFER_BIT
-				, GL_LINEAR
-				) );
-			GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) );
-			GL_CHECK(glReadBuffer(GL_NONE) );
-			GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) );
-		}
-
-		if (0 < m_numTh)
-		{
+			uint32_t colorIdx = 0;
 			for (uint32_t ii = 0; ii < m_numTh; ++ii)
 			{
 				TextureHandle handle = m_attachment[ii].handle;
 				if (isValid(handle) )
 				{
 					const TextureGL& texture = s_renderGL->m_textures[handle.idx];
-					texture.resolve();
+
+					bimg::TextureFormat::Enum format = bimg::TextureFormat::Enum(texture.m_textureFormat);
+					if (!bimg::isDepth(format) )
+					{
+						GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) );
+						GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[1]) );
+						GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0 + colorIdx) );
+						GL_CHECK(glDrawBuffer(GL_COLOR_ATTACHMENT0 + colorIdx) );
+						colorIdx++;
+						GL_CHECK(glBlitFramebuffer(0
+							, 0
+							, m_width
+							, m_height
+							, 0
+							, 0
+							, m_width
+							, m_height
+							, GL_COLOR_BUFFER_BIT
+							, GL_LINEAR
+							) );
+					}
 				}
 			}
+
+			GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) );
+			GL_CHECK(glReadBuffer(GL_NONE) );
+			GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) );
+		}
+
+		for (uint32_t ii = 0; ii < m_numTh; ++ii)
+		{
+			TextureHandle handle = m_attachment[ii].handle;
+			if (isValid(handle) )
+			{
+				const TextureGL& texture = s_renderGL->m_textures[handle.idx];
+				texture.resolve();
+			}
 		}
 	}