Skip to content

Commit 35a4f5c

Browse files
committed
nfc: prep dxbc::ComparisonFunc and dxbc::TextureAddressMode
1 parent 55111b9 commit 35a4f5c

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

llvm/include/llvm/BinaryFormat/DXContainer.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,15 @@ enum class TextureAddressMode : uint32_t {
231231
#include "DXContainerConstants.def"
232232
};
233233

234-
#define COMPARISON_FUNCTION(Val, Enum) Enum = Val,
235-
enum class SamplersComparisonFunction : uint32_t {
234+
LLVM_ABI ArrayRef<EnumEntry<TextureAddressMode>> getTextureAddressModes();
235+
236+
#define COMPARISON_FUNC(Val, Enum) Enum = Val,
237+
enum class ComparisonFunc : uint32_t {
236238
#include "DXContainerConstants.def"
237239
};
238240

241+
LLVM_ABI ArrayRef<EnumEntry<ComparisonFunc>> getComparisonFuncs();
242+
239243
#define STATIC_BORDER_COLOR(Val, Enum) Enum = Val,
240244
enum class StaticBorderColor : uint32_t {
241245
#include "DXContainerConstants.def"

llvm/include/llvm/BinaryFormat/DXContainerConstants.def

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,18 @@ TEXTURE_ADDRESS_MODE( 5, MirrorOnce)
188188
#undef TEXTURE_ADDRESS_MODE
189189
#endif // TEXTURE_ADDRESS_MODE
190190

191-
#ifdef COMPARISON_FUNCTION
192-
193-
COMPARISON_FUNCTION( 1, Never)
194-
COMPARISON_FUNCTION( 2, Less)
195-
COMPARISON_FUNCTION( 3, Equal)
196-
COMPARISON_FUNCTION( 4, LessEqual)
197-
COMPARISON_FUNCTION( 5, Greater)
198-
COMPARISON_FUNCTION( 6, NotEqual)
199-
COMPARISON_FUNCTION( 7, GreaterEqual)
200-
COMPARISON_FUNCTION( 8, Always)
201-
#undef COMPARISON_FUNCTION
202-
#endif // COMPARISON_FUNCTION
191+
#ifdef COMPARISON_FUNC
192+
193+
COMPARISON_FUNC( 1, Never)
194+
COMPARISON_FUNC( 2, Less)
195+
COMPARISON_FUNC( 3, Equal)
196+
COMPARISON_FUNC( 4, LessEqual)
197+
COMPARISON_FUNC( 5, Greater)
198+
COMPARISON_FUNC( 6, NotEqual)
199+
COMPARISON_FUNC( 7, GreaterEqual)
200+
COMPARISON_FUNC( 8, Always)
201+
#undef COMPARISON_FUNC
202+
#endif // COMPARISON_FUNC
203203

204204
#ifdef STATIC_BORDER_COLOR
205205
STATIC_BORDER_COLOR( 0, TransparentBlack)

llvm/include/llvm/ObjectYAML/DXContainerYAML.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct StaticSamplerYamlDesc {
172172
float MipLODBias = 0.f;
173173
uint32_t MaxAnisotropy = 16u;
174174
uint32_t ComparisonFunc =
175-
llvm::to_underlying(dxbc::SamplersComparisonFunction::LessEqual);
175+
llvm::to_underlying(dxbc::ComparisonFunc::LessEqual);
176176
uint32_t BorderColor =
177177
llvm::to_underlying(dxbc::StaticBorderColor::OpaqueWhite);
178178
float MinLOD = 0.f;

llvm/lib/BinaryFormat/DXContainer.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,26 @@ ArrayRef<EnumEntry<ShaderVisibility>> dxbc::getShaderVisibility() {
9999
return ArrayRef(ShaderVisibilityValues);
100100
}
101101

102+
#define TEXTURE_ADDRESS_MODE(Val, Enum) {#Enum, TextureAddressMode::Enum},
103+
104+
static const EnumEntry<TextureAddressMode> TextureAddressModeNames[] = {
105+
#include "llvm/BinaryFormat/DXContainerConstants.def"
106+
};
107+
108+
ArrayRef<EnumEntry<TextureAddressMode>> dxbc::getTextureAddressModes() {
109+
return ArrayRef(TextureAddressModeNames);
110+
}
111+
112+
#define COMPARISON_FUNC(Val, Enum) {#Enum, ComparisonFunc::Enum},
113+
114+
static const EnumEntry<ComparisonFunc> ComparisonFuncNames[] = {
115+
#include "llvm/BinaryFormat/DXContainerConstants.def"
116+
};
117+
118+
ArrayRef<EnumEntry<ComparisonFunc>> dxbc::getComparisonFuncs() {
119+
return ArrayRef(ComparisonFuncNames);
120+
}
121+
102122
#define STATIC_BORDER_COLOR(Val, Enum) {#Enum, StaticBorderColor::Enum},
103123

104124
static const EnumEntry<StaticBorderColor> StaticBorderColorValues[] = {

0 commit comments

Comments
 (0)