Skip to content

Commit 27cc76e

Browse files
committed
Remove old and unused variables and code.
1 parent 8139105 commit 27cc76e

File tree

3 files changed

+20
-70
lines changed

3 files changed

+20
-70
lines changed

src/Layers/xrRender/R_Backend_Runtime.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ void CBackend::Invalidate()
126126
// Redundant call. Just no note that we need to unmap const
127127
// if we create dedicated class.
128128
StateManager.UnmapConstants();
129-
SSManager.ResetDeviceState();
130129
SRVSManager.ResetDeviceState();
131130

132131
for (u32 gs_it = 0; gs_it < mtMaxGeometryShaderTextures;)

src/Layers/xrRenderDX10/StateManager/dx10SamplerStateCache.cpp

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dx10SamplerStateCache::dx10SamplerStateCache() : m_uiMaxAnisotropy(1)
1010
{
1111
static const int iMaxRSStates = 10;
1212
m_StateArray.reserve(iMaxRSStates);
13-
ResetDeviceState();
1413
}
1514

1615
dx10SamplerStateCache::~dx10SamplerStateCache() { ClearStateArray(); }
@@ -85,12 +84,8 @@ void dx10SamplerStateCache::ClearStateArray()
8584
}
8685

8786
void dx10SamplerStateCache::PrepareSamplerStates(HArray& samplers,
88-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT],
89-
SHandle pCurrentState[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT], u32& uiMin, u32& uiMax) const
87+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT]) const
9088
{
91-
// It seems that sizeof pSS is 4 wor win32!
92-
ZeroMemory(pSS, sizeof(pSS[0]) * D3D_COMMONSHADER_SAMPLER_SLOT_COUNT);
93-
9489
for (u32 i = 0; i < samplers.size(); ++i)
9590
{
9691
if (samplers[i] != hInvalidHandle)
@@ -99,64 +94,49 @@ void dx10SamplerStateCache::PrepareSamplerStates(HArray& samplers,
9994
pSS[i] = m_StateArray[samplers[i]].m_pState;
10095
}
10196
}
102-
103-
uiMin = 0;
104-
uiMax = D3D_COMMONSHADER_SAMPLER_SLOT_COUNT - 1;
10597
}
10698

10799
void dx10SamplerStateCache::VSApplySamplers(HArray& samplers)
108100
{
109-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
110-
u32 uiMin;
111-
u32 uiMax;
112-
PrepareSamplerStates(samplers, pSS, m_aVSSamplers, uiMin, uiMax);
113-
HW.pContext->VSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
101+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
102+
PrepareSamplerStates(samplers, pSS);
103+
HW.pContext->VSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
114104
}
115105

116106
void dx10SamplerStateCache::PSApplySamplers(HArray& samplers)
117107
{
118-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
119-
u32 uiMin;
120-
u32 uiMax;
121-
PrepareSamplerStates(samplers, pSS, m_aPSSamplers, uiMin, uiMax);
122-
HW.pContext->PSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
108+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
109+
PrepareSamplerStates(samplers, pSS);
110+
HW.pContext->PSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
123111
}
124112

125113
void dx10SamplerStateCache::GSApplySamplers(HArray& samplers)
126114
{
127-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
128-
u32 uiMin;
129-
u32 uiMax;
130-
PrepareSamplerStates(samplers, pSS, m_aGSSamplers, uiMin, uiMax);
131-
HW.pContext->GSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
115+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
116+
PrepareSamplerStates(samplers, pSS);
117+
HW.pContext->GSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
132118
}
133119

134120
#ifdef USE_DX11
135121
void dx10SamplerStateCache::HSApplySamplers(HArray& samplers)
136122
{
137-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
138-
u32 uiMin;
139-
u32 uiMax;
140-
PrepareSamplerStates(samplers, pSS, m_aHSSamplers, uiMin, uiMax);
141-
HW.pContext->HSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
123+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
124+
PrepareSamplerStates(samplers, pSS);
125+
HW.pContext->HSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
142126
}
143127

144128
void dx10SamplerStateCache::DSApplySamplers(HArray& samplers)
145129
{
146-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
147-
u32 uiMin;
148-
u32 uiMax;
149-
PrepareSamplerStates(samplers, pSS, m_aDSSamplers, uiMin, uiMax);
150-
HW.pContext->DSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
130+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
131+
PrepareSamplerStates(samplers, pSS);
132+
HW.pContext->DSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
151133
}
152134

153135
void dx10SamplerStateCache::CSApplySamplers(HArray& samplers)
154136
{
155-
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
156-
u32 uiMin;
157-
u32 uiMax;
158-
PrepareSamplerStates(samplers, pSS, m_aCSSamplers, uiMin, uiMax);
159-
HW.pContext->CSSetSamplers(uiMin, uiMax - uiMin + 1, &pSS[uiMin]);
137+
ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT] = { nullptr };
138+
PrepareSamplerStates(samplers, pSS);
139+
HW.pContext->CSSetSamplers(0, D3D_COMMONSHADER_SAMPLER_SLOT_COUNT, pSS);
160140
}
161141
#endif
162142

@@ -188,18 +168,3 @@ void dx10SamplerStateCache::SetMaxAnisotropy(UINT uiMaxAniso)
188168
CreateState(desc, &rec.m_pState);
189169
}
190170
}
191-
192-
void dx10SamplerStateCache::ResetDeviceState()
193-
{
194-
for (int i = 0; i < sizeof(m_aPSSamplers) / sizeof(m_aPSSamplers[0]); ++i)
195-
{
196-
m_aPSSamplers[i] = (SHandle)hInvalidHandle;
197-
m_aVSSamplers[i] = (SHandle)hInvalidHandle;
198-
m_aGSSamplers[i] = (SHandle)hInvalidHandle;
199-
#ifdef USE_DX11
200-
m_aHSSamplers[i] = (SHandle)hInvalidHandle;
201-
m_aDSSamplers[i] = (SHandle)hInvalidHandle;
202-
m_aCSSamplers[i] = (SHandle)hInvalidHandle;
203-
#endif
204-
}
205-
}

src/Layers/xrRenderDX10/StateManager/dx10SamplerStateCache.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ class dx10SamplerStateCache
3333

3434
void SetMaxAnisotropy(UINT uiMaxAniso);
3535

36-
// Marks all device sample as unused
37-
void ResetDeviceState();
38-
39-
// Private declarations
4036
private:
4137
typedef ID3DSamplerState IDeviceState;
4238
typedef D3D_SAMPLER_DESC StateDecs;
@@ -51,23 +47,13 @@ class dx10SamplerStateCache
5147
void CreateState(StateDecs desc, IDeviceState** ppIState);
5248
SHandle FindState(const StateDecs& desc, u32 StateCRC);
5349

54-
void PrepareSamplerStates(HArray& samplers, ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT],
55-
SHandle pCurrentState[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT], u32& uiMin, u32& uiMax) const;
50+
void PrepareSamplerStates(HArray& samplers, ID3DSamplerState* pSS[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT]) const;
5651

5752
// Private data
5853
private:
5954
// This must be cleared on device destroy
6055
xr_vector<StateRecord> m_StateArray;
6156

62-
SHandle m_aPSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
63-
SHandle m_aVSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
64-
SHandle m_aGSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
65-
#ifdef USE_DX11
66-
SHandle m_aHSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
67-
SHandle m_aDSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
68-
SHandle m_aCSSamplers[D3D_COMMONSHADER_SAMPLER_SLOT_COUNT];
69-
#endif
70-
7157
u32 m_uiMaxAnisotropy;
7258
};
7359

0 commit comments

Comments
 (0)