Skip to content

Commit

Permalink
updating test
Browse files Browse the repository at this point in the history
  • Loading branch information
joaosaffran committed Jan 29, 2025
1 parent ca58712 commit fb574aa
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 54 deletions.
89 changes: 44 additions & 45 deletions llvm/include/llvm/BinaryFormat/DXContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "llvm/Support/SwapByteOrder.h"
#include "llvm/TargetParser/Triple.h"

#include <cstdint>
#include <stdint.h>

namespace llvm {
Expand Down Expand Up @@ -64,6 +63,50 @@ struct ShaderHash {
void swapBytes() { sys::swapByteOrder(Flags); }
};

#define ROOT_PARAMETER(Val, Enum) Enum = Val,
enum class RootParameterType : uint8_t {
#include "DXContainerConstants.def"
};

#define SHADER_VISIBILITY(Val, Enum) Enum = Val,
enum class ShaderVisibilityFlag : uint8_t {
#include "DXContainerConstants.def"
};

struct RootConstants {
uint32_t ShaderRegister;
uint32_t RegisterSpace;
uint32_t Num32BitValues;

void swapBytes() {
sys::swapByteOrder(ShaderRegister);
sys::swapByteOrder(RegisterSpace);
sys::swapByteOrder(Num32BitValues);
}
};

struct RootParameter {
RootParameterType ParameterType;
union {
RootConstants Constants;
};
ShaderVisibilityFlag ShaderVisibility;

void swapBytes() {
switch (ParameterType) {

case RootParameterType::Constants32Bit:
Constants.swapBytes();
break;
case RootParameterType::DescriptorTable:
case RootParameterType::CBV:
case RootParameterType::SRV:
case RootParameterType::UAV:
break;
}
}
};

struct ContainerVersion {
uint16_t Major;
uint16_t Minor;
Expand Down Expand Up @@ -158,50 +201,6 @@ enum class RootElementFlag : uint32_t {
#include "DXContainerConstants.def"
};

#define ROOT_PARAMETER(Val, Enum) Enum = Val,
enum class RootParameterType : uint8_t {
#include "DXContainerConstants.def"
};

#define SHADER_VISIBILITY(Val, Enum) Enum = Val,
enum class ShaderVisibilityFlag : uint8_t {
#include "DXContainerConstants.def"
};

struct RootConstants {
uint32_t ShaderRegister;
uint32_t RegisterSpace;
uint32_t Num32BitValues;

void swapBytes() {
sys::swapByteOrder(ShaderRegister);
sys::swapByteOrder(RegisterSpace);
sys::swapByteOrder(Num32BitValues);
}
};

struct RootParameter {
RootParameterType ParameterType;
union {
RootConstants Constants;
};
ShaderVisibilityFlag ShaderVisibility;

void swapBytes() {
switch (ParameterType) {

case RootParameterType::Constants32Bit:
Constants.swapBytes();
break;
case RootParameterType::DescriptorTable:
case RootParameterType::CBV:
case RootParameterType::SRV:
case RootParameterType::UAV:
break;
}
}
};

PartType parsePartType(StringRef S);

struct VertexPSVInfo {
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/Object/DXContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/TargetParser/Triple.h"
#include <array>
#include <cstdint>
#include <variant>

namespace llvm {
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/MC/DXContainerRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "llvm/MC/DXContainerRootSignature.h"
#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Support/EndianStream.h"
#include <cstdint>

using namespace llvm;
using namespace llvm::mcdxbc;
Expand Down
22 changes: 15 additions & 7 deletions llvm/test/ObjectYAML/DXContainer/RootSignature-Flags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Parts:
RootSignature:
Size: 44
Version: 1
AllowInputAssemblerInputLayout: true
NumParameters: 1
Parameters:
- Type: Constants32Bit
Expand All @@ -23,10 +22,19 @@ Parts:
Num32BitValues: 3
ShaderRegister: 1
RegisterSpace: 2
AllowInputAssemblerInputLayout: true

#CHECK: - Name: RTS0
#CHECK-NEXT: Size: 8
#CHECK-NEXT: RootSignature:
#CHECK-NEXT: Size: 8
#CHECK-NEXT: Version: 1
#CHECK-NEXT: AllowInputAssemblerInputLayout: true
#CHECK: - Name: RTS0
#CHECK-NEXT: Size: 44
#CHECK-NEXT: RootSignature:
#CHECK-NEXT: Size: 64
#CHECK-NEXT: Version: 1
#CHECK-NEXT: NumParameters: 1
#CHECK-NEXT: Parameters:
#CHECK-NEXT: - Type: Constants32Bit
#CHECK-NEXT: ShaderVisibility: All
#CHECK-NEXT: Constants:
#CHECK-NEXT: Num32BitValues: 3
#CHECK-NEXT: ShaderRegister: 1
#CHECK-NEXT: RegisterSpace: 2
#CHECK-NEXT: AllowInputAssemblerInputLayout: true

0 comments on commit fb574aa

Please sign in to comment.