Merge pull request #4237 from lioncash/const

Software: const correctness
This commit is contained in:
Markus Wick 2016-09-23 10:24:55 +02:00 committed by GitHub
commit 9d85d9b000
8 changed files with 28 additions and 21 deletions

View File

@ -72,7 +72,7 @@ enum
CLIP_NEG_Z_BIT = 0x20
};
static inline int CalcClipMask(OutputVertexData* v)
static inline int CalcClipMask(const OutputVertexData* v)
{
int cmask = 0;
Vec4 pos = v->projectedPosition;
@ -329,7 +329,7 @@ void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexDat
}
}
static void CopyVertex(OutputVertexData* dst, OutputVertexData* src, float dx, float dy,
static void CopyVertex(OutputVertexData* dst, const OutputVertexData* src, float dx, float dy,
unsigned int sOffset)
{
dst->screenPosition.x = src->screenPosition.x + dx;
@ -403,7 +403,8 @@ void ProcessLine(OutputVertexData* lineV0, OutputVertexData* lineV1)
}
}
bool CullTest(OutputVertexData* v0, OutputVertexData* v1, OutputVertexData* v2, bool& backface)
bool CullTest(const OutputVertexData* v0, const OutputVertexData* v1, const OutputVertexData* v2,
bool& backface)
{
int mask = CalcClipMask(v0);
mask &= CalcClipMask(v1);

View File

@ -14,7 +14,8 @@ void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexDat
void ProcessLine(OutputVertexData* v0, OutputVertexData* v1);
bool CullTest(OutputVertexData* v0, OutputVertexData* v1, OutputVertexData* v2, bool& backface);
bool CullTest(const OutputVertexData* v0, const OutputVertexData* v1, const OutputVertexData* v2,
bool& backface);
void PerspectiveDivide(OutputVertexData* vertex);
}

View File

