Skip to content

Commit

Permalink
Adds action to run clang-format on pull requests. (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
abaire authored Feb 11, 2025
1 parent 0fef8d3 commit 547141f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
CheckClangFormat:
name: Check clang-format
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
llvm-19
- name: Clone tree
uses: actions/checkout@v4
- name: Run clang-format
run: |
find src \
-iname "*.h" -o -iname "*.cpp" \
-exec clang-format -n -Werror {} \+;
BuildISO:
name: Build ISO
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion src/dds_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "debug_output.h"

#define FOURCC(a, b, c, d) (((a)&0xFF) | (((b)&0xFF) << 8) | (((c)&0xFF) << 16) | (((d)&0xFF) << 24))
#define FOURCC(a, b, c, d) (((a) & 0xFF) | (((b) & 0xFF) << 8) | (((c) & 0xFF) << 16) | (((d) & 0xFF) << 24))

constexpr uint32_t kDDSMagic = FOURCC('D', 'D', 'S', ' ');
constexpr uint32_t kDX10Magic = FOURCC('D', 'X', '1', '0');
Expand Down
4 changes: 2 additions & 2 deletions src/shaders/pixel_shader_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
void PixelShaderProgram::LoadTexturedPixelShader() {
uint32_t *p = pb_begin();

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

Expand All @@ -15,7 +15,7 @@ void PixelShaderProgram::LoadTexturedPixelShader() {
void PixelShaderProgram::LoadUntexturedPixelShader() {
uint32_t *p = pb_begin();

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

Expand Down
2 changes: 1 addition & 1 deletion src/shaders/precalculated_vertex_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace XboxMath;
class PrecalculatedVertexShader : public VertexShaderProgram {
public:
explicit PrecalculatedVertexShader(bool use_4c_texcoords = false)
: VertexShaderProgram(), use_4_component_texcoords_(use_4c_texcoords){};
: VertexShaderProgram(), use_4_component_texcoords_(use_4c_texcoords) {};

protected:
void OnLoadShader() override;
Expand Down
2 changes: 1 addition & 1 deletion src/shaders/vertex_shader_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class VertexShaderProgram {
protected:
virtual void OnActivate() {}
virtual void OnLoadShader() {}
virtual void OnLoadConstants(){};
virtual void OnLoadConstants() {};

void LoadShaderProgram(const uint32_t *shader, uint32_t shader_size) const;

Expand Down

0 comments on commit 547141f

Please sign in to comment.