Skip to content

Commit

Permalink
Update NVIDIA Image Scaling v1.0.1
Browse files Browse the repository at this point in the history
Fixed sampler initialization in the DX11 and DX12 sample apps reported
by @mbucchia (thanks Matthieu!)
Fixed .gitignore and missing DXC lib and dll files
Fixed NVScaler pixel shift under certain conditions
  • Loading branch information
abernalnv committed Jan 11, 2022
1 parent 5967720 commit aa37be7
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Makefile
*.so.*
*.a

# except for third-party lib files
!/samples/third_party/**

# ninja
.ninja_deps
.ninja_log
Expand Down
5 changes: 2 additions & 3 deletions NIS/NIS_Scaler.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,8 @@ void NVScaler(NVU2 blockIdx, NVU threadIdx)
NVI px = i % numTilePixelsX;

// 0.5 to be in the center of texel
// -1.0 to sample top-left corner of 3x3 halo necessary
// -kSupportSize/2 to shift by the kernel support size
NVF kShift = 0.5f - 1.0f - (kSupportSize - 1) / 2;
// - (kSupportSize - 1) / 2 to shift by the kernel support size
NVF kShift = 0.5f - (kSupportSize - 1) / 2;
#if NIS_VIEWPORT_SUPPORT
const NVF tx = (srcBlockStartX + px + kInputViewportOriginX + kShift) * kSrcNormX;
const NVF ty = (srcBlockStartY + py + kInputViewportOriginY + kShift) * kSrcNormY;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NVIDIA Image Scaling SDK v1.0
# NVIDIA Image Scaling SDK v1.0.1

The MIT License(MIT)

Expand Down
11 changes: 1 addition & 10 deletions samples/DX11/src/BilinearUpscale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,7 @@ BilinearUpscale::BilinearUpscale(DeviceResources& deviceResources)

BilinearUpdateConfig(m_config, 0, 0, 100, 100, 100, 100, 0, 0, 100, 100, 100, 100);

D3D11_SAMPLER_DESC samplerDesc;
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
DX::ThrowIfFailed(m_deviceResources.device()->CreateSamplerState(&samplerDesc, &m_LinearClampSampler));
m_deviceResources.createLinearClampSampler(&m_LinearClampSampler);

D3D11_BUFFER_DESC bDesc;
bDesc.ByteWidth = sizeof(BilinearUpscaleConfig);
Expand Down
3 changes: 2 additions & 1 deletion samples/DX11/src/DeviceResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ void DeviceResources::createSRV(ID3D11Resource* pResource, DXGI_FORMAT format, I
void DeviceResources::createLinearClampSampler(ID3D11SamplerState** ppSampleState)
{
D3D11_SAMPLER_DESC samplerDesc;
ZeroMemory(&samplerDesc, sizeof(D3D11_SAMPLER_DESC));
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
samplerDesc.MinLOD = -D3D11_FLOAT32_MAX;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
DX::ThrowIfFailed(m_d3dDevice->CreateSamplerState(&samplerDesc, ppSampleState));
}
Expand Down
2 changes: 2 additions & 0 deletions samples/DX12/src/AppRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ AppRenderer::AppRenderer(DeviceResources& deviceResources, UIData& ui, const std
{

D3D12_SAMPLER_DESC samplerDesc;
ZeroMemory(&samplerDesc, sizeof(samplerDesc));
samplerDesc.Filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
samplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
samplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
samplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D12_FLOAT32_MAX;

m_samplerDescriptorHeap.Create(m_deviceResources.device(), D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 1, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, L"samplerDescriptorHeap");
Expand Down
Binary file added samples/third_party/DXC/bin/x64/dxcompiler.dll
Binary file not shown.
Binary file added samples/third_party/DXC/bin/x64/dxil.dll
Binary file not shown.
Binary file added samples/third_party/DXC/lib/x64/dxcompiler.lib
Binary file not shown.

0 comments on commit aa37be7

Please sign in to comment.