This commit is contained in:
Branimir Karadžić 2015-09-17 19:55:01 -07:00
parent 7adfc7856a
commit 54be2d5b77
5 changed files with 12 additions and 15 deletions

View file

@ -314,6 +314,14 @@ namespace bgfx
return uint32_t( (_stencil >> (32*_0or1) ) ); 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); void dump(const VertexDecl& _decl);
struct TextVideoMem struct TextVideoMem

View file

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

View file

@ -2810,14 +2810,9 @@ data.NumQualityLevels = 0;
sd.ComparisonFunc = 0 == cmpFunc ? D3D12_COMPARISON_FUNC_NEVER : s_cmpFunc[cmpFunc]; 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; 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 if (NULL != _palette
&& needBorderColor) && needBorderColor(flags) )
{ {
const float* rgba = _palette[index]; const float* rgba = _palette[index];
sd.BorderColor[0] = rgba[0]; sd.BorderColor[0] = rgba[0];

View file

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

View file

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