Skip to content

Commit

Permalink
[common][clang-format] Change enum settings
Browse files Browse the repository at this point in the history
Setting one enumerator per line + applying new settings to all files
  • Loading branch information
kszornak authored and gitsgh committed Sep 26, 2024
1 parent a5ae1db commit dbf1c2c
Show file tree
Hide file tree
Showing 26 changed files with 272 additions and 59 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ReflowComments: false
AllowShortFunctionsOnASingleLine: Empty
PenaltyReturnTypeOnItsOwnLine: 999
InsertNewlineAtEOF: true
AllowShortEnumsOnASingleLine: false
---
Language: Json
DisableFormat: true
6 changes: 5 additions & 1 deletion CCodeFiles/src/include/openglArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ namespace gits {

struct CArgument {};
struct CCodeOStream : std::ostream {};
enum MappedArrayAction { ADD_MAPPING = 0, REMOVE_MAPPING = 1, NO_ACTION = 2 };
enum MappedArrayAction {
ADD_MAPPING = 0,
REMOVE_MAPPING = 1,
NO_ACTION = 2
};

namespace OpenGL {

Expand Down
6 changes: 5 additions & 1 deletion LevelZero/common/include/l0StateDynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ struct CCommandListState : public CState {
uint32_t cmdListNumber = 0U;
uint32_t cmdQueueNumber = 0U;
struct Action {
enum Type { Normal, Reset, Signal };
enum Type {
Normal,
Reset,
Signal
};
Type type = Type::Normal;
ze_event_handle_t signalEvent = nullptr;
std::vector<ze_event_handle_t> waitEvents;
Expand Down
19 changes: 16 additions & 3 deletions LevelZero/common/include/l0Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ void SaveImage(const std::filesystem::path& dir,
const ze_image_desc_t& desc,
const std::string& name);
size_t CalculateImageSize(ze_image_desc_t desc);
enum class KernelArgType { pointer = 1, buffer, image };
enum class KernelArgType {
pointer = 1,
buffer,
image
};
void PrepareArguments(const CKernelExecutionInfo* kernelInfo,
std::vector<CKernelArgumentDump>& argDumpStates,
CStateDynamic& sd,
Expand All @@ -55,7 +59,11 @@ void DumpReadyArguments(std::vector<CKernelArgumentDump>& readyArgVector,
const CKernelExecutionInfo* kernelInfo);
bool CaptureKernels(const Config& cfg);
bool CaptureImages(const Config& cfg);
enum class UnifiedMemoryType : unsigned { host = 1 << 0, device = 1 << 1, shared = 1 << 2 };
enum class UnifiedMemoryType : unsigned {
host = 1 << 0,
device = 1 << 1,
shared = 1 << 2
};
bool CheckCfgZeroInitialization(const Config& cfg);
bool ZeroInitializeUsm(CDriver& driver,
const ze_command_list_handle_t& commandList,
Expand All @@ -79,7 +87,12 @@ void* GetOffsetPointer(void* ptr, const uintptr_t& offset);
std::pair<void*, uintptr_t> GetAllocFromOriginalPtr(void* originalPtr, const CStateDynamic& sd);
size_t GetSizeFromCopyRegion(const ze_copy_region_t* region);
bool IsNullIndirectPointersInBufferEnabled(const Config& cfg);
enum class AllocStateType : unsigned { pointer, global_pointer, function_pointer, virtual_pointer };
enum class AllocStateType : unsigned {
pointer,
global_pointer,
function_pointer,
virtual_pointer
};
bool IsControlledSubmission(const ze_command_queue_desc_t* desc);
bool IsControlledSubmission(const ze_command_list_desc_t* desc);
bool ShouldDumpSpv(bool dumpSpv, const ze_module_desc_t* desc);
Expand Down
5 changes: 4 additions & 1 deletion OpenCL/common/include/openclArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ class CProgramSource : public CArgumentFileText {
size_t text_length = 0;

public:
enum ProgramType { PROGRAM_SOURCE, PROGRAM_BINARY };
enum ProgramType {
PROGRAM_SOURCE,
PROGRAM_BINARY
};
CProgramSource() {}
CProgramSource(cl_uint count, const char** strings, const size_t* lengths);
CProgramSource(const unsigned char* binary, const size_t length);
Expand Down
31 changes: 26 additions & 5 deletions OpenCL/common/include/openclTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,32 @@ COclLog& COclLog::operator<<(const T& t) {
};

typedef unsigned mem_signature_t;
enum class UnifiedMemoryType : unsigned { host = 1 << 0, device = 1 << 1, shared = 1 << 2 };
enum class KernelArgType { pointer = 1, mem, sampler, usm, svm };
enum class KernelSetType { normal = 1, usm, svm };
enum class KernelExecInfoType : unsigned { pointers = 1, boolean, uint };
enum class ProgramBinaryLink : uint8_t { binary = 1, program };
enum class UnifiedMemoryType : unsigned {
host = 1 << 0,
device = 1 << 1,
shared = 1 << 2
};
enum class KernelArgType {
pointer = 1,
mem,
sampler,
usm,
svm
};
enum class KernelSetType {
normal = 1,
usm,
svm
};
enum class KernelExecInfoType : unsigned {
pointers = 1,
boolean,
uint
};
enum class ProgramBinaryLink : uint8_t {
binary = 1,
program
};

size_t PixelSize(const cl_image_format& imageFormat);
size_t QuerySize(const cl_mem clMem);
Expand Down
5 changes: 4 additions & 1 deletion OpenGL/common/include/gitsFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ class CgitsRenderbufferStorage : public CFunction {
}

public:
enum RenderbufferStorageType { RENDER_BUFFER, RENDER_BUFFER_EXT };
enum RenderbufferStorageType {
RENDER_BUFFER,
RENDER_BUFFER_EXT
};
CGLuint _renderbufferStorageType;
void renderBufferStorageRun();
void renderBufferStorageEXTRun();
Expand Down
20 changes: 13 additions & 7 deletions OpenGL/common/include/mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,21 @@ void* gl_name_cast(int name) {

template <int Native, int Shared, int Legacy, int Nezero>
struct MappedObjectTraits {
enum { native = Native }; // is this native api object or GL object
enum { shared = Shared }; // is the object shared in multiple contexts
enum {
native = Native
}; // is this native api object or GL object
enum {
shared = Shared
}; // is the object shared in multiple contexts
enum {
legacy = Legacy
}; // does the object support bind w/o gen in some ctxs
// 0 - requires mapping everywhere
// 1 - doesn't require mapping in compat desktop
// 2 - doesn't require mapping in ES context
enum { nezero = Nezero }; // does the object name 0 map to itself
}; // does the object support bind w/o gen in some ctxs
// 0 - requires mapping everywhere
// 1 - doesn't require mapping in compat desktop
// 2 - doesn't require mapping in ES context
enum {
nezero = Nezero
}; // does the object name 0 map to itself
};

bool isMappingRequired(MapObjects mapObject, int legacy);
Expand Down
17 changes: 14 additions & 3 deletions OpenGL/common/include/openglArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,11 @@ class CShaderSource : public CArgumentFileText {
const char* text_cstr;

public:
enum ShaderType { SHADER_SOURCE, SHADER_PROGRAM, PROGRAM_STRING };
enum ShaderType {
SHADER_SOURCE,
SHADER_PROGRAM,
PROGRAM_STRING
};
CShaderSource() : text_cstr(nullptr) {}
CShaderSource(GLuint shaderObj,
GLsizei count,
Expand Down Expand Up @@ -1595,8 +1599,15 @@ class CCoherentBufferUpdate : public CArgument {
uint32_t _length;
uint32_t _target;
std::vector<char> playerCache;
enum UpdateType { TEXTURE_UPDATE, PER_DRAWCALL_UPDATE, PER_FRAME_UPDATE };
enum UpdateMode { UPDATE_ALL, UPDATE_BOUND };
enum UpdateType {
TEXTURE_UPDATE,
PER_DRAWCALL_UPDATE,
PER_FRAME_UPDATE
};
enum UpdateMode {
UPDATE_ALL,
UPDATE_BOUND
};

TCoherentBufferData(
uint64_t hash, uint32_t offset, uint32_t buffer_name, uint32_t length, uint32_t target)
Expand Down
7 changes: 6 additions & 1 deletion OpenGL/common/include/openglDrivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,12 @@ class CGlDriver {
CGlDriver(const CGlDriver& other) = delete;
CGlDriver& operator=(const CGlDriver& other) = delete;
~CGlDriver();
enum TApiType { API_GL, API_GLES1, API_GLES2, API_NULL };
enum TApiType {
API_GL,
API_GLES1,
API_GLES2,
API_NULL
};

void Initialize(TApiType api) WEAK;

Expand Down
19 changes: 16 additions & 3 deletions OpenGL/common/include/ptblLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ namespace gits {
namespace OpenGL {
//*********************** Native API ****************************
struct PtblNativeAPI {
enum Type { UNKNOWN = 0, WGL, GLX, EGL };
enum Type {
UNKNOWN = 0,
WGL,
GLX,
EGL
};
static Type _api;
static Type _streamApi;

Expand Down Expand Up @@ -94,8 +99,16 @@ inline void PtblNtvStreamApi(PtblNativeAPI::Type api) {
}

//*********************** GL Params ****************************
enum PtblGLProfile { Compat = 300, Core, ES };
enum PtblCtxParam { VerMinor = 400, VerMajor, Profile };
enum PtblGLProfile {
Compat = 300,
Core,
ES
};
enum PtblCtxParam {
VerMinor = 400,
VerMajor,
Profile
};
typedef std::map<PtblCtxParam, int> PtblCtxParams;

//******************* PF Params ************************************
Expand Down
7 changes: 6 additions & 1 deletion OpenGL/common/include/stateObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,12 @@ struct CBufferStateData {
GLintptr mapFlushRangeOffset;
GLsizeiptr mapFlushRangeLength;
bool mapped;
enum buffer_type { MAP_BUFFER, MAP_BUFFER_OES, MAP_BUFFER_ARB, MAP_BUFFER_EXT };
enum buffer_type {
MAP_BUFFER,
MAP_BUFFER_OES,
MAP_BUFFER_ARB,
MAP_BUFFER_EXT
};
buffer_type type;
std::vector<GLubyte> buffer;
bool named;
Expand Down
7 changes: 6 additions & 1 deletion Vulkan/common/include/vkWindowing.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

namespace gits {
namespace Vulkan {
enum class DisplayProtocol { NONE, XCB, XLIB, WAYLAND };
enum class DisplayProtocol {
NONE,
XCB,
XLIB,
WAYLAND
};
static DisplayProtocol _displayProtocol;

//********************************* Player Window ***********************************
Expand Down
5 changes: 4 additions & 1 deletion Vulkan/common/include/vulkanDrivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ struct CVkDeviceDispatchTable {

class CVkDriver {
public:
enum class DriverMode { INTERCEPTOR, LAYER };
enum class DriverMode {
INTERCEPTOR,
LAYER
};
CVkDriver();
~CVkDriver();
CVkDriver(const CVkDriver& other) = delete;
Expand Down
7 changes: 6 additions & 1 deletion Vulkan/common/include/vulkanStateDynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ typedef enum _VulkanResourceType {

// Creation function

enum class CreationFunction { KHR_EXTENSION, CORE_1_0, CORE_1_1, CORE_1_2 };
enum class CreationFunction {
KHR_EXTENSION,
CORE_1_0,
CORE_1_1,
CORE_1_2
};

// Unique handle

Expand Down
7 changes: 6 additions & 1 deletion common/include/MemorySniffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ unsigned GetVirtualMemoryPageSize();
void* GetPage(void* addr);
const void* GetPage(const void* addr);

enum PageMemoryProtection { READ_ONLY, READ_WRITE, WRITE_ONLY, NONE };
enum PageMemoryProtection {
READ_ONLY,
READ_WRITE,
WRITE_ONLY,
NONE
};
bool SetPagesProtection(PageMemoryProtection access, void* ptr, size_t size = 1);

class MemorySniffer;
Expand Down
5 changes: 4 additions & 1 deletion common/include/apis_iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ class ApisIface {
OpenCL,
LevelZero,
};
enum TApiType { A3D, ACompute };
enum TApiType {
A3D,
ACompute
};

class ApiIface {
TApi _api;
Expand Down
6 changes: 5 additions & 1 deletion common/include/argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,11 @@ class CArgumentSizedArray<char, T_WRAP> : public CArgument {
* If accessed as non const mappings are being updated
* This parameter is written to the stream
*/
enum MappedArrayAction { ADD_MAPPING = 0, REMOVE_MAPPING = 1, NO_ACTION = 2 };
enum MappedArrayAction {
ADD_MAPPING = 0,
REMOVE_MAPPING = 1,
NO_ACTION = 2
};

template <class T, class T_WRAP, MappedArrayAction T_ACTION>
class CArgumentMappedSizedArray : public CArgument {
Expand Down
6 changes: 5 additions & 1 deletion common/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@

namespace gits {
struct Config {
enum TMode { MODE_UNKNOWN, MODE_RECORDER, MODE_PLAYER };
enum TMode {
MODE_UNKNOWN,
MODE_RECORDER,
MODE_PLAYER
};

static const std::string CONFIG_FILE_NAME;
static std::filesystem::path GetConfigPath(const std::filesystem::path& appDir);
Expand Down
Loading

0 comments on commit dbf1c2c

Please sign in to comment.