Assert: Uppercase assertion macros

Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
This commit is contained in:
Lioncash
2018-03-14 20:34:35 -04:00
parent 19d97f3fd9
commit 50a476c371
135 changed files with 719 additions and 741 deletions

View File

@ -35,12 +35,12 @@ void AbstractStagingTexture::CopyToTexture(AbstractTexture* dst, u32 dst_layer,
void AbstractStagingTexture::ReadTexels(const MathUtil::Rectangle<int>& rect, void* out_ptr,
u32 out_stride)
{
_assert_(m_type != StagingTextureType::Upload);
ASSERT(m_type != StagingTextureType::Upload);
if (!PrepareForAccess())
return;
_assert_(rect.left >= 0 && static_cast<u32>(rect.right) <= m_config.width && rect.top >= 0 &&
static_cast<u32>(rect.bottom) <= m_config.height);
ASSERT(rect.left >= 0 && static_cast<u32>(rect.right) <= m_config.width && rect.top >= 0 &&
static_cast<u32>(rect.bottom) <= m_config.height);
// Offset pointer to point to start of region being copied out.
const char* current_ptr = m_map_pointer;
@ -68,11 +68,11 @@ void AbstractStagingTexture::ReadTexels(const MathUtil::Rectangle<int>& rect, vo
void AbstractStagingTexture::ReadTexel(u32 x, u32 y, void* out_ptr)
{
_assert_(m_type != StagingTextureType::Upload);
ASSERT(m_type != StagingTextureType::Upload);
if (!PrepareForAccess())
return;
_assert_(x < m_config.width && y < m_config.height);
ASSERT(x < m_config.width && y < m_config.height);
const char* src_ptr = m_map_pointer + y * m_map_stride + x * m_texel_size;
std::memcpy(out_ptr, src_ptr, m_texel_size);
}
@ -80,12 +80,12 @@ void AbstractStagingTexture::ReadTexel(u32 x, u32 y, void* out_ptr)
void AbstractStagingTexture::WriteTexels(const MathUtil::Rectangle<int>& rect, const void* in_ptr,
u32 in_stride)
{
_assert_(m_type != StagingTextureType::Readback);
ASSERT(m_type != StagingTextureType::Readback);
if (!PrepareForAccess())
return;
_assert_(rect.left >= 0 && static_cast<u32>(rect.right) <= m_config.width && rect.top >= 0 &&
static_cast<u32>(rect.bottom) <= m_config.height);
ASSERT(rect.left >= 0 && static_cast<u32>(rect.right) <= m_config.width && rect.top >= 0 &&
static_cast<u32>(rect.bottom) <= m_config.height);
// Offset pointer to point to start of region being copied to.
char* current_ptr = m_map_pointer;
@ -112,11 +112,11 @@ void AbstractStagingTexture::WriteTexels(const MathUtil::Rectangle<int>& rect, c
void AbstractStagingTexture::WriteTexel(u32 x, u32 y, const void* in_ptr)
{
_assert_(m_type != StagingTextureType::Readback);
ASSERT(m_type != StagingTextureType::Readback);
if (!PrepareForAccess())
return;
_assert_(x < m_config.width && y < m_config.height);
ASSERT(x < m_config.width && y < m_config.height);
char* dest_ptr = m_map_pointer + y * m_map_stride + x * m_texel_size;
std::memcpy(dest_ptr, in_ptr, m_texel_size);
}

View File

@ -20,8 +20,8 @@ bool AbstractTexture::Save(const std::string& filename, unsigned int level)
// We can't dump compressed textures currently (it would mean drawing them to a RGBA8
// framebuffer, and saving that). TextureCache does not call Save for custom textures
// anyway, so this is fine for now.
_assert_(!IsCompressedFormat(m_config.format));
_assert_(level < m_config.levels);
ASSERT(!IsCompressedFormat(m_config.format));
ASSERT(level < m_config.levels);
// Determine dimensions of image we want to save.
u32 level_width = std::max(1u, m_config.width >> level);

View File

@ -17,7 +17,7 @@ AsyncShaderCompiler::~AsyncShaderCompiler()
{
// Pending work can be left at shutdown.
// The work item classes are expected to clean up after themselves.
_assert_(!HasWorkerThreads());
ASSERT(!HasWorkerThreads());
}
void AsyncShaderCompiler::QueueWorkItem(WorkItemPtr item)

View File

@ -333,16 +333,16 @@ void GatherPipeBursted()
Fifo::RunGpu();
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
"FIFO is overflowed by GatherPipe !\nCPU thread is too fast!");
ASSERT_MSG(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
"FIFO is overflowed by GatherPipe !\nCPU thread is too fast!");
// check if we are in sync
_assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer,
"FIFOs linked but out of sync");
_assert_msg_(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase,
"FIFOs linked but out of sync");
_assert_msg_(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd,
"FIFOs linked but out of sync");
ASSERT_MSG(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer,
"FIFOs linked but out of sync");
ASSERT_MSG(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase,
"FIFOs linked but out of sync");
ASSERT_MSG(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd,
"FIFOs linked but out of sync");
}
void UpdateInterrupts(u64 userdata)

View File

@ -342,10 +342,10 @@ void RunGpuLoop()
else
readPtr += 32;
_assert_msg_(COMMANDPROCESSOR, (s32)fifo.CPReadWriteDistance - 32 >= 0,
"Negative fifo.CPReadWriteDistance = %i in FIFO Loop !\nThat can produce "
"instability in the game. Please report it.",
fifo.CPReadWriteDistance - 32);
ASSERT_MSG(COMMANDPROCESSOR, (s32)fifo.CPReadWriteDistance - 32 >= 0,
"Negative fifo.CPReadWriteDistance = %i in FIFO Loop !\nThat can produce "
"instability in the game. Please report it.",
fifo.CPReadWriteDistance - 32);
u8* write_ptr = s_video_buffer_write_ptr;
s_video_buffer_read_ptr = OpcodeDecoder::Run(

View File

@ -67,7 +67,7 @@ static void GenerateLightShader(ShaderCode& object, const LightingUidData& uid_d
swizzle_components, LIGHT_COL_PARAMS(index, swizzle));
break;
default:
_assert_(0);
ASSERT(0);
}
object.Write("\n");

View File

@ -947,7 +947,7 @@ static void WriteStage(ShaderCode& out, const pixel_shader_uid_data* uid_data, i
}
else if (tevind.mid <= 7 && bHasTexCoord)
{ // s matrix
_assert_(tevind.mid >= 5);
ASSERT(tevind.mid >= 5);
int mtxidx = 2 * (tevind.mid - 5);
out.SetConstantsUsed(C_INDTEXMTX + mtxidx, C_INDTEXMTX + mtxidx);
@ -969,7 +969,7 @@ static void WriteStage(ShaderCode& out, const pixel_shader_uid_data* uid_data, i
}
else if (tevind.mid <= 11 && bHasTexCoord)
{ // t matrix
_assert_(tevind.mid >= 9);
ASSERT(tevind.mid >= 9);
int mtxidx = 2 * (tevind.mid - 9);
out.SetConstantsUsed(C_INDTEXMTX + mtxidx, C_INDTEXMTX + mtxidx);

View File

@ -761,7 +761,7 @@ void Renderer::RenderFrameDump()
TextureConfig config(target_width, target_height, 1, 1, 1, AbstractTextureFormat::RGBA8, true);
m_frame_dump_render_texture.reset();
m_frame_dump_render_texture = CreateTexture(config);
_assert_(m_frame_dump_render_texture);
ASSERT(m_frame_dump_render_texture);
}
// Scaling is likely to occur here, but if possible, do a bit-for-bit copy.

View File

@ -1971,7 +1971,7 @@ void TextureCacheBase::TCacheEntry::SetXfbCopy(u32 stride)
is_xfb_copy = true;
memory_stride = stride;
_assert_msg_(VIDEO, memory_stride >= BytesPerRow(), "Memory stride is too small");
ASSERT_MSG(VIDEO, memory_stride >= BytesPerRow(), "Memory stride is too small");
size_in_bytes = memory_stride * NumBlocksY();
}
@ -1982,7 +1982,7 @@ void TextureCacheBase::TCacheEntry::SetEfbCopy(u32 stride)
is_xfb_copy = false;
memory_stride = stride;
_assert_msg_(VIDEO, memory_stride >= BytesPerRow(), "Memory stride is too small");
ASSERT_MSG(VIDEO, memory_stride >= BytesPerRow(), "Memory stride is too small");
size_in_bytes = memory_stride * NumBlocksY();
}

View File

@ -244,7 +244,7 @@ void VertexLoader::CompileVertexTranslator()
WriteCall(Color_ReadDirect_32b_8888);
break;
default:
_assert_(0);
ASSERT(0);
break;
}
break;
@ -271,7 +271,7 @@ void VertexLoader::CompileVertexTranslator()
WriteCall(Color_ReadIndex8_32b_8888);
break;
default:
_assert_(0);
ASSERT(0);
break;
}
break;
@ -298,7 +298,7 @@ void VertexLoader::CompileVertexTranslator()
WriteCall(Color_ReadIndex16_32b_8888);
break;
default:
_assert_(0);
ASSERT(0);
break;
}
break;
@ -325,12 +325,12 @@ void VertexLoader::CompileVertexTranslator()
if (tc[i] != NOT_PRESENT)
{
_assert_msg_(VIDEO, DIRECT <= tc[i] && tc[i] <= INDEX16,
"Invalid texture coordinates!\n(tc[i] = %d)", (u32)tc[i]);
_assert_msg_(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT,
"Invalid texture coordinates format!\n(format = %d)", format);
_assert_msg_(VIDEO, 0 <= elements && elements <= 1,
"Invalid number of texture coordinates elements!\n(elements = %d)", elements);
ASSERT_MSG(VIDEO, DIRECT <= tc[i] && tc[i] <= INDEX16,
"Invalid texture coordinates!\n(tc[i] = %d)", (u32)tc[i]);
ASSERT_MSG(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT,
"Invalid texture coordinates format!\n(format = %d)", format);
ASSERT_MSG(VIDEO, 0 <= elements && elements <= 1,
"Invalid number of texture coordinates elements!\n(elements = %d)", elements);
components |= VB_HAS_UV0 << i;
WriteCall(VertexLoader_TextCoord::GetFunction(tc[i], format, elements));

View File

@ -329,19 +329,19 @@ void LoadCPReg(u32 sub_cmd, u32 value, bool is_preprocess)
break;
case 0x70:
_assert_((sub_cmd & 0x0F) < 8);
ASSERT((sub_cmd & 0x0F) < 8);
state->vtx_attr[sub_cmd & 7].g0.Hex = value;
state->attr_dirty[sub_cmd & 7] = true;
break;
case 0x80:
_assert_((sub_cmd & 0x0F) < 8);
ASSERT((sub_cmd & 0x0F) < 8);
state->vtx_attr[sub_cmd & 7].g1.Hex = value;
state->attr_dirty[sub_cmd & 7] = true;
break;
case 0x90:
_assert_((sub_cmd & 0x0F) < 8);
ASSERT((sub_cmd & 0x0F) < 8);
state->vtx_attr[sub_cmd & 7].g2.Hex = value;
state->attr_dirty[sub_cmd & 7] = true;
break;

View File

@ -21,8 +21,8 @@ VertexShaderUid GetVertexShaderUid()
vertex_shader_uid_data* uid_data = out.GetUidData<vertex_shader_uid_data>();
memset(uid_data, 0, sizeof(*uid_data));
_assert_(bpmem.genMode.numtexgens == xfmem.numTexGen.numTexGens);
_assert_(bpmem.genMode.numcolchans == xfmem.numChan.numColorChans);
ASSERT(bpmem.genMode.numtexgens == xfmem.numTexGen.numTexGens);
ASSERT(bpmem.genMode.numcolchans == xfmem.numChan.numColorChans);
uid_data->numTexGens = xfmem.numTexGen.numTexGens;
uid_data->components = VertexLoaderManager::g_current_components;
@ -262,8 +262,8 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
}
break;
case XF_SRCCOLORS_INROW:
_assert_(texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 ||
texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1);
ASSERT(texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 ||
texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1);
break;
case XF_SRCBINORMAL_T_INROW:
if (uid_data->components & VB_HAS_NRM1)
@ -278,7 +278,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
}
break;
default:
_assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW);
ASSERT(texinfo.sourcerow <= XF_SRCTEX7_INROW);
if (uid_data->components & (VB_HAS_UV0 << (texinfo.sourcerow - XF_SRCTEX0_INROW)))
out.Write("coord = float4(rawtex%d.x, rawtex%d.y, 1.0, 1.0);\n",
texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW);
@ -307,7 +307,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
{
// The following assert was triggered in House of the Dead Overkill and Star Wars Rogue
// Squadron 2
//_assert_(0); // should have normals
// ASSERT(0); // should have normals
out.Write("o.tex%d.xyz = o.tex%d.xyz;\n", i, texinfo.embosssourceshift);
}

View File

@ -99,11 +99,9 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
break;
case XFMEM_SETMATRIXINDA:
//_assert_msg_(GX_XF, 0, "XF matrixindex0");
VertexShaderManager::SetTexMatrixChangedA(newValue);
break;
case XFMEM_SETMATRIXINDB:
//_assert_msg_(GX_XF, 0, "XF matrixindex1");
VertexShaderManager::SetTexMatrixChangedB(newValue);
break;