mirror of https://github.com/AxioDL/boo.git
Add nearest-neighbor samplers for remaining backends
This commit is contained in:
parent
72c9809655
commit
a2c3e14d8e
|
@ -1004,8 +1004,11 @@ struct D3D11CommandQueue : IGraphicsCommandQueue
|
||||||
cbind->bind(m_deferredCtx.Get(), m_fillBuf);
|
cbind->bind(m_deferredCtx.Get(), m_fillBuf);
|
||||||
m_cmdLists[m_fillBuf].resTokens.push_back(binding.get());
|
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()};
|
ID3D11SamplerState* samp[] = {m_ctx->m_ss[0].Get(),
|
||||||
m_deferredCtx->PSSetSamplers(0, 3, samp);
|
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<ITextureR> m_boundTarget;
|
boo::ObjToken<ITextureR> m_boundTarget;
|
||||||
|
@ -1615,8 +1618,9 @@ void D3D11CommandQueue::RenderingWorker(D3D11CommandQueue* self)
|
||||||
self->m_ctx->m_devCtx->RSSetScissorRects(1, &d3drect);
|
self->m_ctx->m_devCtx->RSSetScissorRects(1, &d3drect);
|
||||||
ID3D11SamplerState* samp[] = {self->m_ctx->m_ss[0].Get(),
|
ID3D11SamplerState* samp[] = {self->m_ctx->m_ss[0].Get(),
|
||||||
self->m_ctx->m_ss[1].Get(),
|
self->m_ctx->m_ss[1].Get(),
|
||||||
self->m_ctx->m_ss[2].Get()};
|
self->m_ctx->m_ss[2].Get(),
|
||||||
self->m_ctx->m_devCtx->PSSetSamplers(0, 3, samp);
|
self->m_ctx->m_ss[3].Get()};
|
||||||
|
self->m_ctx->m_devCtx->PSSetSamplers(0, 4, samp);
|
||||||
|
|
||||||
D3D11ShaderDataBinding* gammaBinding = dataFactory->m_gammaBinding.cast<D3D11ShaderDataBinding>();
|
D3D11ShaderDataBinding* gammaBinding = dataFactory->m_gammaBinding.cast<D3D11ShaderDataBinding>();
|
||||||
gammaBinding->m_texs[0].tex = CmdList.workDoPresent.get();
|
gammaBinding->m_texs[0].tex = CmdList.workDoPresent.get();
|
||||||
|
|
|
@ -1720,11 +1720,13 @@ public:
|
||||||
CD3DX12_STATIC_SAMPLER_DESC(1, D3D12_FILTER_ANISOTROPIC, D3D12_TEXTURE_ADDRESS_MODE_BORDER,
|
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),
|
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,
|
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)
|
D3D12_TEXTURE_ADDRESS_MODE_CLAMP, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, 0.f, m_ctx->m_anisotropy)
|
||||||
};
|
};
|
||||||
|
|
||||||
ThrowIfFailed(D3D12SerializeRootSignaturePROC(
|
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),
|
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT),
|
||||||
D3D_ROOT_SIGNATURE_VERSION_1, &rsOutBlob, &rsErrorBlob));
|
D3D_ROOT_SIGNATURE_VERSION_1, &rsOutBlob, &rsErrorBlob));
|
||||||
|
|
||||||
|
|
|
@ -1174,6 +1174,15 @@ static void MakeSampler(VulkanContext* ctx, VkSampler& sampOut, TextureClampMode
|
||||||
samplerInfo.addressModeV = 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;
|
samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||||
break;
|
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));
|
ThrowIfFailed(vk::CreateSampler(ctx->m_dev, &samplerInfo, nullptr, &sampOut));
|
||||||
ctx->m_samplers[key] = sampOut;
|
ctx->m_samplers[key] = sampOut;
|
||||||
|
|
|
@ -350,6 +350,12 @@ public:
|
||||||
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss[2]);
|
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");
|
Log.report(logvisor::Info, "initialized D3D11 renderer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct D3D11Context
|
||||||
ComPtr<IDXGIFactory2> m_dxFactory;
|
ComPtr<IDXGIFactory2> m_dxFactory;
|
||||||
ComPtr<ID3D11Device1> m_dev;
|
ComPtr<ID3D11Device1> m_dev;
|
||||||
ComPtr<ID3D11DeviceContext1> m_devCtx;
|
ComPtr<ID3D11DeviceContext1> m_devCtx;
|
||||||
ComPtr<ID3D11SamplerState> m_ss[3];
|
ComPtr<ID3D11SamplerState> m_ss[4];
|
||||||
struct Window
|
struct Window
|
||||||
{
|
{
|
||||||
ComPtr<IDXGISwapChain1> m_swapChain;
|
ComPtr<IDXGISwapChain1> m_swapChain;
|
||||||
|
|
Loading…
Reference in New Issue