Browse Source

Minor code style fixes

BearishSun 9 năm trước cách đây
mục cha
commit
3fb5d94621

+ 1 - 1
Source/BansheeCore/Include/BsRenderAPI.h

@@ -492,7 +492,7 @@ namespace BansheeEngine
 		 *
 		 * @note	Thread safe.
 		 */
-		const RenderAPICapabilities* getCapabilities() const;
+		const RenderAPICapabilities& getCapabilities() const;
 
 		/** Returns information about the driver version. */
 		virtual const DriverVersion& getDriverVersion() const;

+ 3 - 3
Source/BansheeCore/Source/BsGpuProgram.cpp

@@ -27,10 +27,10 @@ namespace BansheeEngine
 		if (!isRequiredCapabilitiesSupported())
 			return false;
 
-		RenderAPICore* rs = BansheeEngine::RenderAPICore::instancePtr();
-		String profile = rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(getProperties().getProfile());
+		RenderAPICore* rapi = RenderAPICore::instancePtr();
+		String profile = rapi->getCapabilities().gpuProgProfileToRSSpecificProfile(getProperties().getProfile());
 
-		return rs->getCapabilities()->isShaderProfileSupported(profile);
+		return rapi->getCapabilities().isShaderProfileSupported(profile);
     }
 
 	bool GpuProgramCore::isRequiredCapabilitiesSupported() const

+ 2 - 2
Source/BansheeCore/Source/BsRenderAPI.cpp

@@ -256,9 +256,9 @@ namespace BansheeEngine
 		mActiveRenderTarget = nullptr;
 	}
 
-	const RenderAPICapabilities* RenderAPICore::getCapabilities(void) const 
+	const RenderAPICapabilities& RenderAPICore::getCapabilities(void) const 
 	{ 
-		return mCurrentCapabilities; 
+		return *mCurrentCapabilities; 
 	}
 
 	const DriverVersion& RenderAPICore::getDriverVersion(void) const 

+ 3 - 3
Source/BansheeD3D11RenderAPI/Source/BsD3D11GpuProgram.cpp

@@ -43,8 +43,8 @@ namespace BansheeEngine
 			return;
 		}
 
-		D3D11RenderAPI* rs = static_cast<D3D11RenderAPI*>(RenderAPICore::instancePtr());
-		String hlslProfile = rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(mProperties.getProfile());
+		D3D11RenderAPI* rapi = static_cast<D3D11RenderAPI*>(RenderAPICore::instancePtr());
+		String hlslProfile = rapi->getCapabilities().gpuProgProfileToRSSpecificProfile(mProperties.getProfile());
 
 		ID3DBlob* microcode = compileMicrocode(hlslProfile);
 
@@ -54,7 +54,7 @@ namespace BansheeEngine
 			memcpy(&mMicrocode[0], microcode->GetBufferPointer(), microcode->GetBufferSize());
 
 			populateParametersAndConstants(microcode);
-			loadFromMicrocode(rs->getPrimaryDevice(), microcode);
+			loadFromMicrocode(rapi->getPrimaryDevice(), microcode);
 
 			SAFE_RELEASE(microcode);
 		}

+ 1 - 1
Source/BansheeGLRenderAPI/Source/BsGLFrameBufferObject.cpp

@@ -64,7 +64,7 @@ namespace BansheeEngine
         // Store basic stats
         UINT32 width = mColor[0].buffer->getWidth();
         UINT32 height = mColor[0].buffer->getHeight();
-        UINT16 maxSupportedMRTs = BansheeEngine::RenderAPICore::instancePtr()->getCapabilities()->getNumMultiRenderTargets();
+        UINT16 maxSupportedMRTs = RenderAPICore::instancePtr()->getCapabilities().getNumMultiRenderTargets();
 
 		// Bind simple buffer to add color attachments
 		glBindFramebuffer(GL_FRAMEBUFFER, mFB);

+ 3 - 3
Source/BansheeGLRenderAPI/Source/BsGLRenderAPI.cpp

@@ -1125,7 +1125,7 @@ namespace BansheeEngine
 	{
 		static bool lasta2c = false;
 
-		if (enable != lasta2c && getCapabilities()->hasCapability(RSC_ALPHA_TO_COVERAGE))
+		if (enable != lasta2c && getCapabilities().hasCapability(RSC_ALPHA_TO_COVERAGE))
 		{
 			if (enable)
 				glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
@@ -1452,7 +1452,7 @@ namespace BansheeEngine
 	{
 		if (mActiveTextureUnit != unit)
 		{
-			if (unit < getCapabilities()->getNumCombinedTextureUnits())
+			if (unit < getCapabilities().getNumCombinedTextureUnits())
 			{
 				glActiveTexture(GL_TEXTURE0 + unit);
 				mActiveTextureUnit = unit;
@@ -1466,7 +1466,7 @@ namespace BansheeEngine
 			else
 			{
 				LOGWRN("Provided texture unit index is higher than OpenGL supports. Provided: " + toString(unit) + 
-					". Supported range: 0 .. " + toString(getCapabilities()->getNumCombinedTextureUnits() - 1));
+					". Supported range: 0 .. " + toString(getCapabilities().getNumCombinedTextureUnits() - 1));
 				return false;
 			}
 		}

+ 3 - 3
Source/BansheeGLRenderAPI/Source/BsGLTextureManager.cpp

@@ -36,17 +36,17 @@ namespace BansheeEngine
 	PixelFormat GLTextureManager::getNativeFormat(TextureType ttype, PixelFormat format, int usage, bool hwGamma)
 	{
 		// Adjust requested parameters to capabilities
-        const RenderAPICapabilities *caps = RenderAPICore::instancePtr()->getCapabilities();
+        const RenderAPICapabilities& caps = RenderAPICore::instance().getCapabilities();
 
 		// Check compressed texture support
 		// If a compressed format not supported, revert to PF_A8R8G8B8
-		if(PixelUtil::isCompressed(format) && !caps->hasCapability(RSC_TEXTURE_COMPRESSION_DXT))
+		if(PixelUtil::isCompressed(format) && !caps.hasCapability(RSC_TEXTURE_COMPRESSION_DXT))
 		{
 			return PF_A8R8G8B8;
 		}
 
 		// If floating point textures not supported, revert to PF_A8R8G8B8
-		if(PixelUtil::isFloatingPoint(format) && !caps->hasCapability(RSC_TEXTURE_FLOAT))
+		if(PixelUtil::isFloatingPoint(format) && !caps.hasCapability(RSC_TEXTURE_FLOAT))
 		{
 			return PF_A8R8G8B8;
 		}

+ 2 - 2
Source/BansheeGLRenderAPI/Source/GLSL/src/BsGLSLGpuProgram.cpp

@@ -209,8 +209,8 @@ namespace BansheeEngine
 		if (!isRequiredCapabilitiesSupported())
 			return false;
 
-		RenderAPICore* rs = BansheeEngine::RenderAPICore::instancePtr();
-		return rs->getCapabilities()->isShaderProfileSupported("glsl");
+		RenderAPICore* rapi = BansheeEngine::RenderAPICore::instancePtr();
+		return rapi->getCapabilities().isShaderProfileSupported("glsl");
 	}
 }