Skip to content

Commit

Permalink
Remove old and unused variables and code.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Dec 9, 2017
1 parent 8139105 commit 27cc76e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 70 deletions.
1 change: 0 additions & 1 deletion src/Layers/xrRender/R_Backend_Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ void CBackend::Invalidate()
// Redundant call. Just no note that we need to unmap const
// if we create dedicated class.
StateManager.UnmapConstants();
SSManager.ResetDeviceState();
SRVSManager.ResetDeviceState();

for (u32 gs_it = 0; gs_it < mtMaxGeometryShaderTextures;)
Expand Down
73 changes: 19 additions & 54 deletions src/Layers/xrRenderDX10/StateManager/dx10SamplerStateCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dx10SamplerStateCache::dx10SamplerStateCache() : m_uiMaxAnisotropy(1)
{
static const int iMaxRSStates = 10;
m_StateArray.reserve(iMaxRSStates);
ResetDeviceState();
}

dx10SamplerStateCache::~dx10SamplerStateCache() { ClearStateArray(); }
Expand Down Expand Up @@ -85,12 +84,8 @@ void dx10SamplerStateCache::ClearStateArray()
}

void dx10SamplerStateCache::PrepareSamplerStates(HArray& samplers,
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT],
SHandle pCurrentState[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT], u32& uiMin, u32& uiMax) const
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT]) const
{
// It seems that sizeof pSS is 4 wor win32!
ZeroMemory(pSS, sizeof(pSS[0]) * D3D_COMMONSHADER_SAMPLER_SLOT_COUNT);

for (u32 i = 0; i < samplers.size(); ++i)
{
if (samplers[i] != hInvalidHandle)
Expand All @@ -99,64 +94,49 @@ void dx10SamplerStateCache::PrepareSamplerStates(HArray& samplers,
pSS[i] = m_StateArray[samplers[i]].m_pState;
}
}

uiMin = 0;
uiMax = D3D_COMMONSHADER_SAMPLER_SLOT_COUNT - 1;
}

void dx10SamplerStateCache::VSApplySamplers(HArray& samplers)
{
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
u32 uiMin;
u32 uiMax;
PrepareSamplerStates(samplers, pSS, m_aVSSamplers, uiMin, uiMax);
HW.pContext->VSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
PrepareSamplerStates(samplers, pSS);
HW.pContext->VSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
}

void dx10SamplerStateCache::PSApplySamplers(HArray& samplers)
{
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
u32 uiMin;
u32 uiMax;
PrepareSamplerStates(samplers, pSS, m_aPSSamplers, uiMin, uiMax);
HW.pContext->PSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
PrepareSamplerStates(samplers, pSS);
HW.pContext->PSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
}

void dx10SamplerStateCache::GSApplySamplers(HArray& samplers)
{
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
u32 uiMin;
u32 uiMax;
PrepareSamplerStates(samplers, pSS, m_aGSSamplers, uiMin, uiMax);
HW.pContext->GSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
PrepareSamplerStates(samplers, pSS);
HW.pContext->GSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
}

#ifdef USE_DX11
void dx10SamplerStateCache::HSApplySamplers(HArray& samplers)
{
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
u32 uiMin;
u32 uiMax;
PrepareSamplerStates(samplers, pSS, m_aHSSamplers, uiMin, uiMax);
HW.pContext->HSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
PrepareSamplerStates(samplers, pSS);
HW.pContext->HSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
}

void dx10SamplerStateCache::DSApplySamplers(HArray& samplers)
{
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
u32 uiMin;
u32 uiMax;
PrepareSamplerStates(samplers, pSS, m_aDSSamplers, uiMin, uiMax);
HW.pContext->DSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
PrepareSamplerStates(samplers, pSS);
HW.pContext->DSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
}

void dx10SamplerStateCache::CSApplySamplers(HArray& samplers)
{
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
u32 uiMin;
u32 uiMax;
PrepareSamplerStates(samplers, pSS, m_aCSSamplers, uiMin, uiMax);
HW.pContext->CSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
PrepareSamplerStates(samplers, pSS);
HW.pContext->CSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
}
#endif

Expand Down Expand Up @@ -188,18 +168,3 @@ void dx10SamplerStateCache::SetMaxAnisotropy(UINT uiMaxAniso)
CreateState(desc, &rec.m_pState);
}
}

void dx10SamplerStateCache::ResetDeviceState()
{
for (int i = 0; i < sizeof(m_aPSSamplers) / sizeof(m_aPSSamplers[0]); ++i)
{
m_aPSSamplers[i] = (SHandle)hInvalidHandle;
m_aVSSamplers[i] = (SHandle)hInvalidHandle;
m_aGSSamplers[i] = (SHandle)hInvalidHandle;
#ifdef USE_DX11
m_aHSSamplers[i] = (SHandle)hInvalidHandle;
m_aDSSamplers[i] = (SHandle)hInvalidHandle;
m_aCSSamplers[i] = (SHandle)hInvalidHandle;
#endif
}
}
16 changes: 1 addition & 15 deletions src/Layers/xrRenderDX10/StateManager/dx10SamplerStateCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ class dx10SamplerStateCache

void SetMaxAnisotropy(UINT uiMaxAniso);

// Marks all device sample as unused
void ResetDeviceState();

// Private declarations
private:
typedef ID3DSamplerState IDeviceState;
typedef D3D_SAMPLER_DESC StateDecs;
Expand All @@ -51,23 +47,13 @@ class dx10SamplerStateCache
void CreateState(StateDecs desc, IDeviceState** ppIState);
SHandle FindState(const StateDecs& desc, u32 StateCRC);

void PrepareSamplerStates(HArray& samplers, ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT],
SHandle pCurrentState[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT], u32& uiMin, u32& uiMax) const;
void PrepareSamplerStates(HArray& samplers, ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT]) const;

// Private data
private:
// This must be cleared on device destroy
xr_vector<StateRecord> m_StateArray;

SHandle m_aPSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
SHandle m_aVSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
SHandle m_aGSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
#ifdef USE_DX11
SHandle m_aHSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
SHandle m_aDSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
SHandle m_aCSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
#endif

u32 m_uiMaxAnisotropy;
};

Expand Down

0 comments on commit 27cc76e

Please sign in to comment.