Cleaning up asserts and file/line macros.

This commit is contained in:
Ben Vanik
2014-07-12 16:51:52 -07:00
parent 840357413c
commit bf882714d0
92 changed files with 636 additions and 613 deletions

View File

@@ -53,7 +53,7 @@ int D3D11IndexBufferResource::InvalidateRegion(
SCOPE_profile_cpu_f("gpu");
// All that's done so far:
XEASSERT(info_.endianness == 0x2);
assert_true(info_.endianness == 0x2);
D3D11_MAPPED_SUBRESOURCE res;
HRESULT hr = resource_cache_->context()->Map(

View File

@@ -33,8 +33,8 @@ D3D11GraphicsSystem::~D3D11GraphicsSystem() {
void D3D11GraphicsSystem::Initialize() {
GraphicsSystem::Initialize();
XEASSERTNULL(timer_queue_);
XEASSERTNULL(vsync_timer_);
assert_null(timer_queue_);
assert_null(vsync_timer_);
timer_queue_ = CreateTimerQueue();
CreateTimerQueueTimer(
@@ -111,7 +111,7 @@ void D3D11GraphicsSystem::Initialize() {
// Create the window.
// This will pump through the run-loop and and be where our swapping
// will take place.
XEASSERTNULL(window_);
assert_null(window_);
window_ = new D3D11Window(run_loop_, dxgi_factory_, device_);
if (window_->Initialize("Xenia D3D11", 1280, 720)) {
XELOGE("Failed to create D3D11Window");
@@ -126,7 +126,7 @@ void D3D11GraphicsSystem::Initialize() {
// Create the driver.
// This runs in the worker thread and builds command lines to present
// in the window.
XEASSERTNULL(driver_);
assert_null(driver_);
driver_ = new D3D11GraphicsDriver(
memory_, window_->swap_chain(), device_);
if (driver_->Initialize()) {
@@ -180,7 +180,7 @@ void __stdcall D3D11GraphicsSystem::VsyncCallback(D3D11GraphicsSystem* gs,
void D3D11GraphicsSystem::Shutdown() {
GraphicsSystem::Shutdown();
if (vsync_timer_) {
DeleteTimerQueueTimer(timer_queue_, vsync_timer_, NULL);
}

View File

@@ -140,7 +140,7 @@ D3D11ProfilerDisplay::D3D11ProfilerDisplay(D3D11Window* window) : window_(window
!SetupShaders() ||
!SetupFont()) {
// Hrm.
XEASSERTALWAYS();
assert_always();
}
// Pass through mouse events.
@@ -183,7 +183,7 @@ bool D3D11ProfilerDisplay::SetupState() {
blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blend_desc.RenderTarget[0].RenderTargetWriteMask = 0x0F;
hr = device->CreateBlendState(&blend_desc, &blend_state_);
XEASSERT(SUCCEEDED(hr));
assert_true(SUCCEEDED(hr));
D3D11_DEPTH_STENCIL_DESC depth_stencil_desc;
xe_zero_struct(&depth_stencil_desc, sizeof(depth_stencil_desc));
@@ -191,7 +191,7 @@ bool D3D11ProfilerDisplay::SetupState() {
depth_stencil_desc.StencilEnable = false;
depth_stencil_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
hr = device->CreateDepthStencilState(&depth_stencil_desc, &depth_stencil_state_);
XEASSERT(SUCCEEDED(hr));
assert_true(SUCCEEDED(hr));
return true;
}
@@ -484,7 +484,7 @@ D3D11ProfilerDisplay::Vertex* D3D11ProfilerDisplay::AllocateVertices(
if (draw_state_.vertex_index + count > XECOUNT(draw_state_.vertex_buffer)) {
Flush();
}
XEASSERT(draw_state_.vertex_index + count <= XECOUNT(draw_state_.vertex_buffer));
assert_true(draw_state_.vertex_index + count <= XECOUNT(draw_state_.vertex_buffer));
size_t head = draw_state_.vertex_index;
draw_state_.vertex_index += count;
@@ -493,7 +493,7 @@ D3D11ProfilerDisplay::Vertex* D3D11ProfilerDisplay::AllocateVertices(
draw_state_.commands[draw_state_.command_index - 1].primitive == primitive) {
draw_state_.commands[draw_state_.command_index - 1].vertex_count += count;
} else {
XEASSERT(draw_state_.command_index < XECOUNT(draw_state_.commands));
assert_true(draw_state_.command_index < XECOUNT(draw_state_.commands));
draw_state_.commands[draw_state_.command_index].primitive = primitive;
draw_state_.commands[draw_state_.command_index].vertex_count = count;
++draw_state_.command_index;
@@ -511,7 +511,7 @@ void D3D11ProfilerDisplay::Flush() {
context->Map(vertex_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
memcpy(res.pData, draw_state_.vertex_buffer, sizeof(Vertex) * draw_state_.vertex_index);
context->Unmap(vertex_buffer_, 0);
uint32_t stride = 20;
uint32_t offset = 0;
context->IASetVertexBuffers(0, 1, &vertex_buffer_, &stride, &offset);

View File

@@ -252,7 +252,7 @@ int D3D11VertexShaderResource::CreateInputLayout(const void* byte_code,
vtx_format = DXGI_FORMAT_R32G32B32A32_FLOAT;
break;
default:
XEASSERTALWAYS();
assert_always();
break;
}
element_descs[el_index].SemanticName = "XE_VF";
@@ -299,7 +299,7 @@ int D3D11VertexShaderResource::DemandGeometryShader(
shader = new D3D11QuadListGeometryShader(device);
break;
default:
XEASSERTALWAYS();
assert_always();
return 1;
}
if (!shader) {

View File

@@ -58,7 +58,7 @@ const char* GetFormatTypeName(const VertexBufferResource::DeclElement& el) {
return "float4";
default:
XELOGE("Unknown vertex format: %d", el.format);
XEASSERTALWAYS();
assert_always();
return "float4";
}
}
@@ -141,7 +141,7 @@ int D3D11ShaderTranslator::TranslateVertexShader(
append(
"struct VS_OUTPUT {\n");
if (alloc_counts.positions) {
XEASSERT(alloc_counts.positions == 1);
assert_true(alloc_counts.positions == 1);
append(
" float4 oPos : SV_POSITION;\n");
}
@@ -244,7 +244,7 @@ int D3D11ShaderTranslator::TranslatePixelShader(
append(
"struct VS_OUTPUT {\n");
if (alloc_counts.positions) {
XEASSERT(alloc_counts.positions == 1);
assert_true(alloc_counts.positions == 1);
append(
" float4 oPos : SV_POSITION;\n");
}
@@ -417,7 +417,7 @@ void D3D11ShaderTranslator::AppendDestRegName(uint32_t num, uint32_t dst_exp) {
default:
// TODO(benvanik): other render targets?
// TODO(benvanik): depth?
XEASSERTALWAYS();
assert_always();
break;
}
break;
@@ -1272,7 +1272,7 @@ int D3D11ShaderTranslator::GetFormatComponentCount(uint32_t format) {
return 4;
default:
XELOGE("Unknown vertex format: %d", format);
XEASSERTALWAYS();
assert_always();
return 4;
}
}
@@ -1348,7 +1348,7 @@ int D3D11ShaderTranslator::TranslateExec(const instr_cf_exec_t& cf) {
case TEX_SET_GRADIENTS_H:
case TEX_SET_GRADIENTS_V:
default:
XEASSERTALWAYS();
assert_always();
break;
}
} else {

View File

@@ -136,13 +136,13 @@ int D3D11TextureResource::CreateHandle2D() {
int D3D11TextureResource::CreateHandle3D() {
XELOGE("D3D11: CreateTexture3D not yet implemented");
XEASSERTALWAYS();
assert_always();
return 1;
}
int D3D11TextureResource::CreateHandleCube() {
XELOGE("D3D11: CreateTextureCube not yet implemented");
XEASSERTALWAYS();
assert_always();
return 1;
}