diff --git a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTextureDX11.cpp b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTextureDX11.cpp index 19b42074f..73be91108 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTextureDX11.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTextureDX11.cpp @@ -133,8 +133,9 @@ void GPUTextureDX11::OnResidentMipsChanged() srDesc.Texture2D.MostDetailedMip = firstMipIndex; srDesc.Texture2D.MipLevels = mipLevels; } - ID3D11ShaderResourceView* srView; - VALIDATE_DIRECTX_RESULT(_device->GetDevice()->CreateShaderResourceView(_resource, &srDesc, &srView)); + ID3D11ShaderResourceView* srView = nullptr; + if (mipLevels != 0) + VALIDATE_DIRECTX_RESULT(_device->GetDevice()->CreateShaderResourceView(_resource, &srDesc, &srView)); GPUTextureViewDX11& view = IsVolume() ? _handleVolume : _handlesPerSlice[0]; if (view.GetParent() == nullptr) view.Init(this, nullptr, srView, nullptr, nullptr, Format(), MultiSampleLevel()); diff --git a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUTextureDX12.cpp b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUTextureDX12.cpp index fb8642c86..dd7402097 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUTextureDX12.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUTextureDX12.cpp @@ -240,7 +240,8 @@ void GPUTextureDX12::OnResidentMipsChanged() GPUTextureViewDX12& view = IsVolume() ? _handleVolume : _handlesPerSlice[0]; if (view.GetParent() == nullptr) view.Init(this, _device, this, Format(), MultiSampleLevel()); - view.SetSRV(srDesc); + if (mipLevels != 0) + view.SetSRV(srDesc); } void GPUTextureDX12::OnReleaseGPU() diff --git a/Source/Engine/Render2D/Font.cpp b/Source/Engine/Render2D/Font.cpp index 45798dec4..b026e2d80 100644 --- a/Source/Engine/Render2D/Font.cpp +++ b/Source/Engine/Render2D/Font.cpp @@ -201,25 +201,29 @@ void Font::ProcessText(const StringView& text, Array& outputLines moveLine = true; if (lastWhitespaceIndex != INVALID_INDEX) { - // Back cursorX = lastWhitespaceX; tmpLine.LastCharIndex = lastWhitespaceIndex - 1; - currentIndex = lastWhitespaceIndex + 1; - nextCharIndex = currentIndex; + nextCharIndex = currentIndex = lastWhitespaceIndex + 1; } else if (lastUpperIndex != INVALID_INDEX) { + // Skip moving twice for the same character + if (outputLines.HasItems() && outputLines.Last().LastCharIndex == lastUpperIndex - 1) + { + currentIndex = nextCharIndex; + lastMoveLine = moveLine; + continue; + } + cursorX = lastUpperX; tmpLine.LastCharIndex = lastUpperIndex - 1; - currentIndex = lastUpperIndex + 1; - nextCharIndex = currentIndex; + nextCharIndex = currentIndex = lastUpperIndex; } else if (lastUnderscoreIndex != INVALID_INDEX) { cursorX = lastUnderscoreX; - tmpLine.LastCharIndex = lastUnderscoreIndex; - currentIndex = lastUnderscoreIndex + 1; - nextCharIndex = currentIndex; + tmpLine.LastCharIndex = lastUnderscoreIndex - 2; + nextCharIndex = currentIndex = lastUnderscoreIndex + 1; } else {