diff --git a/lib/graphicsdev/D3D11.cpp b/lib/graphicsdev/D3D11.cpp index a7afbcf..e05ec87 100644 --- a/lib/graphicsdev/D3D11.cpp +++ b/lib/graphicsdev/D3D11.cpp @@ -1004,8 +1004,11 @@ struct D3D11CommandQueue : IGraphicsCommandQueue cbind->bind(m_deferredCtx.Get(), m_fillBuf); m_cmdLists[m_fillBuf].resTokens.push_back(binding.get()); - ID3D11SamplerState* samp[] = {m_ctx->m_ss[0].Get(), m_ctx->m_ss[1].Get(), m_ctx->m_ss[2].Get()}; - m_deferredCtx->PSSetSamplers(0, 3, samp); + ID3D11SamplerState* samp[] = {m_ctx->m_ss[0].Get(), + m_ctx->m_ss[1].Get(), + m_ctx->m_ss[2].Get(), + m_ctx->m_ss[3].Get()}; + m_deferredCtx->PSSetSamplers(0, 4, samp); } boo::ObjToken m_boundTarget; @@ -1615,8 +1618,9 @@ void D3D11CommandQueue::RenderingWorker(D3D11CommandQueue* self) self->m_ctx->m_devCtx->RSSetScissorRects(1, &d3drect); ID3D11SamplerState* samp[] = {self->m_ctx->m_ss[0].Get(), self->m_ctx->m_ss[1].Get(), - self->m_ctx->m_ss[2].Get()}; - self->m_ctx->m_devCtx->PSSetSamplers(0, 3, samp); + self->m_ctx->m_ss[2].Get(), + self->m_ctx->m_ss[3].Get()}; + self->m_ctx->m_devCtx->PSSetSamplers(0, 4, samp); D3D11ShaderDataBinding* gammaBinding = dataFactory->m_gammaBinding.cast(); gammaBinding->m_texs[0].tex = CmdList.workDoPresent.get(); diff --git a/lib/graphicsdev/D3D12.cpp b/lib/graphicsdev/D3D12.cpp index 2460725..3ccb81f 100644 --- a/lib/graphicsdev/D3D12.cpp +++ b/lib/graphicsdev/D3D12.cpp @@ -1720,11 +1720,13 @@ public: CD3DX12_STATIC_SAMPLER_DESC(1, D3D12_FILTER_ANISOTROPIC, D3D12_TEXTURE_ADDRESS_MODE_BORDER, D3D12_TEXTURE_ADDRESS_MODE_BORDER, D3D12_TEXTURE_ADDRESS_MODE_BORDER, 0.f, m_ctx->m_anisotropy), CD3DX12_STATIC_SAMPLER_DESC(2, D3D12_FILTER_ANISOTROPIC, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, 0.f, m_ctx->m_anisotropy), + CD3DX12_STATIC_SAMPLER_DESC(3, D3D12_FILTER_MIN_MAG_MIP_POINT, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, 0.f, m_ctx->m_anisotropy) }; ThrowIfFailed(D3D12SerializeRootSignaturePROC( - &CD3DX12_ROOT_SIGNATURE_DESC(1, rootParms, 3, samplers, + &CD3DX12_ROOT_SIGNATURE_DESC(1, rootParms, 4, samplers, D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT), D3D_ROOT_SIGNATURE_VERSION_1, &rsOutBlob, &rsErrorBlob)); diff --git a/lib/graphicsdev/Vulkan.cpp b/lib/graphicsdev/Vulkan.cpp index e1d56ad..9ad4104 100644 --- a/lib/graphicsdev/Vulkan.cpp +++ b/lib/graphicsdev/Vulkan.cpp @@ -1174,6 +1174,15 @@ static void MakeSampler(VulkanContext* ctx, VkSampler& sampOut, TextureClampMode samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; break; + case TextureClampMode::ClampToEdgeNearest: + samplerInfo.magFilter = VK_FILTER_NEAREST; + samplerInfo.minFilter = VK_FILTER_NEAREST; + samplerInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST; + samplerInfo.anisotropyEnable = VK_FALSE; + samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; + samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; + samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; + break; } ThrowIfFailed(vk::CreateSampler(ctx->m_dev, &samplerInfo, nullptr, &sampOut)); ctx->m_samplers[key] = sampOut; diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index b9819fd..8ffef15 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -350,6 +350,12 @@ public: sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss[2]); + sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; + sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss[3]); + Log.report(logvisor::Info, "initialized D3D11 renderer"); return; } diff --git a/lib/win/WinCommon.hpp b/lib/win/WinCommon.hpp index 8b8a4d7..9807eb4 100644 --- a/lib/win/WinCommon.hpp +++ b/lib/win/WinCommon.hpp @@ -66,7 +66,7 @@ struct D3D11Context ComPtr m_dxFactory; ComPtr m_dev; ComPtr m_devCtx; - ComPtr m_ss[3]; + ComPtr m_ss[4]; struct Window { ComPtr m_swapChain;