diff --git a/src/bgfx.cpp b/src/bgfx.cpp index df8541aa..86323a12 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1286,9 +1286,9 @@ namespace bgfx memcpy(m_submit->m_view, m_view, sizeof(m_view) ); memcpy(m_submit->m_proj, m_proj, sizeof(m_proj) ); memcpy(m_submit->m_viewFlags, m_viewFlags, sizeof(m_viewFlags) ); - if (m_clearColorDirty > 0) + if (m_colorPaletteDirty > 0) { - --m_clearColorDirty; + --m_colorPaletteDirty; memcpy(m_submit->m_colorPalette, m_clearColor, sizeof(m_clearColor) ); } m_submit->finish(); diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 75a9b13f..9f758349 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -1925,7 +1925,7 @@ namespace bgfx , m_submit(&m_frame[BGFX_CONFIG_MULTITHREADED ? 1 : 0]) , m_numFreeDynamicIndexBufferHandles(0) , m_numFreeDynamicVertexBufferHandles(0) - , m_clearColorDirty(0) + , m_colorPaletteDirty(0) , m_instBufferCount(0) , m_frames(0) , m_debug(BGFX_DEBUG_NONE) @@ -3194,7 +3194,7 @@ namespace bgfx , BGFX_CONFIG_MAX_COLOR_PALETTE ); memcpy(&m_clearColor[_index][0], _rgba, 16); - m_clearColorDirty = 2; + m_colorPaletteDirty = 2; } BGFX_API_FUNC(void setViewName(uint8_t _id, const char* _name) ) @@ -3701,7 +3701,7 @@ namespace bgfx uint16_t m_seq[BGFX_CONFIG_MAX_VIEWS]; uint16_t m_seqMask[BGFX_CONFIG_MAX_VIEWS]; - uint8_t m_clearColorDirty; + uint8_t m_colorPaletteDirty; Resolution m_resolution; int32_t m_instBufferCount; diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 29e3bc0a..d20b1793 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -457,6 +457,7 @@ namespace bgfx { namespace d3d12 RendererContextD3D12() : m_wireframe(false) , m_flags(BGFX_RESET_NONE) + , m_maxAnisotropy(1) , m_fsChanges(0) , m_vsChanges(0) , m_backBufferColorIdx(0) @@ -1627,6 +1628,15 @@ data.NumQualityLevels = 0; void updateResolution(const Resolution& _resolution) { + if (!!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) ) + { + m_maxAnisotropy = D3D12_REQ_MAXANISOTROPY; + } + else + { + m_maxAnisotropy = 1; + } + if ( (uint32_t)m_scd.BufferDesc.Width != _resolution.m_width || (uint32_t)m_scd.BufferDesc.Height != _resolution.m_height || m_flags != _resolution.m_flags) @@ -2522,6 +2532,7 @@ data.NumQualityLevels = 0; DXGI_SWAP_CHAIN_DESC m_scd; uint32_t m_flags; + uint32_t m_maxAnisotropy; BufferD3D12 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS]; VertexBufferD3D12 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; @@ -2788,7 +2799,8 @@ data.NumQualityLevels = 0; { uint16_t idx = m_handleAlloc->alloc(); - ID3D12Device* device = s_renderD3D12->m_device; + ID3D12Device* device = s_renderD3D12->m_device; + uint32_t maxAnisotropy = s_renderD3D12->m_maxAnisotropy; for (uint32_t ii = 0; ii < _num; ++ii) { @@ -2806,7 +2818,7 @@ data.NumQualityLevels = 0; sd.AddressV = s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; sd.AddressW = s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; sd.MipLODBias = 0.0f; - sd.MaxAnisotropy = 1; //m_maxAnisotropy; + sd.MaxAnisotropy = maxAnisotropy; 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;