Skip to content

Commit

Permalink
Use fixed width integers for underlying enum types (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Oct 24, 2024
1 parent dfddf31 commit a700d0f
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Inc/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace DirectX
SoundEffectInstance_UseRedirectLFE = 0x10000,
};

enum AUDIO_ENGINE_REVERB : unsigned int
enum AUDIO_ENGINE_REVERB : uint32_t
{
Reverb_Off,
Reverb_Default,
Expand Down Expand Up @@ -195,7 +195,7 @@ namespace DirectX
Reverb_MAX
};

enum SoundState
enum SoundState : uint32_t
{
STOPPED = 0,
PLAYING,
Expand Down Expand Up @@ -823,8 +823,8 @@ namespace DirectX
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif

DEFINE_ENUM_FLAG_OPERATORS(AUDIO_ENGINE_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(SOUND_EFFECT_INSTANCE_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(AUDIO_ENGINE_FLAGS)
DEFINE_ENUM_FLAG_OPERATORS(SOUND_EFFECT_INSTANCE_FLAGS)

#ifdef __clang__
#pragma clang diagnostic pop
Expand Down
3 changes: 2 additions & 1 deletion Inc/CommonStates.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <d3d12.h>
#endif

#include <cstdint>
#include <memory>


Expand Down Expand Up @@ -76,7 +77,7 @@ namespace DirectX
D3D12_GPU_DESCRIPTOR_HANDLE AnisotropicClamp() const;

// These index into the heap returned by SamplerDescriptorHeap
enum class SamplerIndex
enum class SamplerIndex : uint32_t
{
PointWrap,
PointClamp,
Expand Down
2 changes: 1 addition & 1 deletion Inc/DDSTextureLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace DirectX

inline namespace DX12
{
DEFINE_ENUM_FLAG_OPERATORS(DDS_LOADER_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(DDS_LOADER_FLAGS)
}

#ifdef __clang__
Expand Down
4 changes: 2 additions & 2 deletions Inc/Effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ namespace DirectX
class EnvironmentMapEffect : public IEffect, public IEffectMatrices, public IEffectLights, public IEffectFog
{
public:
enum Mapping
enum Mapping : uint32_t
{
Mapping_Cube = 0, // Cubic environment map
Mapping_Sphere, // Spherical environment map
Expand Down Expand Up @@ -664,7 +664,7 @@ namespace DirectX
class DebugEffect : public IEffect, public IEffectMatrices
{
public:
enum Mode
enum Mode : uint32_t
{
Mode_Default = 0, // Hemispherical ambient lighting
Mode_Normals, // RGB normals
Expand Down
6 changes: 3 additions & 3 deletions Inc/GamePad.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace DirectX
static constexpr int c_MergedInput = -2;
#endif

enum DeadZone
enum DeadZone : uint32_t
{
DEAD_ZONE_INDEPENDENT_AXES = 0,
DEAD_ZONE_CIRCULAR,
Expand Down Expand Up @@ -187,7 +187,7 @@ namespace DirectX

struct Capabilities
{
enum Type
enum Type : uint32_t
{
UNKNOWN = 0,
GAMEPAD,
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace DirectX
class ButtonStateTracker
{
public:
enum ButtonState
enum ButtonState : uint32_t
{
UP = 0, // Button is up
HELD = 1, // Button is held down
Expand Down
3 changes: 2 additions & 1 deletion Inc/GraphicsMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#endif

#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>

Expand Down Expand Up @@ -137,7 +138,7 @@ namespace DirectX
class GraphicsMemory
{
public:
enum Tag
enum Tag : uint32_t
{
TAG_GENERIC = 0,
TAG_CONSTANT,
Expand Down
2 changes: 1 addition & 1 deletion Inc/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ namespace DirectX
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif

DEFINE_ENUM_FLAG_OPERATORS(ModelLoaderFlags);
DEFINE_ENUM_FLAG_OPERATORS(ModelLoaderFlags)

#ifdef __clang__
#pragma clang diagnostic pop
Expand Down
5 changes: 3 additions & 2 deletions Inc/Mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#pragma comment(lib,"gameinput.lib")
#endif

#include <cstdint>
#include <memory>

#ifdef USING_COREWINDOW
Expand Down Expand Up @@ -55,7 +56,7 @@ namespace DirectX

virtual ~Mouse();

enum Mode
enum Mode : uint32_t
{
MODE_ABSOLUTE = 0,
MODE_RELATIVE,
Expand All @@ -77,7 +78,7 @@ namespace DirectX
class ButtonStateTracker
{
public:
enum ButtonState
enum ButtonState : uint32_t
{
UP = 0, // Button is up
HELD = 1, // Button is held down
Expand Down
11 changes: 6 additions & 5 deletions Inc/PostProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <d3d12.h>
#endif

#include <cstdint>
#include <memory>

#include <DirectXMath.h>
Expand Down Expand Up @@ -55,7 +56,7 @@ namespace DirectX
class BasicPostProcess : public IPostProcess
{
public:
enum Effect : unsigned int
enum Effect : uint32_t
{
Copy,
Monochrome,
Expand Down Expand Up @@ -106,7 +107,7 @@ namespace DirectX
class DualPostProcess : public IPostProcess
{
public:
enum Effect : unsigned int
enum Effect : uint32_t
{
Merge,
BloomCombine,
Expand Down Expand Up @@ -150,7 +151,7 @@ namespace DirectX
{
public:
// Tone-mapping operator
enum Operator : unsigned int
enum Operator : uint32_t
{
None, // Pass-through
Saturate, // Clamp [0,1]
Expand All @@ -160,7 +161,7 @@ namespace DirectX
};

// Electro-Optical Transfer Function (EOTF)
enum TransferFunction : unsigned int
enum TransferFunction : uint32_t
{
Linear, // Pass-through
SRGB, // sRGB (Rec.709 and approximate sRGB display curve)
Expand All @@ -169,7 +170,7 @@ namespace DirectX
};

// Color Rotation Transform for HDR10
enum ColorPrimaryRotation : unsigned int
enum ColorPrimaryRotation : uint32_t
{
HDTV_to_UHDTV, // Rec.709 to Rec.2020
DCI_P3_D65_to_UHDTV, // DCI-P3-D65 (a.k.a Display P3 or P3D65) to Rec.2020
Expand Down
2 changes: 1 addition & 1 deletion Inc/SpriteBatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace DirectX

inline namespace DX12
{
enum SpriteSortMode
enum SpriteSortMode : uint32_t
{
SpriteSortMode_Deferred,
SpriteSortMode_Immediate,
Expand Down
2 changes: 1 addition & 1 deletion Inc/WICTextureLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace DirectX

inline namespace DX12
{
DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS)
}

#ifdef __clang__
Expand Down

0 comments on commit a700d0f

Please sign in to comment.