XMake: update SPIRV and Unicode data parsers

This commit is contained in:
Jérôme Leclercq 2021-10-26 11:14:20 +02:00
parent 14fb2b83ae
commit 8d5276ddac
5 changed files with 4121 additions and 653 deletions

View File

@ -1,5 +1,5 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp"
// This file was generated automatically, please do not edit
@ -379,6 +379,12 @@ namespace Nz
OpConvertUToAccelerationStructureKHR = 4447,
OpIgnoreIntersectionKHR = 4448,
OpTerminateRayKHR = 4449,
OpSDotKHR = 4450,
OpUDotKHR = 4451,
OpSUDotKHR = 4452,
OpSDotAccSatKHR = 4453,
OpUDotAccSatKHR = 4454,
OpSUDotAccSatKHR = 4455,
OpTypeRayQueryKHR = 4472,
OpRayQueryInitializeKHR = 4473,
OpRayQueryTerminateKHR = 4474,
@ -405,6 +411,8 @@ namespace Nz
OpIgnoreIntersectionNV = 5335,
OpTerminateRayNV = 5336,
OpTraceNV = 5337,
OpTraceMotionNV = 5338,
OpTraceRayMotionNV = 5339,
OpTypeAccelerationStructureNV = 5341,
OpTypeAccelerationStructureKHR = 5341,
OpExecuteCallableNV = 5344,
@ -575,7 +583,59 @@ namespace Nz
OpVariableLengthArrayINTEL = 5818,
OpSaveMemoryINTEL = 5819,
OpRestoreMemoryINTEL = 5820,
OpArbitraryFloatSinCosPiINTEL = 5840,
OpArbitraryFloatCastINTEL = 5841,
OpArbitraryFloatCastFromIntINTEL = 5842,
OpArbitraryFloatCastToIntINTEL = 5843,
OpArbitraryFloatAddINTEL = 5846,
OpArbitraryFloatSubINTEL = 5847,
OpArbitraryFloatMulINTEL = 5848,
OpArbitraryFloatDivINTEL = 5849,
OpArbitraryFloatGTINTEL = 5850,
OpArbitraryFloatGEINTEL = 5851,
OpArbitraryFloatLTINTEL = 5852,
OpArbitraryFloatLEINTEL = 5853,
OpArbitraryFloatEQINTEL = 5854,
OpArbitraryFloatRecipINTEL = 5855,
OpArbitraryFloatRSqrtINTEL = 5856,
OpArbitraryFloatCbrtINTEL = 5857,
OpArbitraryFloatHypotINTEL = 5858,
OpArbitraryFloatSqrtINTEL = 5859,
OpArbitraryFloatLogINTEL = 5860,
OpArbitraryFloatLog2INTEL = 5861,
OpArbitraryFloatLog10INTEL = 5862,
OpArbitraryFloatLog1pINTEL = 5863,
OpArbitraryFloatExpINTEL = 5864,
OpArbitraryFloatExp2INTEL = 5865,
OpArbitraryFloatExp10INTEL = 5866,
OpArbitraryFloatExpm1INTEL = 5867,
OpArbitraryFloatSinINTEL = 5868,
OpArbitraryFloatCosINTEL = 5869,
OpArbitraryFloatSinCosINTEL = 5870,
OpArbitraryFloatSinPiINTEL = 5871,
OpArbitraryFloatCosPiINTEL = 5872,
OpArbitraryFloatASinINTEL = 5873,
OpArbitraryFloatASinPiINTEL = 5874,
OpArbitraryFloatACosINTEL = 5875,
OpArbitraryFloatACosPiINTEL = 5876,
OpArbitraryFloatATanINTEL = 5877,
OpArbitraryFloatATanPiINTEL = 5878,
OpArbitraryFloatATan2INTEL = 5879,
OpArbitraryFloatPowINTEL = 5880,
OpArbitraryFloatPowRINTEL = 5881,
OpArbitraryFloatPowNINTEL = 5882,
OpLoopControlINTEL = 5887,
OpFixedSqrtINTEL = 5923,
OpFixedRecipINTEL = 5924,
OpFixedRsqrtINTEL = 5925,
OpFixedSinINTEL = 5926,
OpFixedCosINTEL = 5927,
OpFixedSinCosINTEL = 5928,
OpFixedSinPiINTEL = 5929,
OpFixedCosPiINTEL = 5930,
OpFixedSinCosPiINTEL = 5931,
OpFixedLogINTEL = 5932,
OpFixedExpINTEL = 5933,
OpPtrCastToCrossWorkgroupINTEL = 5934,
OpCrossWorkgroupCastToPtrINTEL = 5938,
OpReadPipeBlockingINTEL = 5946,
@ -631,7 +691,9 @@ namespace Nz
ImageChannelDataType,
FPRoundingMode,
FPDenormMode,
QuantizationModes,
FPOperationMode,
OverflowModes,
LinkageType,
AccessQualifier,
FunctionParameterAttribute,
@ -644,6 +706,7 @@ namespace Nz
RayQueryIntersection,
RayQueryCommittedIntersectionType,
RayQueryCandidateIntersectionType,
PackedVectorFormat,
IdResultType,
IdResult,
IdMemorySemantics,
@ -680,12 +743,13 @@ namespace Nz
VolatileTexelKHR = 0x0800,
SignExtend = 0x1000,
ZeroExtend = 0x2000,
Offsets = 0x10000,
};
template<>
struct EnumAsFlags<SpirvImageOperands>
{
static constexpr SpirvImageOperands max = SpirvImageOperands::ZeroExtend;
static constexpr SpirvImageOperands max = SpirvImageOperands::Offsets;
static constexpr bool AutoFlag = false;
};
@ -766,12 +830,13 @@ namespace Nz
DontInline = 0x0002,
Pure = 0x0004,
Const = 0x0008,
OptNoneINTEL = 0x10000,
};
template<>
struct EnumAsFlags<SpirvFunctionControl>
{
static constexpr SpirvFunctionControl max = SpirvFunctionControl::Const;
static constexpr SpirvFunctionControl max = SpirvFunctionControl::OptNoneINTEL;
static constexpr bool AutoFlag = false;
};
@ -896,6 +961,7 @@ namespace Nz
OpenCL_C = 3,
OpenCL_CPP = 4,
HLSL = 5,
CPP_for_OpenCL = 6,
};
enum class SpirvExecutionModel
@ -981,6 +1047,7 @@ namespace Nz
SubgroupsPerWorkgroupId = 37,
LocalSizeId = 38,
LocalSizeHintId = 39,
SubgroupUniformControlFlowKHR = 4421,
PostDepthCoverage = 4446,
DenormPreserve = 4459,
DenormFlushToZero = 4460,
@ -1176,12 +1243,32 @@ namespace Nz
FlushToZero = 1,
};
enum class SpirvQuantizationModes
{
TRN = 0,
TRN_ZERO = 1,
RND = 2,
RND_ZERO = 3,
RND_INF = 4,
RND_MIN_INF = 5,
RND_CONV = 6,
RND_CONV_ODD = 7,
};
enum class SpirvFPOperationMode
{
IEEE = 0,
ALT = 1,
};
enum class SpirvOverflowModes
{
WRAP = 0,
SAT = 1,
SAT_ZERO = 2,
SAT_SYM = 3,
};
enum class SpirvLinkageType
{
Export = 0,
@ -1428,6 +1515,7 @@ namespace Nz
HitTNV = 5332,
HitKindNV = 5333,
HitKindKHR = 5333,
CurrentRayTimeNV = 5334,
IncomingRayFlagsNV = 5351,
IncomingRayFlagsKHR = 5351,
RayGeometryIndexKHR = 5352,
@ -1616,6 +1704,7 @@ namespace Nz
StorageTexelBufferArrayNonUniformIndexing = 5312,
StorageTexelBufferArrayNonUniformIndexingEXT = 5312,
RayTracingNV = 5340,
RayTracingMotionBlurNV = 5341,
VulkanMemoryModel = 5345,
VulkanMemoryModelKHR = 5345,
VulkanMemoryModelDeviceScope = 5346,
@ -1654,6 +1743,7 @@ namespace Nz
FPGAMemoryAttributesINTEL = 5824,
FPFastMathModeINTEL = 5837,
ArbitraryPrecisionIntegersINTEL = 5844,
ArbitraryPrecisionFloatingPointINTEL = 5845,
UnstructuredLoopControlsINTEL = 5886,
FPGALoopControlsINTEL = 5888,
KernelAttributesINTEL = 5892,
@ -1662,13 +1752,22 @@ namespace Nz
FPGAClusterAttributesINTEL = 5904,
LoopFuseINTEL = 5906,
FPGABufferLocationINTEL = 5920,
ArbitraryPrecisionFixedPointINTEL = 5922,
USMStorageClassesINTEL = 5935,
IOPipesINTEL = 5943,
BlockingPipesINTEL = 5945,
FPGARegINTEL = 5948,
DotProductInputAllKHR = 6016,
DotProductInput4x8BitKHR = 6017,
DotProductInput4x8BitPackedKHR = 6018,
DotProductKHR = 6019,
BitInstructions = 6025,
AtomicFloat32AddEXT = 6033,
AtomicFloat64AddEXT = 6034,
LongConstantCompositeINTEL = 6089,
OptNoneINTEL = 6094,
AtomicFloat16AddEXT = 6095,
DebugInfoModuleINTEL = 6114,
};
enum class SpirvRayQueryIntersection
@ -1690,6 +1789,11 @@ namespace Nz
RayQueryCandidateIntersectionAABBKHR = 1,
};
enum class SpirvPackedVectorFormat
{
PackedVectorFormat4x8BitKHR = 0,
};
struct SpirvInstruction
{
struct Operand

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,14 +13,17 @@ on_run(function()
import("net.http")
io.write("Downloading Spir-V grammar... ")
io.flush()
local tempGrammar = os.tmpfile() .. ".spirv.core.grammar.json"
http.download(spirvGrammarURI, tempGrammar)
print("Done")
io.flush()
io.write("Parsing... ")
io.flush()
local content = io.readfile(tempGrammar)
@ -60,15 +63,17 @@ on_run(function()
end
print("Done")
io.flush()
io.write("Generating... ")
io.flush()
local headerFile = io.open("include/Nazara/Shader/SpirvData.hpp", "w+")
assert(headerFile, "failed to open Spir-V header")
headerFile:write([[
// Copyright (C) ]] .. os.date("%Y") .. [[ Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp"
// This file was generated automatically, please do not edit
@ -206,11 +211,11 @@ headerFile:write([[
assert(sourceFile, "failed to open Spir-V source")
sourceFile:write([[
// Copyright (C) ]] .. os.date("%Y") .. [[ Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp"
// this file was automatically generated and should not be edited
// This file was generated automatically, please do not edit
// Copyright (C) ]] .. os.date("%Y") .. [[ Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp"
#include <Nazara/Shader/SpirvData.hpp>
#include <algorithm>
@ -279,4 +284,5 @@ namespace Nz
sourceFile:close()
print("Done")
io.flush()
end)

View File

@ -78,14 +78,17 @@ local DirectionToString = {}
local unicodeSet = {}
io.write("Downloading UnicodeData grammar... ")
io.flush()
local tempUnicodeFile = os.tmpfile() .. ".UnicodeData.txt"
http.download(unicodeDataURL, tempUnicodeFile)
print("Done")
io.flush()
io.write("Parsing... ")
io.flush()
local file = io.open(tempUnicodeFile, "r")
@ -163,8 +166,10 @@ local DirectionToString = {}
end
print("Parsed " .. #characters .. " characters")
io.flush()
print("Writting Unicode Data to header...")
io.flush()
file = io.open("src/Nazara/Core/UnicodeData.hpp", "w+")
if (not file) then
@ -172,6 +177,15 @@ local DirectionToString = {}
return
end
file:write([[
// this file was automatically generated and should not be edited
// Copyright (C) ]] .. os.date("%Y") .. [[ Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp"
]])
file:write(string.format("UnicodeCharacter unicodeCharacters[%d] = {\n", #characters))
for _, data in pairs(characters) do
@ -227,4 +241,5 @@ local DirectionToString = {}
file:close()
print("Succeeded!")
io.flush()
end)