Skip to content

Commit

Permalink
Dependency reductions of and const-ify xr_token. Reduce compiler warn…
Browse files Browse the repository at this point in the history
…ings.
  • Loading branch information
tamlin-mike authored and Xottab-DUTY committed Jan 29, 2018
1 parent 6393ae6 commit 158fe40
Show file tree
Hide file tree
Showing 71 changed files with 277 additions and 220 deletions.
11 changes: 6 additions & 5 deletions src/Layers/xrRender/ETextureParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#pragma hdrstop

#include "ETextureParams.h"
#include "xrCore/xr_token.h"

xr_token tparam_token[] = {{"Advanced", STextureParams::kMIPFilterAdvanced},
const xr_token tparam_token[] = {{"Advanced", STextureParams::kMIPFilterAdvanced},

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

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

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

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

xr_token tbmode_token[] = {{"None", STextureParams::tbmNone}, {"Use", STextureParams::tbmUse},
const xr_token tbmode_token[] = {{"None", STextureParams::tbmNone}, {"Use", STextureParams::tbmUse},
{"Use parallax", STextureParams::tbmUseParallax}, {nullptr, 0}};

void STextureParams::Load(IReader& F)
Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRender/ETextureParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ struct ECORE_API STextureParams
#pragma pack(pop)

struct xr_token;
extern xr_token tparam_token[];
extern xr_token tfmt_token[];
extern xr_token ttype_token[];
extern const xr_token tparam_token[];
extern const xr_token tfmt_token[];
extern const xr_token ttype_token[];

//----------------------------------------------------
#define THM_CHUNK_VERSION 0x0810
Expand Down
1 change: 1 addition & 0 deletions src/Layers/xrRender/HW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "HW.h"
#include "xrEngine/XR_IOConsole.h"
#include "xrCore/xr_token.h"

#ifndef _EDITOR
void fill_vid_mode_list(CHW* _hw);
Expand Down
16 changes: 8 additions & 8 deletions src/Layers/xrRender/NvTriStripObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ bool NvStripInfo::Unique(NvFaceInfoVec& faceVec, NvFaceInfo* face)
//
// Builds a strip forward as far as we can go, then builds backwards, and joins the two lists
//
void NvStripInfo::Build(NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& faceInfos)
void NvStripInfo::Build(NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& /*faceInfos*/)
{
// used in building the strips forward and backward
static WordVec scratchIndices;
Expand Down Expand Up @@ -606,7 +606,7 @@ void NvStripifier::CommitStrips(NvStripInfoVec& allStrips, const NvStripInfoVec&
// Finds the next face to start the next strip on.
//
bool NvStripifier::FindTraversal(
NvFaceInfoVec& faceInfos, NvEdgeInfoVec& edgeInfos, NvStripInfo* strip, NvStripStartInfo& startInfo)
NvFaceInfoVec& /*faceInfos*/, NvEdgeInfoVec& edgeInfos, NvStripInfo* strip, NvStripStartInfo& startInfo)
{
// if the strip was v0->v1 on the edge, then v1 will be a vertex in the next edge.
int v = (strip->m_startInfo.m_toV1 ? strip->m_startInfo.m_startEdge->m_v1 : strip->m_startInfo.m_startEdge->m_v0);
Expand Down Expand Up @@ -1021,16 +1021,16 @@ void NvStripifier::SplitUpStripsAndOptimize(
bestNumHits = -1.0f;

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

numHits = CalcNumHitsStrip(vcache, tempStrips2[i]);
numHits = CalcNumHitsStrip(vcache, tempStrips2[i2]);
if (numHits > bestNumHits)
{
bestNumHits = numHits;
bestIndex = i;
bestIndex = i2;
}
}

Expand Down Expand Up @@ -1276,14 +1276,14 @@ void NvStripifier::FindAllStrips(

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

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

// build the next strip
stripIter->Build(allEdgeInfos, allFaceInfos);
Expand Down
8 changes: 8 additions & 0 deletions src/Layers/xrRender/R_Backend_DBG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ void CBackend::dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int vcnt, u16* pIdx,
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
// TODO: DX10: implement
// VERIFY(!"CBackend::dbg_Draw not implemented.");
UNUSED(T);
UNUSED(pVerts);
UNUSED(vcnt);
UNUSED(pIdx);
UNUSED(pcnt);
#else // USE_DX10
OnFrameEnd();
CHK_DX(HW.pDevice->SetFVF(FVF::F_L));
Expand All @@ -31,6 +36,9 @@ void CBackend::dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int pcnt)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
// TODO: DX10: implement
// VERIFY(!"CBackend::dbg_Draw not implemented.");
UNUSED(T);
UNUSED(pVerts);
UNUSED(pcnt);
#else // USE_DX10
OnFrameEnd();
CHK_DX(HW.pDevice->SetFVF(FVF::F_L));
Expand Down
3 changes: 3 additions & 0 deletions src/Layers/xrRender/R_Backend_Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ void CBackend::set_ClipPlanes(u32 _enable, Fplane* _planes /*=NULL */, u32 count
// TODO: DX10: Implement in the corresponding vertex shaders
// Use this to set up location, were shader setup code will get data
// VERIFY(!"CBackend::set_ClipPlanes not implemented!");
UNUSED(_enable);
UNUSED(_planes);
UNUSED(count);
return;
#else // USE_DX10
if (0 == HW.Caps.geometry.dwClipPlanes)
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void CResourceManager::_DeleteConstantTable(const R_constant_table* C)
}

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

Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/SH_RT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CRT::~CRT()
RImplementation.Resources->_DeleteRT(this);
}

void CRT::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
void CRT::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 /*SampleCount*/)
{
if (pSurface)
return;
Expand Down Expand Up @@ -104,7 +104,7 @@ void CRT::destroy()
}
void CRT::reset_begin() { destroy(); }
void CRT::reset_end() { create(*cName, dwWidth, dwHeight, fmt); }
void resptrcode_crt::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 SampleCount)
void resptrcode_crt::create(LPCSTR Name, u32 w, u32 h, D3DFORMAT f, u32 /*SampleCount*/)
{
_set(RImplementation.Resources->_CreateRT(Name, w, h, f));
}
Expand Down
6 changes: 4 additions & 2 deletions src/Layers/xrRender/SkeletonAnimated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
#include "AnimationKeyCalculate.h"
#include "SkeletonX.h"
#include "xrCore/FMesh.hpp"
#include "xrCore/xr_token.h"
#ifdef DEBUG
#include "xrCore/dump_string.h"
#endif
extern int psSkeletonUpdate;
using namespace animation;

//////////////////////////////////////////////////////////////////////////
// BoneInstance methods
void CBlendInstance::construct() { Blend.clear(); }
Expand Down Expand Up @@ -72,13 +74,13 @@ std::pair<LPCSTR, LPCSTR> CKinematicsAnimated::LL_MotionDefName_dbg(MotionID ID)

static LPCSTR name_bool(BOOL v)
{
static xr_token token_bool[] = {{"false", 0}, {"true", 1}};
static const xr_token token_bool[] = {{"false", 0}, {"true", 1}};
return get_token_name(token_bool, v);
}

static LPCSTR name_blend_type(CBlend::ECurvature blend)
{
static xr_token token_blend[] = {{"eFREE_SLOT", CBlend::eFREE_SLOT}, {"eAccrue", CBlend::eAccrue},
static const xr_token token_blend[] = {{"eFREE_SLOT", CBlend::eFREE_SLOT}, {"eAccrue", CBlend::eAccrue},
{"eFalloff", CBlend::eFalloff}, {"eFORCEDWORD", CBlend::eFORCEDWORD}};
return get_token_name(token_blend, blend);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/SkeletonX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ void CSkeletonX::_FillVerticesSoft4W(const Fmatrix& view, CSkeletonWallmark& wm,
}

#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
void CSkeletonX::_DuplicateIndices(const char* N, IReader* data)
void CSkeletonX::_DuplicateIndices(const char* /*N*/, IReader* data)
{
// We will have trouble with container since don't know were to take readable indices
VERIFY(!data->find_chunk(OGF_ICONTAINER));
Expand Down
3 changes: 3 additions & 0 deletions src/Layers/xrRender/blenders/Blender_Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ void CBlender_Compile::StageSET_XForm(u32 tf, u32 tc)
#ifdef _EDITOR
RS.SetTSS(Stage(), D3DTSS_TEXTURETRANSFORMFLAGS, tf);
RS.SetTSS(Stage(), D3DTSS_TEXCOORDINDEX, tc);
#else
UNUSED(tf);
UNUSED(tc);
#endif
}
void CBlender_Compile::StageSET_Color(u32 a1, u32 op, u32 a2) { RS.SetColor(Stage(), a1, op, a2); }
Expand Down
1 change: 1 addition & 0 deletions src/Layers/xrRender/dxDebugRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void dxDebugRender::SetAmbient(u32 colour)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
// TODO: DX10: Check if need this for DX10
VERIFY(!"Not implemented for DX10");
UNUSED(colour);
#else // USE_DX10
CHK_DX(HW.pDevice->SetRenderState(D3DRS_AMBIENT, colour));
#endif // USE_DX10
Expand Down
18 changes: 9 additions & 9 deletions src/Layers/xrRender/r__dsgraph_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic(dxRender_Visual* pVisual, Fvector&
#if RENDER != R_R1
if (sh->flags.bEmissive)
{
mapSorted_Node* N = mapHUDEmissive.insertInAnyWay(distSQ);
N->val.ssa = SSA;
N->val.pObject = RI.val_pObject;
N->val.pVisual = pVisual;
N->val.Matrix = *RI.val_pTransform;
N->val.se = &*pVisual->shader->E[4]; // 4=L_special
mapSorted_Node* N2 = mapHUDEmissive.insertInAnyWay(distSQ);
N2->val.ssa = SSA;
N2->val.pObject = RI.val_pObject;
N2->val.pVisual = pVisual;
N2->val.Matrix = *RI.val_pTransform;
N2->val.se = &*pVisual->shader->E[4]; // 4=L_special
}
#endif // RENDER!=R_R1
return;
Expand Down Expand Up @@ -627,10 +627,10 @@ BOOL CRender::add_Dynamic(dxRender_Visual* pVisual, u32 planes)
BOOL _use_lod = FALSE;
if (pV->m_lod)
{
Fvector Tpos;
Fvector Tpos2;
float D;
val_pTransform->transform_tiny(Tpos, pV->vis.sphere.P);
float ssa = CalcSSA(D, Tpos, pV->vis.sphere.R / 2.f); // assume dynamics never consume full sphere
val_pTransform->transform_tiny(Tpos2, pV->vis.sphere.P);
float ssa = CalcSSA(D, Tpos2, pV->vis.sphere.R / 2.f); // assume dynamics never consume full sphere
if (ssa < r_ssaLOD_A)
_use_lod = TRUE;
}
Expand Down
16 changes: 8 additions & 8 deletions src/Layers/xrRender/r__screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,18 @@ void CRender::ScreenshotImpl(ScreenshotMode mode, LPCSTR name, CMemoryWriter* me
{ // hq
xr_sprintf(buf, sizeof buf, "ssq_%s_%s_(%s).tga", Core.UserName, timestamp(t_stemp),
g_pGameLevel ? g_pGameLevel->name().c_str() : "mainmenu");
ID3DBlob* saved = nullptr;
ID3DBlob* saved2 = nullptr;
#ifdef USE_DX11
CHK_DX(D3DX11SaveTextureToMemory(HW.pContext, pSrcTexture, D3DX11_IFF_BMP, &saved, 0));
CHK_DX(D3DX11SaveTextureToMemory(HW.pContext, pSrcTexture, D3DX11_IFF_BMP, &saved2, 0));
#else
CHK_DX(D3DX10SaveTextureToMemory(pSrcTexture, D3DX10_IFF_BMP, &saved, 0));
CHK_DX(D3DX10SaveTextureToMemory(pSrcTexture, D3DX10_IFF_BMP, &saved2, 0));
//CHK_DX(D3DXSaveSurfaceToFileInMemory(&saved, D3DXIFF_TGA, pFB, 0, 0));
#endif
IWriter* fs = FS.w_open("$screenshots$", buf);
R_ASSERT(fs);
fs->w(saved->GetBufferPointer(), (u32)saved->GetBufferSize());
FS.w_close(fs);
_RELEASE(saved);
IWriter* fs2 = FS.w_open("$screenshots$", buf);
R_ASSERT(fs2);
fs2->w(saved2->GetBufferPointer(), (u32)saved2->GetBufferSize());
FS.w_close(fs2);
_RELEASE(saved2);
}
}
break;
Expand Down
Loading

0 comments on commit 158fe40

Please sign in to comment.