Skip to content

Commit 158fe40

Browse files
tamlin-mikeXottab-DUTY
authored andcommitted
Dependency reductions of and const-ify xr_token. Reduce compiler warnings.
1 parent 6393ae6 commit 158fe40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+277
-220
lines changed

src/Layers/xrRender/ETextureParams.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
#pragma hdrstop
33

44
#include "ETextureParams.h"
5+
#include "xrCore/xr_token.h"
56

6-
xr_token tparam_token[] = {{"Advanced", STextureParams::kMIPFilterAdvanced},
7+
const xr_token tparam_token[] = {{"Advanced", STextureParams::kMIPFilterAdvanced},
78

89
{"Point", STextureParams::kMIPFilterPoint}, {"Box", STextureParams::kMIPFilterBox},
910
{"Triangle", STextureParams::kMIPFilterTriangle}, {"Quadratic", STextureParams::kMIPFilterQuadratic},
@@ -17,21 +18,21 @@ xr_token tparam_token[] = {{"Advanced", STextureParams::kMIPFilterAdvanced},
1718
{"Hanning", STextureParams::kMIPFilterHanning}, {"Hamming", STextureParams::kMIPFilterHamming},
1819
{"Blackman", STextureParams::kMIPFilterBlackman}, {"Kaiser", STextureParams::kMIPFilterKaiser}, {nullptr, 0}};
1920

20-
xr_token ttype_token[] = {{"2D Texture", STextureParams::ttImage}, {"Cube Map", STextureParams::ttCubeMap},
21+
const xr_token ttype_token[] = {{"2D Texture", STextureParams::ttImage}, {"Cube Map", STextureParams::ttCubeMap},
2122
{"Bump Map", STextureParams::ttBumpMap}, {"Normal Map", STextureParams::ttNormalMap},
2223
{"Terrain", STextureParams::ttTerrain}, {nullptr, 0}};
2324

24-
xr_token tfmt_token[] = {{"DXT1", STextureParams::tfDXT1}, {"DXT1 Alpha", STextureParams::tfADXT1},
25+
const xr_token tfmt_token[] = {{"DXT1", STextureParams::tfDXT1}, {"DXT1 Alpha", STextureParams::tfADXT1},
2526
{"DXT3", STextureParams::tfDXT3}, {"DXT5", STextureParams::tfDXT5}, {"16 bit (1:5:5:5)", STextureParams::tf1555},
2627
{"16 bit (5:6:5)", STextureParams::tf565}, {"32 bit (8:8:8:8)", STextureParams::tfRGBA},
2728
{"8 bit (alpha)", STextureParams::tfA8}, {"8 bit (luminance)", STextureParams::tfL8},
2829
{"16 bit (alpha:luminance)", STextureParams::tfA8L8}, {nullptr, 0}};
2930

30-
xr_token tmtl_token[] = {{"OrenNayar <-> Blin", STextureParams::tmOrenNayar_Blin},
31+
const xr_token tmtl_token[] = {{"OrenNayar <-> Blin", STextureParams::tmOrenNayar_Blin},
3132
{"Blin <-> Phong", STextureParams::tmBlin_Phong}, {"Phong <-> Metal", STextureParams::tmPhong_Metal},
3233
{"Metal <-> OrenNayar", STextureParams::tmMetal_OrenNayar}, {nullptr, 0}};
3334

34-
xr_token tbmode_token[] = {{"None", STextureParams::tbmNone}, {"Use", STextureParams::tbmUse},
35+
const xr_token tbmode_token[] = {{"None", STextureParams::tbmNone}, {"Use", STextureParams::tbmUse},
3536
{"Use parallax", STextureParams::tbmUseParallax}, {nullptr, 0}};
3637

3738
void STextureParams::Load(IReader& F)

src/Layers/xrRender/ETextureParams.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ struct ECORE_API STextureParams
173173
#pragma pack(pop)
174174

175175
struct xr_token;
176-
extern xr_token tparam_token[];
177-
extern xr_token tfmt_token[];
178-
extern xr_token ttype_token[];
176+
extern const xr_token tparam_token[];
177+
extern const xr_token tfmt_token[];
178+
extern const xr_token ttype_token[];
179179

180180
//----------------------------------------------------
181181
#define THM_CHUNK_VERSION 0x0810

src/Layers/xrRender/HW.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "HW.h"
1313
#include "xrEngine/XR_IOConsole.h"
14+
#include "xrCore/xr_token.h"
1415

1516
#ifndef _EDITOR
1617
void fill_vid_mode_list(CHW* _hw);

src/Layers/xrRender/NvTriStripObjects.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ bool NvStripInfo::Unique(NvFaceInfoVec& faceVec, NvFaceInfo* face)
429429
//
430430
// Builds a strip forward as far as we can go, then builds backwards, and joins the two lists
431431
//
432-
void NvStripInfo::Build(NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& faceInfos)
432+
void NvStripInfo::Build(NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& /*faceInfos*/)
433433
{
434434
// used in building the strips forward and backward
435435
static WordVec scratchIndices;
@@ -606,7 +606,7 @@ void NvStripifier::CommitStrips(NvStripInfoVec& allStrips, const NvStripInfoVec&
606606
// Finds the next face to start the next strip on.
607607
//
608608
bool NvStripifier::FindTraversal(
609-
NvFaceInfoVec& faceInfos, NvEdgeInfoVec& edgeInfos, NvStripInfo* strip, NvStripStartInfo& startInfo)
609+
NvFaceInfoVec& /*faceInfos*/, NvEdgeInfoVec& edgeInfos, NvStripInfo* strip, NvStripStartInfo& startInfo)
610610
{
611611
// if the strip was v0->v1 on the edge, then v1 will be a vertex in the next edge.
612612
int v = (strip->m_startInfo.m_toV1 ? strip->m_startInfo.m_startEdge->m_v1 : strip->m_startInfo.m_startEdge->m_v0);
@@ -1021,16 +1021,16 @@ void NvStripifier::SplitUpStripsAndOptimize(
10211021
bestNumHits = -1.0f;
10221022

10231023
// find best strip to add next, given the current cache
1024-
for (int i = 0; i < tempStrips2.size(); i++)
1024+
for (int i2 = 0; i2 < tempStrips2.size(); i2++)
10251025
{
1026-
if (tempStrips2[i]->visited)
1026+
if (tempStrips2[i2]->visited)
10271027
continue;
10281028

1029-
numHits = CalcNumHitsStrip(vcache, tempStrips2[i]);
1029+
numHits = CalcNumHitsStrip(vcache, tempStrips2[i2]);
10301030
if (numHits > bestNumHits)
10311031
{
10321032
bestNumHits = numHits;
1033-
bestIndex = i;
1033+
bestIndex = i2;
10341034
}
10351035
}
10361036

@@ -1276,14 +1276,14 @@ void NvStripifier::FindAllStrips(
12761276

12771277
// build the first strip of the list
12781278
experiments[i][0]->Build(allEdgeInfos, allFaceInfos);
1279-
int experimentId = experiments[i][0]->m_experimentId;
1279+
int experimentId2 = experiments[i][0]->m_experimentId;
12801280

12811281
NvStripInfo* stripIter = experiments[i][0];
12821282
NvStripStartInfo startInfo(nullptr, nullptr, false);
12831283
while (FindTraversal(allFaceInfos, allEdgeInfos, stripIter, startInfo))
12841284
{
12851285
// create the _new strip info
1286-
stripIter = new NvStripInfo(startInfo, stripId++, experimentId);
1286+
stripIter = new NvStripInfo(startInfo, stripId++, experimentId2);
12871287

12881288
// build the next strip
12891289
stripIter->Build(allEdgeInfos, allFaceInfos);

src/Layers/xrRender/R_Backend_DBG.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ void CBackend::dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int vcnt, u16* pIdx,
2020
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
2121
// TODO: DX10: implement
2222
// VERIFY(!"CBackend::dbg_Draw not implemented.");
23+
UNUSED(T);
24+
UNUSED(pVerts);
25+
UNUSED(vcnt);
26+
UNUSED(pIdx);
27+
UNUSED(pcnt);
2328
#else // USE_DX10
2429
OnFrameEnd();
2530
CHK_DX(HW.pDevice->SetFVF(FVF::F_L));
@@ -31,6 +36,9 @@ void CBackend::dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int pcnt)
3136
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
3237
// TODO: DX10: implement
3338
// VERIFY(!"CBackend::dbg_Draw not implemented.");
39+
UNUSED(T);
40+
UNUSED(pVerts);
41+
UNUSED(pcnt);
3442
#else // USE_DX10
3543
OnFrameEnd();
3644
CHK_DX(HW.pDevice->SetFVF(FVF::F_L));

src/Layers/xrRender/R_Backend_Runtime.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ void CBackend::set_ClipPlanes(u32 _enable, Fplane* _planes /*=NULL */, u32 count
151151
// TODO: DX10: Implement in the corresponding vertex shaders
152152
// Use this to set up location, were shader setup code will get data
153153
// VERIFY(!"CBackend::set_ClipPlanes not implemented!");
154+
UNUSED(_enable);
155+
UNUSED(_planes);
156+
UNUSED(count);
154157
return;
155158
#else // USE_DX10
156159
if (0 == HW.Caps.geometry.dwClipPlanes)

src/Layers/xrRender/ResourceManager_Resources.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void CResourceManager::_DeleteConstantTable(const R_constant_table* C)
366366
}
367367

368368
//--------------------------------------------------------------------------------------------------------------
369-
CRT* CResourceManager::_CreateRT(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
369+
CRT* CResourceManager::_CreateRT(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 /*SampleCount*/)
370370
{
371371
R_ASSERT(Name && Name[0] && w && h);
372372

src/Layers/xrRender/SH_RT.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CRT::~CRT()
1919
RImplementation.Resources->_DeleteRT(this);
2020
}
2121

22-
void CRT::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
22+
void CRT::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 /*SampleCount*/)
2323
{
2424
if (pSurface)
2525
return;
@@ -104,7 +104,7 @@ void CRT::destroy()
104104
}
105105
void CRT::reset_begin() { destroy(); }
106106
void CRT::reset_end() { create(*cName, dwWidth, dwHeight, fmt); }
107-
void resptrcode_crt::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
107+
void resptrcode_crt::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 /*SampleCount*/)
108108
{
109109
_set(RImplementation.Resources->_CreateRT(Name, w, h, f));
110110
}

src/Layers/xrRender/SkeletonAnimated.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
#include "AnimationKeyCalculate.h"
88
#include "SkeletonX.h"
99
#include "xrCore/FMesh.hpp"
10+
#include "xrCore/xr_token.h"
1011
#ifdef DEBUG
1112
#include "xrCore/dump_string.h"
1213
#endif
1314
extern int psSkeletonUpdate;
1415
using namespace animation;
16+
1517
//////////////////////////////////////////////////////////////////////////
1618
// BoneInstance methods
1719
void CBlendInstance::construct() { Blend.clear(); }
@@ -72,13 +74,13 @@ std::pair<LPCSTR, LPCSTR> CKinematicsAnimated::LL_MotionDefName_dbg(MotionID ID)
7274

7375
static LPCSTR name_bool(BOOL v)
7476
{
75-
static xr_token token_bool[] = {{"false", 0}, {"true", 1}};
77+
static const xr_token token_bool[] = {{"false", 0}, {"true", 1}};
7678
return get_token_name(token_bool, v);
7779
}
7880

7981
static LPCSTR name_blend_type(CBlend::ECurvature blend)
8082
{
81-
static xr_token token_blend[] = {{"eFREE_SLOT", CBlend::eFREE_SLOT}, {"eAccrue", CBlend::eAccrue},
83+
static const xr_token token_blend[] = {{"eFREE_SLOT", CBlend::eFREE_SLOT}, {"eAccrue", CBlend::eAccrue},
8284
{"eFalloff", CBlend::eFalloff}, {"eFORCEDWORD", CBlend::eFORCEDWORD}};
8385
return get_token_name(token_blend, blend);
8486
}

src/Layers/xrRender/SkeletonX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ void CSkeletonX::_FillVerticesSoft4W(const Fmatrix& view, CSkeletonWallmark& wm,
679679
}
680680

681681
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
682-
void CSkeletonX::_DuplicateIndices(const char* N, IReader* data)
682+
void CSkeletonX::_DuplicateIndices(const char* /*N*/, IReader* data)
683683
{
684684
// We will have trouble with container since don't know were to take readable indices
685685
VERIFY(!data->find_chunk(OGF_ICONTAINER));

0 commit comments

Comments
 (0)