Updated spirv-cross.

This commit is contained in:
Бранимир Караџић 2020-04-09 16:55:23 -07:00
parent e605c022f2
commit 3023da9354
3 changed files with 26 additions and 10 deletions

View File

@ -35,10 +35,6 @@
#include "gitversion.h" #include "gitversion.h"
#endif #endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
using namespace spv; using namespace spv;
using namespace SPIRV_CROSS_NAMESPACE; using namespace SPIRV_CROSS_NAMESPACE;
using namespace std; using namespace std;
@ -190,6 +186,14 @@ struct CLIParser
bool ended_state = false; bool ended_state = false;
}; };
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
static vector<uint32_t> read_spirv_file(const char *path) static vector<uint32_t> read_spirv_file(const char *path)
{ {
FILE *file = fopen(path, "rb"); FILE *file = fopen(path, "rb");
@ -225,6 +229,12 @@ static bool write_string_to_file(const char *path, const char *string)
return true; return true;
} }
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif
static void print_resources(const Compiler &compiler, const char *tag, const SmallVector<Resource> &resources) static void print_resources(const Compiler &compiler, const char *tag, const SmallVector<Resource> &resources)
{ {
fprintf(stderr, "%s\n", tag); fprintf(stderr, "%s\n", tag);

View File

@ -209,9 +209,12 @@ inline std::string convert_to_string(const T &t)
#define SPIRV_CROSS_FLT_FMT "%.32g" #define SPIRV_CROSS_FLT_FMT "%.32g"
#endif #endif
#ifdef _MSC_VER // Disable sprintf and strcat warnings.
// sprintf warning. // We cannot rely on snprintf and family existing because, ..., MSVC.
// We cannot rely on snprintf existing because, ..., MSVC. #if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) #pragma warning(disable : 4996)
#endif #endif
@ -259,7 +262,9 @@ inline std::string convert_to_string(double t, char locale_radix_point)
return buf; return buf;
} }
#ifdef _MSC_VER #if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#endif #endif

View File

@ -8849,8 +8849,9 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
if (composite_type.basetype == SPIRType::Struct || !composite_type.array.empty()) if (composite_type.basetype == SPIRType::Struct || !composite_type.array.empty())
allow_base_expression = false; allow_base_expression = false;
// Packed expressions cannot be split up. // Packed expressions or physical ID mapped expressions cannot be split up.
if (has_extended_decoration(ops[2], SPIRVCrossDecorationPhysicalTypePacked)) if (has_extended_decoration(ops[2], SPIRVCrossDecorationPhysicalTypePacked) ||
has_extended_decoration(ops[2], SPIRVCrossDecorationPhysicalTypeID))
allow_base_expression = false; allow_base_expression = false;
// Cannot use base expression for row-major matrix row-extraction since we need to interleave access pattern // Cannot use base expression for row-major matrix row-extraction since we need to interleave access pattern