Browse Source

Update NVIDIA Image Scaling v1.0.1

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
Ariel Bernal 2 years ago
parent
commit
aa37be7604

+ 3 - 0
.gitignore

@@ -35,6 +35,9 @@ Makefile
 *.so.*
 *.a
 
+# except for third-party lib files
+!/samples/third_party/**
+
 # ninja
 .ninja_deps
 .ninja_log

+ 2 - 3
NIS/NIS_Scaler.h

@@ -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;

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-# NVIDIA Image Scaling SDK v1.0
+# NVIDIA Image Scaling SDK v1.0.1
 
 The MIT License(MIT)
 

+ 1 - 10
samples/DX11/src/BilinearUpscale.cpp

@@ -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);

+ 2 - 1
samples/DX11/src/DeviceResources.cpp

@@ -125,6 +125,7 @@ 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;
@@ -132,7 +133,7 @@ void DeviceResources::createLinearClampSampler(ID3D11SamplerState** ppSampleStat
     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));
 }

+ 2 - 0
samples/DX12/src/AppRenderer.cpp

@@ -34,6 +34,7 @@ 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;
@@ -41,6 +42,7 @@ AppRenderer::AppRenderer(DeviceResources& deviceResources, UIData& ui, const std
     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");

BIN
samples/third_party/DXC/bin/x64/dxcompiler.dll


BIN
samples/third_party/DXC/bin/x64/dxil.dll


BIN
samples/third_party/DXC/lib/x64/dxcompiler.lib