Branimir Karadžić 10 yıl önce
ebeveyn
işleme
54be2d5b77
5 değiştirilmiş dosya ile 12 ekleme ve 15 silme
  1. 8 0
      src/bgfx_p.h
  2. 1 3
      src/renderer_d3d11.cpp
  3. 1 6
      src/renderer_d3d12.cpp
  4. 1 3
      src/renderer_d3d9.cpp
  5. 1 3
      src/renderer_gl.cpp

+ 8 - 0
src/bgfx_p.h

@@ -314,6 +314,14 @@ namespace bgfx
 		return uint32_t( (_stencil >> (32*_0or1) ) );
 	}
 
+	inline bool needBorderColor(uint32_t _flags)
+	{
+		return BGFX_TEXTURE_U_BORDER == (_flags & BGFX_TEXTURE_U_BORDER)
+			|| BGFX_TEXTURE_V_BORDER == (_flags & BGFX_TEXTURE_V_BORDER)
+			|| BGFX_TEXTURE_W_BORDER == (_flags & BGFX_TEXTURE_W_BORDER)
+			;
+	}
+	
 	void dump(const VertexDecl& _decl);
 
 	struct TextVideoMem

+ 1 - 3
src/renderer_d3d11.cpp

@@ -2535,9 +2535,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 
 			uint32_t hash;
 			ID3D11SamplerState* sampler;
-			if (BGFX_TEXTURE_U_BORDER != (_flags & BGFX_TEXTURE_U_BORDER)
-			&&  BGFX_TEXTURE_V_BORDER != (_flags & BGFX_TEXTURE_V_BORDER)
-			&&  BGFX_TEXTURE_W_BORDER != (_flags & BGFX_TEXTURE_W_BORDER) )
+			if (!needBorderColor(_flags) )
 			{
 				bx::HashMurmur2A murmur;
 				murmur.begin();

+ 1 - 6
src/renderer_d3d12.cpp

@@ -2810,14 +2810,9 @@ data.NumQualityLevels = 0;
 			sd.ComparisonFunc = 0 == cmpFunc ? D3D12_COMPARISON_FUNC_NEVER : s_cmpFunc[cmpFunc];
 
 			uint32_t index = (flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT;
-			const bool needBorderColor = false
-				|| BGFX_TEXTURE_U_BORDER == (flags & BGFX_TEXTURE_U_BORDER)
-				|| BGFX_TEXTURE_V_BORDER == (flags & BGFX_TEXTURE_V_BORDER)
-				|| BGFX_TEXTURE_W_BORDER == (flags & BGFX_TEXTURE_W_BORDER)
-				;
 
 			if (NULL != _palette
-			&&  needBorderColor)
+			&&  needBorderColor(flags) )
 			{
 				const float* rgba = _palette[index];
 				sd.BorderColor[0] = rgba[0];

+ 1 - 3
src/renderer_d3d9.cpp

@@ -1454,9 +1454,7 @@ namespace bgfx { namespace d3d9
 				setSamplerState(device, _stage, D3DSAMP_SRGBTEXTURE, 0 != (flags & BGFX_TEXTURE_SRGB) );
 				if (NULL != _rgba)
 				{
-					if (BGFX_TEXTURE_U_BORDER == (_flags & BGFX_TEXTURE_U_BORDER)
-					||  BGFX_TEXTURE_V_BORDER == (_flags & BGFX_TEXTURE_V_BORDER)
-					||  BGFX_TEXTURE_W_BORDER == (_flags & BGFX_TEXTURE_W_BORDER) )
+					if (needBorderColor(_flags) )
 					{
 						DWORD bc = D3DCOLOR_COLORVALUE(_rgba[0], _rgba[1], _rgba[2], _rgba[3]);
 						setSamplerState(device

+ 1 - 3
src/renderer_gl.cpp

@@ -2540,9 +2540,7 @@ namespace bgfx { namespace gl
 
 					murmur.begin();
 					murmur.add(_flags);
-					if (BGFX_TEXTURE_U_BORDER != (_flags & BGFX_TEXTURE_U_BORDER)
-					&&  BGFX_TEXTURE_V_BORDER != (_flags & BGFX_TEXTURE_V_BORDER)
-					&&  BGFX_TEXTURE_W_BORDER != (_flags & BGFX_TEXTURE_W_BORDER) )
+					if (!needBorderColor(_flags) )
 					{
 						murmur.add(-1);
 						hash = murmur.end();