D3D11: Fixed invalid blend state cache hash value.
This commit is contained in:
parent
402a63be85
commit
0679776a4b
@ -104,6 +104,10 @@ namespace bgfx
|
|||||||
{
|
{
|
||||||
invalidate(_key);
|
invalidate(_key);
|
||||||
m_hashMap.insert(stl::make_pair(_key, _value) );
|
m_hashMap.insert(stl::make_pair(_key, _value) );
|
||||||
|
BX_CHECK(1 == getRefCount(_value), "Interface ref count %d, hash %" PRIx64 "."
|
||||||
|
, getRefCount(_value)
|
||||||
|
, _key
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ty* find(uint64_t _key)
|
Ty* find(uint64_t _key)
|
||||||
|
@ -2485,31 +2485,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||||||
{
|
{
|
||||||
_state &= BGFX_D3D11_BLEND_STATE_MASK;
|
_state &= BGFX_D3D11_BLEND_STATE_MASK;
|
||||||
|
|
||||||
bx::HashMurmur2A murmur;
|
const uint64_t hash = _state;
|
||||||
murmur.begin();
|
|
||||||
murmur.add(_state);
|
|
||||||
|
|
||||||
const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR);
|
|
||||||
const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR);
|
|
||||||
bool hasFactor = f0 == (_state & f0)
|
|
||||||
|| f1 == (_state & f1)
|
|
||||||
;
|
|
||||||
|
|
||||||
float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
|
||||||
if (hasFactor)
|
|
||||||
{
|
|
||||||
blendFactor[0] = ( (_rgba>>24) )/255.0f;
|
|
||||||
blendFactor[1] = ( (_rgba>>16)&0xff)/255.0f;
|
|
||||||
blendFactor[2] = ( (_rgba>> 8)&0xff)/255.0f;
|
|
||||||
blendFactor[3] = ( (_rgba )&0xff)/255.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
murmur.add(_rgba);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t hash = murmur.end();
|
|
||||||
|
|
||||||
ID3D11BlendState* bs = m_blendStateCache.find(hash);
|
ID3D11BlendState* bs = m_blendStateCache.find(hash);
|
||||||
if (NULL == bs)
|
if (NULL == bs)
|
||||||
{
|
{
|
||||||
@ -2587,6 +2563,22 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||||||
m_blendStateCache.add(hash, bs);
|
m_blendStateCache.add(hash, bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR);
|
||||||
|
const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR);
|
||||||
|
bool hasFactor = false
|
||||||
|
|| f0 == (_state & f0)
|
||||||
|
|| f1 == (_state & f1)
|
||||||
|
;
|
||||||
|
|
||||||
|
float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
if (hasFactor)
|
||||||
|
{
|
||||||
|
blendFactor[0] = ( (_rgba>>24) )/255.0f;
|
||||||
|
blendFactor[1] = ( (_rgba>>16)&0xff)/255.0f;
|
||||||
|
blendFactor[2] = ( (_rgba>> 8)&0xff)/255.0f;
|
||||||
|
blendFactor[3] = ( (_rgba )&0xff)/255.0f;
|
||||||
|
}
|
||||||
|
|
||||||
m_deviceCtx->OMSetBlendState(bs, blendFactor, 0xffffffff);
|
m_deviceCtx->OMSetBlendState(bs, blendFactor, 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user