@ -154,7 +154,8 @@ static void DumpEfb(const std::string& filename)
delete[] data;
}
void DrawObjectBuffer(s16 x, s16 y, u8* color, int bufferBase, int subBuffer, const char* name)
void DrawObjectBuffer(s16 x, s16 y, const u8* color, int bufferBase, int subBuffer,
const char* name)
{
int buffer = bufferBase + subBuffer;
@ -170,7 +171,7 @@ void DrawObjectBuffer(s16 x, s16 y, u8* color, int bufferBase, int subBuffer, co
BufferBase[buffer] = bufferBase;
}
void DrawTempBuffer(u8* color, int buffer)
void DrawTempBuffer(const u8* color, int buffer)
{
u8* dst = (u8*)&TempBuffer[buffer];
*(dst++) = color[2];

View File

@ -4,7 +4,7 @@
#pragma once
#include "Common/Common.h"
#include "Common/CommonTypes.h"
namespace DebugUtil
{
@ -18,8 +18,9 @@ void DumpActiveTextures();
void OnObjectBegin();
void OnObjectEnd();
void DrawObjectBuffer(s16 x, s16 y, u8* color, int bufferBase, int subBuffer, const char* name);
void DrawObjectBuffer(s16 x, s16 y, const u8* color, int bufferBase, int subBuffer,
const char* name);
void DrawTempBuffer(u8* color, int buffer);
void DrawTempBuffer(const u8* color, int buffer);
void CopyTempBuffer(s16 x, s16 y, int bufferBase, int subBuffer, const char* name);
}

View File

@ -44,7 +44,7 @@ struct OutputVertexData
u8 color[2][4] = {};
Vec3 texCoords[8] = {};
void Lerp(float t, OutputVertexData* a, OutputVertexData* b)
void Lerp(float t, const OutputVertexData* a, const OutputVertexData* b)
{
#define LINTERP(T, OUT, IN) (OUT) + ((IN - OUT) * T)

View File

@ -264,7 +264,8 @@ static void BuildBlock(s32 blockX, s32 blockY)
}
}
void DrawTriangleFrontFace(OutputVertexData* v0, OutputVertexData* v1, OutputVertexData* v2)
void DrawTriangleFrontFace(const OutputVertexData* v0, const OutputVertexData* v1,
const OutputVertexData* v2)
{
INCSTAT(stats.thisFrame.numTrianglesDrawn);

View File

@ -12,7 +12,8 @@ namespace Rasterizer
{
void Init();
void DrawTriangleFrontFace(OutputVertexData* v0, OutputVertexData* v1, OutputVertexData* v2);
void DrawTriangleFrontFace(const OutputVertexData* v0, const OutputVertexData* v1,
const OutputVertexData* v2);
void SetTevReg(int reg, int comp, s16 color);
@ -22,7 +23,7 @@ struct Slope
float dfdy;
float f0;
float GetValue(float dx, float dy) { return f0 + (dfdx * dx) + (dfdy * dy); }
float GetValue(float dx, float dy) const { return f0 + (dfdx * dx) + (dfdy * dy); }
};
struct RasterBlockPixel

View File

@ -157,7 +157,7 @@ static inline void BoxfilterRGB_to_RGB8(const u8* src, u8* r, u8* g, u8* b)
*b = b16 >> 2;
}
static inline void BoxfilterRGB_to_x8(u8* src, u8* x8, int comp)
static inline void BoxfilterRGB_to_x8(const u8* src, u8* x8, int comp)
{
u16 x16 = 0;
@ -260,7 +260,7 @@ static void SetSpans(int sBlkSize, int tBlkSize, s32* tSpan, s32* sBlkSpan, s32*
dstBlockStart += writeStride; \
}
static void EncodeRGBA6(u8* dst, u8* src, u32 format)
static void EncodeRGBA6(u8* dst, const u8* src, u32 format)
{
u16 sBlkCount, tBlkCount, sBlkSize, tBlkSize;
s32 tSpan, sBlkSpan, tBlkSpan, writeStride;
@ -499,7 +499,7 @@ static void EncodeRGBA6(u8* dst, u8* src, u32 format)
}
}
static void EncodeRGBA6halfscale(u8* dst, u8* src, u32 format)
static void EncodeRGBA6halfscale(u8* dst, const u8* src, u32 format)
{
u16 sBlkCount, tBlkCount, sBlkSize, tBlkSize;
s32 tSpan, sBlkSpan, tBlkSpan, writeStride;
@ -734,7 +734,7 @@ static void EncodeRGBA6halfscale(u8* dst, u8* src, u32 format)
}
}
static void EncodeRGB8(u8* dst, u8* src, u32 format)
static void EncodeRGB8(u8* dst, const u8* src, u32 format)
{
u16 sBlkCount, tBlkCount, sBlkSize, tBlkSize;
s32 tSpan, sBlkSpan, tBlkSpan, writeStride;
@ -946,7 +946,7 @@ static void EncodeRGB8(u8* dst, u8* src, u32 format)
}
}
static void EncodeRGB8halfscale(u8* dst, u8* src, u32 format)
static void EncodeRGB8halfscale(u8* dst, const u8* src, u32 format)
{
u16 sBlkCount, tBlkCount, sBlkSize, tBlkSize;
s32 tSpan, sBlkSpan, tBlkSpan, writeStride;
@ -1174,7 +1174,7 @@ static void EncodeRGB8halfscale(u8* dst, u8* src, u32 format)
}
}
static void EncodeZ24(u8* dst, u8* src, u32 format)
static void EncodeZ24(u8* dst, const u8* src, u32 format)
{
u16 sBlkCount, tBlkCount, sBlkSize, tBlkSize;
s32 tSpan, sBlkSpan, tBlkSpan, writeStride;
@ -1278,7 +1278,7 @@ static void EncodeZ24(u8* dst, u8* src, u32 format)
}
}
static void EncodeZ24halfscale(u8* dst, u8* src, u32 format)
static void EncodeZ24halfscale(u8* dst, const u8* src, u32 format)
{
u16 sBlkCount, tBlkCount, sBlkSize, tBlkSize;
s32 tSpan, sBlkSpan, tBlkSpan, writeStride;
@ -1409,7 +1409,8 @@ void Encode(u8* dest_ptr)
else if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !bIsIntensityFmt))
format |= _GX_TF_CTF;
u8* src = EfbInterface::GetPixelPointer(bpmem.copyTexSrcXY.x, bpmem.copyTexSrcXY.y, bFromZBuffer);
const u8* src =
EfbInterface::GetPixelPointer(bpmem.copyTexSrcXY.x, bpmem.copyTexSrcXY.y, bFromZBuffer);
if (bpmem.triggerEFBCopy.half_scale)
{