فهرست منبع

Merged PR 83: Integration fixes.

Integration fixes.

- Remove unused constructor from FunctionTableReader
- Remove hlsl::Exception dependency from DxilRuntimeReflection.inl
- Fix field size sizeof(RuntimeDataFunctionInfo) in legacy loader
- Add __cdecl to raw_ostream::operator<<(...) for ios_base change
- Move string constant definitions to from CGHLSLMS to DxilModule, since
  they are required by HLSL.lib, and that shouldn't depend on clang CodeGen.
Tex Riddell 7 سال پیش
والد
کامیت
c37d554d1e

+ 0 - 3
include/dxc/HLSL/DxilRuntimeReflection.h

@@ -383,9 +383,6 @@ private:
 
 public:
   FunctionTableReader() : m_context(nullptr) {}
-  FunctionTableReader(const RuntimeDataFunctionInfo *functionInfos,
-                      uint32_t count, RuntimeDataContext *context)
-      : m_context(context) {}
 
   FunctionReader GetItem(uint32_t i) const {
     return FunctionReader(m_Table.Row<RuntimeDataFunctionInfo>(i), m_context);

+ 7 - 3
include/dxc/HLSL/DxilRuntimeReflection.inl

@@ -149,7 +149,9 @@ bool DxilRuntimeData::InitFromRDAT(const void *pRDAT, size_t size) {
       }
       return true;
     } catch(CheckedReader::exception e) {
-      throw hlsl::Exception(DXC_E_MALFORMED_CONTAINER, e.what());
+      // TODO: error handling
+      //throw hlsl::Exception(DXC_E_MALFORMED_CONTAINER, e.what());
+      return false;
     }
   }
   return false;
@@ -199,7 +201,7 @@ bool DxilRuntimeData::InitFromRDAT_Prerelease(const void *pRDAT, size_t size) {
         case RuntimeDataPartType_Prerelease::Function: {
           uint32_t count = partSize / sizeof(RuntimeDataFunctionInfo);
           m_FunctionTableReader.SetFunctionInfo(PR.ReadArray<char>(partSize),
-            count, sizeof(RuntimeDataResourceInfo));
+            count, sizeof(RuntimeDataFunctionInfo));
           break;
         }
         default:
@@ -208,7 +210,9 @@ bool DxilRuntimeData::InitFromRDAT_Prerelease(const void *pRDAT, size_t size) {
       }
       return true;
     } catch(CheckedReader::exception e) {
-      throw hlsl::Exception(DXC_E_MALFORMED_CONTAINER, e.what());
+      // TODO: error handling
+      //throw hlsl::Exception(DXC_E_MALFORMED_CONTAINER, e.what());
+      return false;
     }
   }
   return false;

+ 1 - 1
include/llvm/Support/raw_ostream.h

@@ -238,7 +238,7 @@ public:
   raw_ostream &operator<<(const FormattedNumber &);
 
   raw_ostream &
-  operator<<(std::ios_base &(*iomanip)(std::ios_base &)); // HLSL Change
+  operator<<(std::ios_base &(__cdecl*iomanip)(std::ios_base &)); // HLSL Change
 
   /// indent - Insert 'NumSpaces' spaces.
   raw_ostream &indent(unsigned NumSpaces);

+ 20 - 0
lib/HLSL/DxilModule.cpp

@@ -52,6 +52,26 @@ public:
 
 namespace hlsl {
 
+namespace DXIL {
+// Define constant variables exposed in DxilConstants.h
+// TODO: revisit data layout descriptions for the following:
+//      - x64 pointers?
+//      - Keep elf manging(m:e)?
+
+// For legacy data layout, everything less than 32 align to 32.
+const char* kLegacyLayoutString = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f:64:64-n8:16:32:64";
+
+// New data layout with native low precision types
+const char* kNewLayoutString = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64";
+
+// Function Attributes
+// TODO: consider generating attributes from hctdb
+const char* kFP32DenormKindString          = "fp32-denorm-mode";
+const char* kFP32DenormValueAnyString      = "any";
+const char* kFP32DenormValuePreserveString = "preserve";
+const char* kFP32DenormValueFtzString      = "ftz";
+}
+
 //------------------------------------------------------------------------------
 //
 //  DxilModule methods.

+ 1 - 1
lib/Support/raw_ostream.cpp

@@ -488,7 +488,7 @@ raw_ostream &raw_ostream::operator<<(const FormattedNumber &FN) {
 
 // HLSL Change Starts - Add handling of numerical base IO manipulators.
 raw_ostream &raw_ostream::
-operator<<(std::ios_base &(*iomanip)(std::ios_base &)) {
+operator<<(std::ios_base &(__cdecl*iomanip)(std::ios_base &)) {
   if (iomanip == std::hex)
     writeBase = 16;
   else if (iomanip == std::oct)

+ 0 - 22
tools/clang/lib/CodeGen/CGHLSLMS.cpp

@@ -55,28 +55,6 @@ using std::unique_ptr;
 
 static const bool KeepUndefinedTrue = true; // Keep interpolation mode undefined if not set explicitly.
 
-// Define constant variables exposed in DxilConstants.h
-namespace hlsl {
-namespace DXIL {
-  // TODO: revisit data layout descriptions for the following:
-  //      - x64 pointers?
-  //      - Keep elf manging(m:e)?
-
-  // For legacy data layout, everything less than 32 align to 32.
-  const char* kLegacyLayoutString = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f:64:64-n8:16:32:64";
-
-  // New data layout with native low precision types
-  const char* kNewLayoutString = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64";
-
-  // Function Attributes
-  // TODO: consider generating attributes from hctdb
-  const char* kFP32DenormKindString          = "fp32-denorm-mode";
-  const char* kFP32DenormValueAnyString      = "any";
-  const char* kFP32DenormValuePreserveString = "preserve";
-  const char* kFP32DenormValueFtzString      = "ftz";
-} // DXIL
-} // hlsl
-
 namespace {
 
 /// Use this class to represent HLSL cbuffer in high-level DXIL.