Skip to content

Commit

Permalink
Fixes clang format control comments. (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
abaire committed Jul 18, 2023
1 parent 2f7eb7e commit 2431c96
Show file tree
Hide file tree
Showing 17 changed files with 101 additions and 108 deletions.
8 changes: 4 additions & 4 deletions src/shaders/pixel_shader_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
void PixelShaderProgram::LoadTexturedPixelShader() {
uint32_t *p = pb_begin();

// clang format off
// clang-format off
#include "textured_pixelshader.inl"
// clang format on
// clang-format on

pb_end(p);
}

void PixelShaderProgram::LoadUntexturedPixelShader() {
uint32_t *p = pb_begin();

// clang format off
// clang-format off
#include "untextured_pixelshader.inl"
// clang format on
// clang-format on

pb_end(p);
}
Expand Down
4 changes: 2 additions & 2 deletions src/shaders/precalculated_vertex_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

#include <pbkit/pbkit.h>

// clang format off
// clang-format off
static constexpr uint32_t k2ComponentTexcoords[] = {
#include "precalculated_vertex_shader_2c_texcoords.inl"
};

static constexpr uint32_t k4ComponentTexcoords[] = {
#include "precalculated_vertex_shader_4c_texcoords.inl"
};
// clang format on
// clang-format on

void PrecalculatedVertexShader::OnLoadShader() {
const uint32_t *shader;
Expand Down
4 changes: 2 additions & 2 deletions src/shaders/projection_vertex_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

using namespace XboxMath;

// clang format off
// clang-format off
static constexpr uint32_t kVertexShaderLighting[] = {
#include "projection_vertex_shader.inl"
};
Expand All @@ -25,7 +25,7 @@ static constexpr uint32_t kVertexShaderNoLighting[] = {
static constexpr uint32_t kVertexShaderNoLighting4ComponentTexcoord[] = {
#include "projection_vertex_shader_no_lighting_4c_texcoords.inl"
};
// clang format on
// clang-format on

ProjectionVertexShader::ProjectionVertexShader(uint32_t framebuffer_width, uint32_t framebuffer_height, float z_min,
float z_max, bool enable_lighting, bool use_4_component_texcoords)
Expand Down
4 changes: 2 additions & 2 deletions src/test_host.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "test_host.h"

// clang format off
// clang-format off
#define _USE_MATH_DEFINES
#include <cmath>
// clang format on
// clang-format on

#include <SDL.h>
#include <SDL_image.h>
Expand Down
4 changes: 2 additions & 2 deletions src/tests/attribute_carryover_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include "shaders/precalculated_vertex_shader.h"
#include "vertex_buffer.h"

// clang format off
// clang-format off
static constexpr uint32_t kShader[] = {
#include "attribute_carryover_test.inl"
};
// clang format on
// clang-format on

static const TestHost::DrawPrimitive kPrimitives[] = {
TestHost::PRIMITIVE_LINES,
Expand Down
4 changes: 2 additions & 2 deletions src/tests/attribute_explicit_setter_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include "shaders/precalculated_vertex_shader.h"
#include "vertex_buffer.h"

// clang format off
// clang-format off
static constexpr uint32_t kShader[] = {
#include "attribute_explicit_setter_tests.inl"
};
// clang format on
// clang-format on

static constexpr AttributeExplicitSetterTests::TestConfig kTestConfigs[] = {
{"Setters-alpha", false},
Expand Down
4 changes: 2 additions & 2 deletions src/tests/attribute_float_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
#include "pbkit_ext.h"
#include "shaders/precalculated_vertex_shader.h"

// clang format off
// clang-format off
static const std::vector<uint32_t> passthrough{
#include "precalculated_vertex_shader_4c_texcoords.inl"
};

static const std::vector<uint32_t> mulColour{
#include "mul_col0_by_const0_vertex_shader.inl"
};
// clang format on
// clang-format on

// Infinities
static constexpr uint32_t posInf = 0x7F800000;
Expand Down
40 changes: 20 additions & 20 deletions src/tests/edge_flag_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ static constexpr uint32_t kNumPaletteEntries = sizeof(kPalette) / sizeof(kPalett

static void Draw(TestHost &host, float x, float y) {
{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{19.000000f, 15.000000f}, {56.000000f, 29.000000f}, {74.000000f, 77.000000f}, {45.694406f, 101.330152f},
{36.000000f, 38.369815f}, {14.000000f, 23.000000f}, {85.000000f, 98.000000f}, {31.000000f, 40.000000f},
{98.000000f, 38.000000f}, {17.000000f, 104.000000f}, {78.000000f, 65.000000f}, {31.644774f, 49.000000f},
{105.000000f, 11.968842f}, {9.000000f, 40.000000f}, {105.962647f, 76.068491f}, {80.000000f, 87.000000f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_POINTS);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -68,14 +68,14 @@ static void Draw(TestHost &host, float x, float y) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{196.000000f, 47.000000f}, {194.000000f, 19.000000f}, {182.000000f, 97.000000f}, {106.186250f, 80.000000f},
{127.000000f, 94.581630f}, {133.597443f, 13.763389f}, {205.000000f, 62.000000f}, {115.543920f, 16.000000f},
{122.000000f, 3.000000f}, {117.062706f, 87.735558f}, {201.000000f, 28.664894f}, {146.114091f, 10.000000f},
{205.356591f, 88.000000f}, {125.000000f, 107.000000f}, {190.828953f, 35.510304f}, {163.000000f, 105.956814f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_LINE_LOOP);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -87,12 +87,12 @@ static void Draw(TestHost &host, float x, float y) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{265.185925f, 35.000000f}, {249.778838f, 22.523717f}, {310.000000f, 19.000000f},
{243.978231f, 47.650185f}, {304.000000f, 37.000000f}, {232.000000f, 102.522615f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_TRIANGLES);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -104,12 +104,12 @@ static void Draw(TestHost &host, float x, float y) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{0.000000f, 239.000000f}, {0.000000f, 120.000000f}, {52.500000f, 225.400000f},
{54.750000f, 175.500000f}, {105.000000f, 239.000000f}, {105.000000f, 120.000000f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_QUAD_STRIP);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -121,12 +121,12 @@ static void Draw(TestHost &host, float x, float y) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{158.500000f, 205.000000f}, {115.545455f, 239.000000f}, {120.318182f, 120.000000f}, {147.045455f, 157.400000f},
{158.500000f, 128.500000f}, {166.136364f, 145.500000f}, {204.318182f, 159.100000f}, {209.750000f, 239.000000f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_TRIANGLE_FAN);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -138,12 +138,12 @@ static void Draw(TestHost &host, float x, float y) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{218.000000f, 232.000000f}, {237.772727f, 142.100000f}, {258.772727f, 120.000000f},
{302.681818f, 169.300000f}, {317.000000f, 230.500000f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_POLYGON);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -155,14 +155,14 @@ static void Draw(TestHost &host, float x, float y) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{0.f, 350.f},
{60.f, 340.f},
{58.5f, 425.4f},
{12.75f, 407.5f},
};
// clang format on
// clang-format on
host.Begin(TestHost::PRIMITIVE_QUADS);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -189,7 +189,7 @@ void EdgeFlagTests::Test(const std::string &name, bool edge_flag) {

// Triangles, quads, and polygons can have the flag toggled during the draw action to hide specific lines.
{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{365.185925f, 35.000000f},
{349.778838f, 22.523717f},
Expand All @@ -199,7 +199,7 @@ void EdgeFlagTests::Test(const std::string &name, bool edge_flag) {
{404.f, 37.f},
{332.f, 103.f},
};
// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_TRIANGLES);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -214,11 +214,11 @@ void EdgeFlagTests::Test(const std::string &name, bool edge_flag) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{320.f, 232.0f}, {340.f, 142.1f}, {361.f, 120.0f}, {405.f, 169.3f}, {419.f, 230.5f},
};
// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_POLYGON);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand All @@ -233,14 +233,14 @@ void EdgeFlagTests::Test(const std::string &name, bool edge_flag) {
}

{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{100.f, 350.f},
{160.f, 340.f},
{158.5f, 425.4f},
{112.75f, 407.5f},
};
// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_QUADS);
uint32_t i = 0;
for (auto pt : kVertices) {
Expand Down
12 changes: 6 additions & 6 deletions src/tests/fog_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ void FogCustomShaderTests::Initialize() {

// FogInfiniteFogCoordinateTests

// clang format off
// clang-format off
static const uint32_t kInfiniteFogCShader[] = {
#include "fog_infinite_fogc_test.vshinc"
};
// clang format on
// clang-format on

FogInfiniteFogCoordinateTests::FogInfiniteFogCoordinateTests(TestHost& host, std::string output_dir)
: FogCustomShaderTests(host, std::move(output_dir), "Fog inf coord") {}
Expand All @@ -255,7 +255,7 @@ void FogInfiniteFogCoordinateTests::Initialize() {

// FogVec4CoordTests

// clang format off
// clang-format off
static const uint32_t kFogVec4Unset[] = {
#include "fog_vec4_unset.vshinc"
};
Expand Down Expand Up @@ -317,11 +317,11 @@ static const uint32_t kFogVec4YZW[] = {
static const uint32_t kFogVec4ZW[] = {
#include "fog_vec4_zw.vshinc"
};
// clang format on
// clang-format on

#define DEF_SHADER(shader) (shader), sizeof(shader)

// clang format off
// clang-format off
static const FogVec4CoordTests::TestConfig kFogWTests[] = {
{"W", DEF_SHADER(kFogVec4W), {0.0f, 0.25f, 0.0f, 0.0f}},
{"W", DEF_SHADER(kFogVec4W), {0.5f, 0.5f, 0.0f, 0.0f}},
Expand Down Expand Up @@ -378,7 +378,7 @@ static const FogVec4CoordTests::TestConfig kFogWTests[] = {
{"ZW", DEF_SHADER(kFogVec4ZW), {0.0f, 0.0f, 0.75f, 1.0f}},
{"ZW", DEF_SHADER(kFogVec4ZW), {0.0f, 0.0f, 0.33f, 0.0f}},
};
// clang format on
// clang-format on

#undef DEF_TEST

Expand Down
16 changes: 8 additions & 8 deletions src/tests/lighting_two_sided_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ void LightingTwoSidedTests::Test() {
static constexpr float z = -1.f;
// Front face
{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{-1.5f, 0.1f},
{-1.25f, 1.5f},
{-0.35f, 1.5f},
{-0.25f, 0.1f},
};

// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_QUADS);
host_.SetNormal(0.f, 0.f, 1.f);
for (auto pt : kVertices) {
Expand All @@ -132,15 +132,15 @@ void LightingTwoSidedTests::Test() {

// Back face
{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{0.25f, 0.1f},
{1.25f, 0.1f},
{1.35f, 1.5f},
{0.1f, 1.5f},
};

// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_QUADS);
host_.SetNormal(0.f, 0.f, -1.f);
for (auto pt : kVertices) {
Expand All @@ -157,15 +157,15 @@ void LightingTwoSidedTests::Test() {

// Front face
{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{-1.5f, -1.5f},
{-1.25f, -0.1f},
{-0.35f, -0.1f},
{-0.25f, -1.5f},
};

// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_QUADS);
host_.SetNormal(0.f, 0.f, 1.f);
for (auto pt : kVertices) {
Expand All @@ -176,15 +176,15 @@ void LightingTwoSidedTests::Test() {

// Back face
{
// clang format off
// clang-format off
constexpr float kVertices[][2] = {
{0.25f, -1.5f},
{1.25f, -1.5f},
{1.35f, -0.1f},
{0.1f, -0.1f},
};

// clang format on
// clang-format on
host_.Begin(TestHost::PRIMITIVE_QUADS);
host_.SetNormal(0.f, 0.f, -1.f);
for (auto pt : kVertices) {
Expand Down
Loading

0 comments on commit 2431c96

Please sign in to comment.