Format all code with new clang-format

This commit is contained in:
DrChat
2017-12-14 20:35:44 -06:00
parent f7e91ab475
commit aaf281351d
66 changed files with 915 additions and 718 deletions

View File

@@ -782,7 +782,9 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRenderTargets() {
GLuint color_targets[4] = {kAnyTarget, kAnyTarget, kAnyTarget, kAnyTarget};
if (enable_mode == ModeControl::kColorDepth) {
uint32_t color_info[4] = {
regs.rb_color_info, regs.rb_color1_info, regs.rb_color2_info,
regs.rb_color_info,
regs.rb_color1_info,
regs.rb_color2_info,
regs.rb_color3_info,
};
// A2XX_RB_COLOR_MASK_WRITE_* == D3DRS_COLORWRITEENABLE
@@ -1099,7 +1101,9 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateRasterizerState(
}
static const GLenum kFillModes[3] = {
GL_POINT, GL_LINE, GL_FILL,
GL_POINT,
GL_LINE,
GL_FILL,
};
bool poly_mode = ((regs.pa_su_sc_mode_cntl >> 3) & 0x3) != 0;
if (poly_mode) {
@@ -1590,7 +1594,8 @@ bool GL4CommandProcessor::IssueCopy() {
if (copy_src_select <= 3 || color_clear_enabled) {
// Source from a color target.
uint32_t color_info[4] = {
regs[XE_GPU_REG_RB_COLOR_INFO].u32, regs[XE_GPU_REG_RB_COLOR1_INFO].u32,
regs[XE_GPU_REG_RB_COLOR_INFO].u32,
regs[XE_GPU_REG_RB_COLOR1_INFO].u32,
regs[XE_GPU_REG_RB_COLOR2_INFO].u32,
regs[XE_GPU_REG_RB_COLOR3_INFO].u32,
};

View File

@@ -940,8 +940,9 @@ bool TextureCache::UploadTexture2D(GLuint texture,
texture_info.size_2d.logical_height);
y++, output_base_offset += host_info.size_2d.output_pitch) {
auto input_base_offset = TextureInfo::TiledOffset2DOuter(
offset_y + y, (texture_info.size_2d.input_width /
texture_info.format_info()->block_width),
offset_y + y,
(texture_info.size_2d.input_width /
texture_info.format_info()->block_width),
bpp);
for (uint32_t x = 0, output_offset = output_base_offset;
x < texture_info.size_2d.block_width;
@@ -1048,8 +1049,9 @@ bool TextureCache::UploadTextureCube(GLuint texture,
y < texture_info.size_cube.block_height;
y++, output_base_offset += host_info.size_cube.output_pitch) {
auto input_base_offset = TextureInfo::TiledOffset2DOuter(
offset_y + y, (texture_info.size_cube.input_width /
texture_info.format_info()->block_width),
offset_y + y,
(texture_info.size_cube.input_width /
texture_info.format_info()->block_width),
bpp);
for (uint32_t x = 0, output_offset = output_base_offset;
x < texture_info.size_cube.block_width;

View File

@@ -159,8 +159,8 @@ uint32_t GraphicsSystem::ReadRegister(uint32_t addr) {
case 0x1951: // ? vblank pending?
return 1;
case 0x1961: // AVIVO_D1MODE_VIEWPORT_SIZE
// Screen res - 1280x720
// [width(0x0FFF), height(0x0FFF)]
// Screen res - 1280x720
// [width(0x0FFF), height(0x0FFF)]
return 0x050002D0;
default:
if (!register_file_.GetRegisterInfo(r)) {

View File

@@ -23,7 +23,8 @@ const RegisterInfo* RegisterFile::GetRegisterInfo(uint32_t index) {
#define XE_GPU_REGISTER(index, type, name) \
case index: { \
static const RegisterInfo reg_info = { \
RegisterInfo::Type::type, #name, \
RegisterInfo::Type::type, \
#name, \
}; \
return &reg_info; \
}

View File

@@ -356,7 +356,10 @@ void ParsedVertexFetchInstruction::Disassemble(StringBuffer* out) const {
void ParsedTextureFetchInstruction::Disassemble(StringBuffer* out) const {
static const char* kTextureFilterNames[] = {
"point", "linear", "BASEMAP", "keep",
"point",
"linear",
"BASEMAP",
"keep",
};
static const char* kAnisoFilterNames[] = {
"disabled", "max1to1", "max2to1", "max4to1",

View File

@@ -950,9 +950,8 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
}
}
ImGui::Columns(1);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() +
(vertex_count - display_end) *
ImGui::GetTextLineHeight());
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (vertex_count - display_end) *
ImGui::GetTextLineHeight());
ImGui::PopStyleVar();
ImGui::EndChild();
}
@@ -971,10 +970,14 @@ static const char* kStencilFuncNames[] = {
"Decrement and Clamp",
};
static const char* kIndexFormatNames[] = {
"uint16", "uint32",
"uint16",
"uint32",
};
static const char* kEndiannessNames[] = {
"unspecified endianness", "8-in-16", "8-in-32", "16-in-32",
"unspecified endianness",
"8-in-16",
"8-in-32",
"16-in-32",
};
static const char* kColorFormatNames[] = {
/* 0 */ "k_8_8_8_8",
@@ -995,7 +998,8 @@ static const char* kColorFormatNames[] = {
/* 15 */ "k_32_32_FLOAT",
};
static const char* kDepthFormatNames[] = {
"kD24S8", "kD24FS8",
"kD24S8",
"kD24FS8",
};
void ProgressBar(float frac, float width, float height = 0,
@@ -1185,7 +1189,9 @@ void TraceViewer::DrawStateUI() {
uint32_t surface_pitch = surface_info & 0x3FFF;
auto surface_msaa = (surface_info >> 16) & 0x3;
static const char* kMsaaNames[] = {
"1X", "2X", "4X",
"1X",
"2X",
"4X",
};
ImGui::BulletText("Surface Pitch: %d", surface_pitch);
ImGui::BulletText("Surface HI-Z Pitch: %d", surface_hiz);
@@ -1270,7 +1276,9 @@ void TraceViewer::DrawStateUI() {
ImGui::BulletText("Front-face: counter-clockwise");
}
static const char* kFillModeNames[3] = {
"point", "line", "fill",
"point",
"line",
"fill",
};
bool poly_mode = ((pa_su_sc_mode_cntl >> 3) & 0x3) != 0;
if (poly_mode) {

View File

@@ -72,7 +72,9 @@ void TraceWriter::WritePrimaryBufferStart(uint32_t base_ptr, uint32_t count) {
return;
}
PrimaryBufferStartCommand cmd = {
TraceCommandType::kPrimaryBufferStart, base_ptr, 0,
TraceCommandType::kPrimaryBufferStart,
base_ptr,
0,
};
fwrite(&cmd, 1, sizeof(cmd), file_);
}
@@ -92,7 +94,9 @@ void TraceWriter::WriteIndirectBufferStart(uint32_t base_ptr, uint32_t count) {
return;
}
IndirectBufferStartCommand cmd = {
TraceCommandType::kIndirectBufferStart, base_ptr, 0,
TraceCommandType::kIndirectBufferStart,
base_ptr,
0,
};
fwrite(&cmd, 1, sizeof(cmd), file_);
}
@@ -112,7 +116,9 @@ void TraceWriter::WritePacketStart(uint32_t base_ptr, uint32_t count) {
return;
}
PacketStartCommand cmd = {
TraceCommandType::kPacketStart, base_ptr, count,
TraceCommandType::kPacketStart,
base_ptr,
count,
};
fwrite(&cmd, 1, sizeof(cmd), file_);
fwrite(membase_ + base_ptr, 4, count, file_);
@@ -220,7 +226,8 @@ void TraceWriter::WriteEvent(EventCommand::Type event_type) {
return;
}
EventCommand cmd = {
TraceCommandType::kEvent, event_type,
TraceCommandType::kEvent,
event_type,
};
fwrite(&cmd, 1, sizeof(cmd), file_);
}

View File

@@ -83,7 +83,8 @@ BufferCache::BufferCache(RegisterFile* register_file, Memory* memory,
descriptor_set_layout_info.pNext = nullptr;
descriptor_set_layout_info.flags = 0;
VkDescriptorSetLayoutBinding uniform_bindings[] = {
vertex_uniform_binding, fragment_uniform_binding,
vertex_uniform_binding,
fragment_uniform_binding,
};
descriptor_set_layout_info.bindingCount =
static_cast<uint32_t>(xe::countof(uniform_bindings));

View File

@@ -1158,7 +1158,9 @@ PipelineCache::UpdateStatus PipelineCache::UpdateRasterizationState(
// Vulkan only supports both matching.
assert_true(front_poly_mode == back_poly_mode);
static const VkPolygonMode kFillModes[3] = {
VK_POLYGON_MODE_POINT, VK_POLYGON_MODE_LINE, VK_POLYGON_MODE_FILL,
VK_POLYGON_MODE_POINT,
VK_POLYGON_MODE_LINE,
VK_POLYGON_MODE_FILL,
};
state_info.polygonMode = kFillModes[front_poly_mode];
} else {

View File

@@ -223,7 +223,9 @@ CachedTileView::CachedTileView(ui::vulkan::VulkanDevice* device,
image_view_info.format = image_info.format;
// TODO(benvanik): manipulate? may not be able to when attached.
image_view_info.components = {
VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B,
VK_COMPONENT_SWIZZLE_R,
VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_B,
VK_COMPONENT_SWIZZLE_A,
};
image_view_info.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
@@ -746,7 +748,9 @@ bool RenderCache::ParseConfiguration(RenderConfiguration* config) {
// Color attachment configuration.
if (config->mode_control == ModeControl::kColorDepth) {
reg::RB_COLOR_INFO color_info[4] = {
regs.rb_color_info, regs.rb_color1_info, regs.rb_color2_info,
regs.rb_color_info,
regs.rb_color1_info,
regs.rb_color2_info,
regs.rb_color3_info,
};
for (int i = 0; i < 4; ++i) {

View File

@@ -1099,8 +1099,10 @@ void TextureCache::WritebackTexture(Texture* texture) {
auto command_buffer = wb_command_pool_->AcquireEntry();
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, nullptr,
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
nullptr,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
nullptr,
};
vkBeginCommandBuffer(command_buffer, &begin_info);

View File

@@ -91,7 +91,9 @@ bool VulkanCommandProcessor::SetupContext() {
render_cache_ = std::make_unique<RenderCache>(register_file_, device_);
VkEventCreateInfo info = {
VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, nullptr, 0,
VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
nullptr,
0,
};
VkResult result =
@@ -439,7 +441,8 @@ void VulkanCommandProcessor::PerformSwap(uint32_t frontbuffer_ptr,
nullptr, 1, &barrier);
VkRect2D src_rect = {
{0, 0}, {frontbuffer_width, frontbuffer_height},
{0, 0},
{frontbuffer_width, frontbuffer_height},
};
blitter_->BlitTexture2D(
copy_commands, current_batch_fence_,
@@ -1002,7 +1005,8 @@ bool VulkanCommandProcessor::IssueCopy() {
if (is_color_source) {
// Source from a color target.
uint32_t color_info[4] = {
regs[XE_GPU_REG_RB_COLOR_INFO].u32, regs[XE_GPU_REG_RB_COLOR1_INFO].u32,
regs[XE_GPU_REG_RB_COLOR_INFO].u32,
regs[XE_GPU_REG_RB_COLOR1_INFO].u32,
regs[XE_GPU_REG_RB_COLOR2_INFO].u32,
regs[XE_GPU_REG_RB_COLOR3_INFO].u32,
};
@@ -1112,11 +1116,11 @@ bool VulkanCommandProcessor::IssueCopy() {
VkFilter filter = is_color_source ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
switch (copy_command) {
case CopyCommand::kRaw:
/*
render_cache_->RawCopyToImage(command_buffer, edram_base,
texture->image, texture->image_layout, is_color_source, resolve_offset,
resolve_extent); break;
*/
/*
render_cache_->RawCopyToImage(command_buffer, edram_base,
texture->image, texture->image_layout, is_color_source, resolve_offset,
resolve_extent); break;
*/
case CopyCommand::kConvert: {
/*

View File

@@ -27,8 +27,8 @@ namespace xe {
namespace gpu {
namespace vulkan {
using xe::ui::vulkan::CheckResult;
using xe::ui::RawImage;
using xe::ui::vulkan::CheckResult;
VulkanGraphicsSystem::VulkanGraphicsSystem() {}
VulkanGraphicsSystem::~VulkanGraphicsSystem() = default;
@@ -50,7 +50,8 @@ X_STATUS VulkanGraphicsSystem::Setup(cpu::Processor* processor,
// Create our own command pool we can use for captures.
VkCommandPoolCreateInfo create_info = {
VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr,
VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
nullptr,
VK_COMMAND_POOL_CREATE_TRANSIENT_BIT |
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
device_->queue_family_index(),
@@ -90,8 +91,10 @@ std::unique_ptr<RawImage> VulkanGraphicsSystem::Capture() {
CheckResult(status, "vkAllocateCommandBuffers");
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, nullptr,
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
nullptr,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
nullptr,
};
vkBeginCommandBuffer(cmd, &begin_info);