Rename ShadowSamplerPCF to ShadowSamplerLinear
This commit is contained in:
@@ -114,7 +114,7 @@ void GPUContextDX11::FrameBegin()
|
||||
_device->_samplerLinearWrap,
|
||||
_device->_samplerPointWrap,
|
||||
_device->_samplerShadow,
|
||||
_device->_samplerShadowPCF
|
||||
_device->_samplerShadowLinear
|
||||
};
|
||||
_context->VSSetSamplers(0, ARRAY_COUNT(samplers), samplers);
|
||||
_context->DSSetSamplers(0, ARRAY_COUNT(samplers), samplers);
|
||||
|
||||
@@ -227,16 +227,7 @@ GPUDevice* GPUDeviceDX11::Create()
|
||||
|
||||
GPUDeviceDX11::GPUDeviceDX11(IDXGIFactory* dxgiFactory, GPUAdapterDX* adapter)
|
||||
: GPUDeviceDX(getRendererType(adapter), getShaderProfile(adapter), adapter)
|
||||
, _device(nullptr)
|
||||
, _imContext(nullptr)
|
||||
, _factoryDXGI(dxgiFactory)
|
||||
, _mainContext(nullptr)
|
||||
, _samplerLinearClamp(nullptr)
|
||||
, _samplerPointClamp(nullptr)
|
||||
, _samplerLinearWrap(nullptr)
|
||||
, _samplerPointWrap(nullptr)
|
||||
, _samplerShadow(nullptr)
|
||||
, _samplerShadowPCF(nullptr)
|
||||
{
|
||||
Platform::MemoryClear(RasterizerStates, sizeof(RasterizerStates));
|
||||
Platform::MemoryClear(DepthStencilStates, sizeof(DepthStencilStates));
|
||||
@@ -450,14 +441,17 @@ bool GPUDeviceDX11::Init()
|
||||
{
|
||||
D3D11_SAMPLER_DESC samplerDesc;
|
||||
Platform::MemoryClear(&samplerDesc, sizeof(samplerDesc));
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
samplerDesc.MipLODBias = 0.0f;
|
||||
samplerDesc.MaxAnisotropy = 1;
|
||||
samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;
|
||||
|
||||
// Linear Clamp
|
||||
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerLinearClamp);
|
||||
LOG_DIRECTX_RESULT_WITH_RETURN(result, true);
|
||||
|
||||
@@ -466,8 +460,6 @@ bool GPUDeviceDX11::Init()
|
||||
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerPointClamp);
|
||||
LOG_DIRECTX_RESULT_WITH_RETURN(result, true);
|
||||
|
||||
@@ -476,8 +468,6 @@ bool GPUDeviceDX11::Init()
|
||||
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerLinearWrap);
|
||||
LOG_DIRECTX_RESULT_WITH_RETURN(result, true);
|
||||
|
||||
@@ -486,8 +476,6 @@ bool GPUDeviceDX11::Init()
|
||||
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerPointWrap);
|
||||
LOG_DIRECTX_RESULT_WITH_RETURN(result, true);
|
||||
|
||||
@@ -496,26 +484,15 @@ bool GPUDeviceDX11::Init()
|
||||
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_LESS_EQUAL;
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerShadow);
|
||||
LOG_DIRECTX_RESULT_WITH_RETURN(result, true);
|
||||
|
||||
// Shadow PCF
|
||||
// Shadow Linear
|
||||
samplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR;
|
||||
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_LESS_EQUAL;
|
||||
samplerDesc.BorderColor[0] = samplerDesc.BorderColor[1] = samplerDesc.BorderColor[2] = samplerDesc.BorderColor[3] = 0;
|
||||
samplerDesc.MinLOD = 0;
|
||||
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerShadowPCF);
|
||||
result = _device->CreateSamplerState(&samplerDesc, &_samplerShadowLinear);
|
||||
LOG_DIRECTX_RESULT_WITH_RETURN(result, true);
|
||||
}
|
||||
|
||||
@@ -616,7 +593,7 @@ void GPUDeviceDX11::Dispose()
|
||||
SAFE_RELEASE(_samplerLinearWrap);
|
||||
SAFE_RELEASE(_samplerPointWrap);
|
||||
SAFE_RELEASE(_samplerShadow);
|
||||
SAFE_RELEASE(_samplerShadowPCF);
|
||||
SAFE_RELEASE(_samplerShadowLinear);
|
||||
//
|
||||
for (auto i = BlendStates.Begin(); i.IsNotEnd(); ++i)
|
||||
{
|
||||
|
||||
@@ -24,20 +24,20 @@ class GPUDeviceDX11 : public GPUDeviceDX
|
||||
private:
|
||||
|
||||
// Private Stuff
|
||||
ID3D11Device* _device;
|
||||
ID3D11DeviceContext* _imContext;
|
||||
ID3D11Device* _device = nullptr;
|
||||
ID3D11DeviceContext* _imContext = nullptr;
|
||||
IDXGIFactory* _factoryDXGI;
|
||||
|
||||
GPUContextDX11* _mainContext;
|
||||
GPUContextDX11* _mainContext = nullptr;
|
||||
bool _allowTearing = false;
|
||||
|
||||
// Static Samplers
|
||||
ID3D11SamplerState* _samplerLinearClamp;
|
||||
ID3D11SamplerState* _samplerPointClamp;
|
||||
ID3D11SamplerState* _samplerLinearWrap;
|
||||
ID3D11SamplerState* _samplerPointWrap;
|
||||
ID3D11SamplerState* _samplerShadow;
|
||||
ID3D11SamplerState* _samplerShadowPCF;
|
||||
ID3D11SamplerState* _samplerLinearClamp = nullptr;
|
||||
ID3D11SamplerState* _samplerPointClamp = nullptr;
|
||||
ID3D11SamplerState* _samplerLinearWrap = nullptr;
|
||||
ID3D11SamplerState* _samplerPointWrap = nullptr;
|
||||
ID3D11SamplerState* _samplerShadow = nullptr;
|
||||
ID3D11SamplerState* _samplerShadowLinear = nullptr;
|
||||
|
||||
// Shared data for pipeline states
|
||||
CriticalSection BlendStatesWriteLocker;
|
||||
|
||||
@@ -568,7 +568,6 @@ bool GPUDeviceDX12::Init()
|
||||
// Static samplers
|
||||
D3D12_STATIC_SAMPLER_DESC staticSamplers[6];
|
||||
static_assert(GPU_STATIC_SAMPLERS_COUNT == ARRAY_COUNT(staticSamplers), "Update static samplers setup.");
|
||||
// TODO: describe visibilities for the static samples, maybe use all pixel? or again pixel + all combo?
|
||||
// Linear Clamp
|
||||
staticSamplers[0].Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
staticSamplers[0].AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
||||
@@ -650,8 +649,6 @@ bool GPUDeviceDX12::Init()
|
||||
staticSamplers[5].RegisterSpace = 0;
|
||||
staticSamplers[5].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
|
||||
|
||||
// TODO: static samplers for the shadow pass change into bindable samplers or sth?
|
||||
|
||||
// Init
|
||||
D3D12_ROOT_SIGNATURE_DESC rootSignatureDesc;
|
||||
rootSignatureDesc.NumParameters = ARRAY_COUNT(rootParameters);
|
||||
|
||||
@@ -88,42 +88,33 @@
|
||||
// Performs branching by using control flow instructions like jmp and label.
|
||||
#define BRANCH [branch]
|
||||
|
||||
/// Performs branching by using the cnd instructions.
|
||||
// Performs branching by using the cnd instructions.
|
||||
#define FLATTEN [flatten]
|
||||
|
||||
#endif
|
||||
|
||||
// Compiler attribute fallback
|
||||
|
||||
#ifndef UNROLL
|
||||
#define UNROLL
|
||||
#endif
|
||||
|
||||
#ifndef LOOP
|
||||
#define LOOP
|
||||
#endif
|
||||
|
||||
#ifndef BRANCH
|
||||
#define BRANCH
|
||||
#endif
|
||||
|
||||
#ifndef FLATTEN
|
||||
#define FLATTEN
|
||||
#endif
|
||||
|
||||
// TODO: cleanup global samplers with per-platform customization support
|
||||
#ifndef SamplerLinearClamp
|
||||
|
||||
// Static samplers
|
||||
sampler SamplerLinearClamp : register(s0);
|
||||
sampler SamplerPointClamp : register(s1);
|
||||
sampler SamplerLinearWrap : register(s2);
|
||||
sampler SamplerPointWrap : register(s3);
|
||||
|
||||
// TODO: use custom pipeline layouts and bind different sampler during shadows rendering
|
||||
SamplerComparisonState ShadowSampler : register(s4);
|
||||
SamplerComparisonState ShadowSamplerPCF : register(s5);
|
||||
|
||||
SamplerComparisonState ShadowSamplerLinear : register(s5);
|
||||
#endif
|
||||
|
||||
// General purpose macros
|
||||
|
||||
Reference in New Issue
Block a user