Integrating github/staging through commit ab87ed9
This commit is contained in:
@@ -628,11 +628,6 @@ const uint32_t* DecodeDeclaration(Shader* psShader, const uint32_t* pui32Token,
|
||||
{
|
||||
ui32TokenLength = pui32Token[1];
|
||||
{
|
||||
int iTupleSrc = 0, iTupleDest = 0;
|
||||
// const uint32_t ui32ConstCount = pui32Token[1] - 2;
|
||||
// const uint32_t ui32TupleCount = (ui32ConstCount / 4);
|
||||
CUSTOMDATA_CLASS eClass = DecodeCustomDataClass(pui32Token[0]);
|
||||
|
||||
const uint32_t ui32NumVec4 = (ui32TokenLength - 2) / 4;
|
||||
uint32_t uIdx = 0;
|
||||
|
||||
@@ -671,8 +666,6 @@ const uint32_t* DecodeDeclaration(Shader* psShader, const uint32_t* pui32Token,
|
||||
}
|
||||
case OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW:
|
||||
{
|
||||
ResourceBinding* psBinding = NULL;
|
||||
ConstantBuffer* psBuffer = NULL;
|
||||
|
||||
psDecl->ui32NumOperands = 1;
|
||||
psDecl->sUAV.ui32GloballyCoherentAccess = DecodeAccessCoherencyFlags(*pui32Token);
|
||||
@@ -725,8 +718,6 @@ const uint32_t* DecodeDeclaration(Shader* psShader, const uint32_t* pui32Token,
|
||||
}
|
||||
case OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED:
|
||||
{
|
||||
ResourceBinding* psBinding = NULL;
|
||||
ConstantBuffer* psBuffer = NULL;
|
||||
|
||||
psDecl->ui32NumOperands = 1;
|
||||
psDecl->sUAV.ui32GloballyCoherentAccess = 0;
|
||||
@@ -739,8 +730,6 @@ const uint32_t* DecodeDeclaration(Shader* psShader, const uint32_t* pui32Token,
|
||||
}
|
||||
case OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW:
|
||||
{
|
||||
ResourceBinding* psBinding = NULL;
|
||||
ConstantBuffer* psBuffer = NULL;
|
||||
|
||||
psDecl->ui32NumOperands = 1;
|
||||
psDecl->sUAV.ui32GloballyCoherentAccess = 0;
|
||||
|
||||
@@ -407,8 +407,6 @@ static void SetupRegisterUsage(const Shader* psShader, const uint32_t ui32Token0
|
||||
// In dx9 there is only one constant buffer per shader.
|
||||
static void DeclareConstantBuffer(const Shader* psShader, Declaration* psDecl)
|
||||
{
|
||||
DECLUSAGE_DX9 eUsage = (DECLUSAGE_DX9)0;
|
||||
uint32_t ui32UsageIndex = 0;
|
||||
// Pick any constant register in the table. Might not start at c0 (e.g. when register(cX) is used).
|
||||
uint32_t ui32RegNum = psShader->sInfo.psConstantBuffers->asVars[0].ui32StartOffset / 16;
|
||||
OPERAND_TYPE_DX9 ui32RegType = OPERAND_TYPE_DX9_CONST;
|
||||
@@ -446,9 +444,6 @@ static void DeclareConstantBuffer(const Shader* psShader, Declaration* psDecl)
|
||||
|
||||
static void DecodeDeclarationDX9(const Shader* psShader, const uint32_t ui32Token0, const uint32_t ui32Token1, Declaration* psDecl)
|
||||
{
|
||||
DECLUSAGE_DX9 eUsage = DecodeUsageDX9(ui32Token0);
|
||||
uint32_t ui32UsageIndex = DecodeUsageIndexDX9(ui32Token0);
|
||||
uint32_t ui32RegNum = DecodeOperandRegisterNumberDX9(ui32Token1);
|
||||
uint32_t ui32RegType = DecodeOperandTypeDX9(ui32Token1);
|
||||
|
||||
if (psShader->eShaderType == VERTEX_SHADER)
|
||||
|
||||
@@ -73,7 +73,7 @@ static void ReadInputSignatures(const uint32_t* pui32Tokens, ShaderInfo* psShade
|
||||
InOutSignature* psSignatures;
|
||||
const uint32_t* pui32FirstSignatureToken = pui32Tokens;
|
||||
const uint32_t ui32ElementCount = *pui32Tokens++;
|
||||
const uint32_t ui32Key = *pui32Tokens++;
|
||||
/* const uint32_t ui32Key = */ *pui32Tokens++;
|
||||
|
||||
psSignatures = hlslcc_malloc(sizeof(InOutSignature) * ui32ElementCount);
|
||||
psShaderInfo->psInputSignatures = psSignatures;
|
||||
@@ -116,7 +116,7 @@ static void ReadOutputSignatures(const uint32_t* pui32Tokens, ShaderInfo* psShad
|
||||
InOutSignature* psSignatures;
|
||||
const uint32_t* pui32FirstSignatureToken = pui32Tokens;
|
||||
const uint32_t ui32ElementCount = *pui32Tokens++;
|
||||
const uint32_t ui32Key = *pui32Tokens++;
|
||||
/* const uint32_t ui32Key = */ *pui32Tokens++;
|
||||
|
||||
psSignatures = hlslcc_malloc(sizeof(InOutSignature) * ui32ElementCount);
|
||||
psShaderInfo->psOutputSignatures = psSignatures;
|
||||
@@ -258,10 +258,10 @@ static const uint32_t* ReadConstantBuffer(ShaderInfo* psShaderInfo, const uint32
|
||||
|
||||
if (psShaderInfo->ui32MajorVersion >= 5)
|
||||
{
|
||||
uint32_t StartTexture = *pui32VarToken++;
|
||||
uint32_t TextureSize = *pui32VarToken++;
|
||||
uint32_t StartSampler = *pui32VarToken++;
|
||||
uint32_t SamplerSize = *pui32VarToken++;
|
||||
/* uint32_t StartTexture = */ *pui32VarToken++;
|
||||
/* uint32_t TextureSize = */ *pui32VarToken++;
|
||||
/* uint32_t StartSampler = */ *pui32VarToken++;
|
||||
/* uint32_t SamplerSize = */ *pui32VarToken++;
|
||||
}
|
||||
|
||||
psVar->haveDefaultValue = 0;
|
||||
@@ -314,8 +314,8 @@ static void ReadResources(const uint32_t* pui32Tokens, ShaderInfo* psShaderInfo)
|
||||
|
||||
uint32_t ui32NumResourceBindings = *pui32Tokens++;
|
||||
uint32_t ui32ResourceBindingOffset = *pui32Tokens++;
|
||||
uint32_t ui32ShaderModel = *pui32Tokens++;
|
||||
uint32_t ui32CompileFlags = *pui32Tokens++;//D3DCompile flags? http://msdn.microsoft.com/en-us/library/gg615083(v=vs.85).aspx
|
||||
/* uint32_t ui32ShaderModel = */ *pui32Tokens++;
|
||||
/* uint32_t ui32CompileFlags = */ *pui32Tokens++;//D3DCompile flags? http://msdn.microsoft.com/en-us/library/gg615083(v=vs.85).aspx
|
||||
|
||||
//Resources
|
||||
pui32ResourceBindings = (const uint32_t*)((const char*)pui32FirstToken + ui32ResourceBindingOffset);
|
||||
@@ -408,7 +408,7 @@ static void ReadInterfaces(const uint32_t* pui32Tokens, ShaderInfo* psShaderInfo
|
||||
const uint32_t ui32ClassInstanceCount = *pui32Tokens++;
|
||||
const uint32_t ui32ClassTypeCount = *pui32Tokens++;
|
||||
const uint32_t ui32InterfaceSlotRecordCount = *pui32Tokens++;
|
||||
const uint32_t ui32InterfaceSlotCount = *pui32Tokens++;
|
||||
/* const uint32_t ui32InterfaceSlotCount = */ *pui32Tokens++;
|
||||
const uint32_t ui32ClassInstanceOffset = *pui32Tokens++;
|
||||
const uint32_t ui32ClassTypeOffset = *pui32Tokens++;
|
||||
const uint32_t ui32InterfaceSlotOffset = *pui32Tokens++;
|
||||
@@ -663,7 +663,6 @@ static int IsOffsetInType(ShaderVarType* psType, uint32_t parentOffset, uint32_t
|
||||
int GetShaderVarFromOffset(const uint32_t ui32Vec4Offset, const uint32_t* pui32Swizzle, ConstantBuffer* psCBuf, ShaderVarType** ppsShaderVar, int32_t* pi32Index, int32_t* pi32Rebase)
|
||||
{
|
||||
uint32_t i;
|
||||
const uint32_t ui32BaseByteOffset = ui32Vec4Offset * 16;
|
||||
|
||||
uint32_t ui32ByteOffset = ui32Vec4Offset * 16;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#if defined(_WIN32) && !defined(PORTABLE)
|
||||
#include <AzCore/PlatformDef.h>
|
||||
AZ_PUSH_DISABLE_WARNING(4115, "-Wunknown-warning-option")
|
||||
AZ_PUSH_DISABLE_WARNING(4115, "-Wunknown-warning-option") // 4115: named type definition in parentheses
|
||||
#include <d3dcompiler.h>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
#pragma comment(lib,"d3dcompiler.lib")
|
||||
@@ -181,7 +181,6 @@ void AddVersionDependentCode(HLSLCrossCompilerContext* psContext)
|
||||
// #extension directive must occur before any non-preprocessor token
|
||||
if (EmulateDepthClamp(psContext->psShader->eTargetLanguage) && (psContext->psShader->eShaderType == VERTEX_SHADER || psContext->psShader->eShaderType == PIXEL_SHADER))
|
||||
{
|
||||
char* szInOut = psContext->psShader->eShaderType == VERTEX_SHADER ? "out" : "in";
|
||||
ui32DepthClampImp = AddImport(psContext, SYMBOL_EMULATE_DEPTH_CLAMP, 0, 0);
|
||||
|
||||
bformata(glsl, "#if IMPORT_%d > 0\n", ui32DepthClampImp);
|
||||
@@ -920,7 +919,6 @@ void WritePostStepTrace(HLSLCrossCompilerContext* psContext, uint32_t uStep)
|
||||
uint16_t uOpcodeWriteMask = GetOpcodeWriteMask(psInstruction->eOpcode);
|
||||
uint8_t uOperand = 0;
|
||||
OPERAND_TYPE eOperandType = OPERAND_TYPE_NULL;
|
||||
SHADER_VARIABLE_TYPE eVarToFlags = TO_FLAG_NONE;
|
||||
Operand* psOperand = NULL;
|
||||
uint32_t uiIgnoreSwizzle = 0;
|
||||
|
||||
@@ -1725,10 +1723,12 @@ void RemoveDoubleUnderscores(char* szName)
|
||||
size_t length;
|
||||
length = strlen(szName);
|
||||
position = szName;
|
||||
while (position = strstr(position, "__"))
|
||||
position = strstr(position, "__");
|
||||
while (position)
|
||||
{
|
||||
position[1] = '0';
|
||||
position += 2;
|
||||
position = strstr(position, "__");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -299,8 +299,9 @@ void PreDeclareStructType(HLSLCrossCompilerContext* psContext, const char* Name,
|
||||
|
||||
if (psType->Class == SVC_STRUCT)
|
||||
{
|
||||
#if !defined(NDEBUG)
|
||||
uint32_t unnamed_struct = strcmp(Name, "$Element") == 0 ? 1 : 0;
|
||||
|
||||
#endif
|
||||
//Not supported at the moment
|
||||
ASSERT(!unnamed_struct);
|
||||
|
||||
@@ -483,6 +484,7 @@ char* GetDeclaredOutputName(const HLSLCrossCompilerContext* psContext,
|
||||
&psContext->psShader->sInfo,
|
||||
&psOut);
|
||||
|
||||
(void)(foundOutput);
|
||||
ASSERT(foundOutput);
|
||||
|
||||
if (eShaderType == GEOMETRY_SHADER)
|
||||
@@ -590,7 +592,6 @@ static void DeclareInput(
|
||||
{
|
||||
if (iNumComponents == 1)
|
||||
{
|
||||
const uint32_t regNum = psDecl->asOperands[0].ui32RegisterNumber;
|
||||
const uint32_t arraySize = psDecl->asOperands[0].aui32ArraySizes[0];
|
||||
|
||||
psContext->psShader->abScalarInput[psDecl->asOperands[0].ui32RegisterNumber] = -1;
|
||||
@@ -1134,7 +1135,6 @@ void AddUserOutput(HLSLCrossCompilerContext* psContext, const Declaration* psDec
|
||||
case VERTEX_SHADER:
|
||||
{
|
||||
int iNumComponents = 4; //GetMaxComponentFromComponentMask(&psDecl->asOperands[0]);
|
||||
const char* Interpolation = "";
|
||||
int stream = 0;
|
||||
char* OutputName = GetDeclaredOutputName(psContext, VERTEX_SHADER, psOperand, &stream);
|
||||
|
||||
@@ -1413,7 +1413,9 @@ void DeclareBufferVariable(HLSLCrossCompilerContext* psContext, const uint32_t u
|
||||
{
|
||||
const char* Name = psCBuf->Name;
|
||||
bstring StructName;
|
||||
#if !defined(NDEBUG)
|
||||
uint32_t unnamed_struct = strcmp(psCBuf->asVars[0].Name, "$Element") == 0 ? 1 : 0;
|
||||
#endif
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
|
||||
ASSERT(psCBuf->ui32NumVars == 1);
|
||||
@@ -1489,7 +1491,9 @@ void DeclarePLSVariable(HLSLCrossCompilerContext* psContext, const uint32_t ui32
|
||||
(void)eResourceType;
|
||||
|
||||
const char* Name = plsVar->Name;
|
||||
#if !defined(NDEBUG)
|
||||
uint32_t unnamed_struct = strcmp(plsVar->asVars[0].Name, "$Element") == 0 ? 1 : 0;
|
||||
#endif
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
|
||||
ASSERT(plsVar->ui32NumVars == 1);
|
||||
@@ -1970,7 +1974,6 @@ void TranslateDeclaration(HLSLCrossCompilerContext* psContext, const Declaration
|
||||
}
|
||||
case OPCODE_DCL_TEMPS:
|
||||
{
|
||||
uint32_t i = 0;
|
||||
const uint32_t ui32NumTemps = psDecl->value.ui32NumTemps;
|
||||
|
||||
if (psContext->flags & HLSLCC_FLAG_AVOID_TEMP_REGISTER_ALIASING && psContext->psShader->eShaderType != HULL_SHADER)
|
||||
@@ -2106,7 +2109,6 @@ void TranslateDeclaration(HLSLCrossCompilerContext* psContext, const Declaration
|
||||
|
||||
const char* Precision = "highp";
|
||||
const char* outputName = "PixOutput";
|
||||
const char* qualifier = psContext->rendertargetUse[regNum] & OUTPUT_RENDERTARGET ? "inout" : "in";
|
||||
|
||||
bformata(glsl, "layout(location = %d) ", regNum);
|
||||
bformata(glsl, "inout %s vec%d %s%d;\n", Precision, numElements, outputName, regNum);
|
||||
|
||||
@@ -943,8 +943,7 @@ static void TranslateTexCoord(HLSLCrossCompilerContext* psContext,
|
||||
static int GetNumTextureDimensions(HLSLCrossCompilerContext* psContext,
|
||||
const RESOURCE_DIMENSION eResDim)
|
||||
{
|
||||
int constructor = 0;
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
(void)(psContext);
|
||||
|
||||
switch (eResDim)
|
||||
{
|
||||
@@ -1441,7 +1440,6 @@ static void TranslateShaderStorageStore(HLSLCrossCompilerContext* psContext, Ins
|
||||
{
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
ShaderVarType* psVarType = NULL;
|
||||
uint32_t ui32DataTypeFlag = TO_FLAG_INTEGER;
|
||||
int component;
|
||||
int srcComponent = 0;
|
||||
|
||||
@@ -1450,7 +1448,6 @@ static void TranslateShaderStorageStore(HLSLCrossCompilerContext* psContext, Ins
|
||||
Operand* psDestByteOff = 0;
|
||||
Operand* psSrc = 0;
|
||||
int structured = 0;
|
||||
int groupshared = 0;
|
||||
|
||||
switch (psInst->eOpcode)
|
||||
{
|
||||
@@ -1474,7 +1471,6 @@ static void TranslateShaderStorageStore(HLSLCrossCompilerContext* psContext, Ins
|
||||
ASSERT(psInst->asOperands[0].eSelMode == OPERAND_4_COMPONENT_MASK_MODE);
|
||||
if (psInst->asOperands[0].ui32CompMask & (1 << component))
|
||||
{
|
||||
SHADER_VARIABLE_TYPE eSrcDataType = GetOperandDataType(psContext, psSrc);
|
||||
uint32_t swizzle = 0;
|
||||
if (structured && psDest->eType != OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY)
|
||||
{
|
||||
@@ -1575,7 +1571,6 @@ static void TranslateShaderPLSStore(HLSLCrossCompilerContext* psContext, Instruc
|
||||
{
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
ShaderVarType* psVarType = NULL;
|
||||
uint32_t ui32DataTypeFlag = TO_FLAG_INTEGER;
|
||||
int component;
|
||||
int srcComponent = 0;
|
||||
|
||||
@@ -1607,7 +1602,6 @@ static void TranslateShaderPLSStore(HLSLCrossCompilerContext* psContext, Instruc
|
||||
ASSERT(psInst->asOperands[0].eSelMode == OPERAND_4_COMPONENT_MASK_MODE);
|
||||
if (psInst->asOperands[0].ui32CompMask & (1 << component))
|
||||
{
|
||||
SHADER_VARIABLE_TYPE eSrcDataType = GetOperandDataType(psContext, psSrc);
|
||||
|
||||
ASSERT(psDest->eType != OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY);
|
||||
|
||||
@@ -1999,7 +1993,6 @@ static void TranslateShaderPLSLoad(HLSLCrossCompilerContext* psContext, Instruct
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
ShaderVarType* psVarType = NULL;
|
||||
uint32_t aui32Swizzle[4] = { OPERAND_4_COMPONENT_X };
|
||||
uint32_t ui32DataTypeFlag = TO_FLAG_INTEGER;
|
||||
int component;
|
||||
int destComponent = 0;
|
||||
|
||||
@@ -2833,7 +2826,6 @@ void SetDataTypes(HLSLCrossCompilerContext* psContext, Instruction* psInst, cons
|
||||
case OPCODE_IMM_ATOMIC_CMP_EXCH:
|
||||
{
|
||||
Operand* dest = &psInst->asOperands[1];
|
||||
Operand* destAddr = &psInst->asOperands[2];
|
||||
ShaderVarType* type = LookupStructuredVar(psContext, dest, NULL, 0);
|
||||
eNewType = type->Type;
|
||||
break;
|
||||
@@ -4485,7 +4477,6 @@ void TranslateInstruction(HLSLCrossCompilerContext* psContext, Instruction* psIn
|
||||
case OPCODE_LD_MS:
|
||||
{
|
||||
ResourceBinding* psBinding = 0;
|
||||
uint32_t dstSwizCount = GetNumSwizzleElements(&psInst->asOperands[0]);
|
||||
uint32_t ui32FetchTypeToFlags;
|
||||
#ifdef _DEBUG
|
||||
AddIndentation(psContext);
|
||||
@@ -5120,7 +5111,6 @@ void TranslateInstruction(HLSLCrossCompilerContext* psContext, Instruction* psIn
|
||||
// Here's the description of what bitfieldExtract actually does
|
||||
// https://www.opengl.org/registry/specs/ARB/gpu_shader5.txt
|
||||
|
||||
int numComponents = psInst->asOperands[0].iNumComponents;
|
||||
|
||||
AddIndentation(psContext);
|
||||
bcatcstr(glsl, "{\n");
|
||||
@@ -5456,7 +5446,6 @@ void TranslateInstruction(HLSLCrossCompilerContext* psContext, Instruction* psIn
|
||||
}
|
||||
case OPCODE_RESINFO:
|
||||
{
|
||||
const RESOURCE_DIMENSION eResDim = psContext->psShader->aeResourceDims[psInst->asOperands[2].ui32RegisterNumber];
|
||||
const RESINFO_RETURN_TYPE eResInfoReturnType = psInst->eResInfoReturnType;
|
||||
uint32_t destElemCount = GetNumSwizzleElements(&psInst->asOperands[0]);
|
||||
uint32_t destElem;
|
||||
|
||||
@@ -1406,7 +1406,6 @@ void TranslateVariableName(HLSLCrossCompilerContext* psContext, const Operand* p
|
||||
{
|
||||
bool hasConstructor = false;
|
||||
bstring glsl = *psContext->currentGLSLString;
|
||||
int numComponents = GetNumSwizzleElements(psOperand);
|
||||
|
||||
*pui32IgnoreSwizzle = 0;
|
||||
|
||||
@@ -1747,7 +1746,6 @@ char ResourceGroupPrefix(ResourceGroup eResGroup)
|
||||
|
||||
void ResourceName(bstring output, Shader* psShader, const char* szName, ResourceGroup eGroup, const char* szSecondaryName, ResourceGroup eSecondaryGroup, uint32_t ui32ArrayOffset, const char* szModifier)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
const char* pBracket;
|
||||
|
||||
@@ -1784,7 +1782,6 @@ void TextureName(bstring output, Shader* psShader, const uint32_t ui32TextureReg
|
||||
ResourceBinding* psTextureBinding = 0;
|
||||
ResourceBinding* psSamplerBinding = 0;
|
||||
int found;
|
||||
uint32_t ui32ArrayOffset = 0;
|
||||
const char* szModifier = bCompare ? "c" : "";
|
||||
|
||||
found = GetResourceFromBindingPoint(RGROUP_TEXTURE, ui32TextureRegister, &psShader->sInfo, &psTextureBinding);
|
||||
|
||||
Reference in New Issue
Block a user