Commit 0461d8d4 by Shahbaz Youssefi Committed by Angle LUCI CQ

Vulkan: SPIR-V Gen: texture and image built-ins

GLSL contains a large number of built-in texture* and image* functions, but these map to only a handful of SPIR-V instructions. The bulk of the work to map these is to extract the arguments from the built-ins based on their ordinal position. Bug: angleproject:4889 Change-Id: I760d986bd9171ddde35f9f046c549ca53252df17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2992980Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent d665593b
{ {
"src/common/spirv/gen_spirv_builder_and_parser.py": "src/common/spirv/gen_spirv_builder_and_parser.py":
"e8d99c4791b23c8613a3a6830904bd19", "ee5f0698336e5e021b38d3af06cc56f0",
"src/common/spirv/spirv_instruction_builder_autogen.cpp": "src/common/spirv/spirv_instruction_builder_autogen.cpp":
"450a8ccffc5a5586dbbfd0c8c8c3673d", "bf5cc47686e9dbd00b6229e4ee38a283",
"src/common/spirv/spirv_instruction_builder_autogen.h": "src/common/spirv/spirv_instruction_builder_autogen.h":
"c46c849dbea811cc8d16c51de1883deb", "2a1f5f5f2067858ca7df00b89895a111",
"src/common/spirv/spirv_instruction_parser_autogen.cpp": "src/common/spirv/spirv_instruction_parser_autogen.cpp":
"ec8ace46aa3fb858eb01cfede3c1e6df", "388f17f462daa8e091238b4d1fd42ef5",
"src/common/spirv/spirv_instruction_parser_autogen.h": "src/common/spirv/spirv_instruction_parser_autogen.h":
"66b41c497bef1ea01b906c3f4875b6ff", "58282734b793c994dbe52c3aa988e40e",
"third_party/vulkan-deps/spirv-headers/src/include/spirv/1.0/spirv.core.grammar.json": "third_party/vulkan-deps/spirv-headers/src/include/spirv/1.0/spirv.core.grammar.json":
"a8c4239344b2fc10bfc4ace7ddee1867" "a8c4239344b2fc10bfc4ace7ddee1867"
} }
\ No newline at end of file
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
"src/compiler/translator/ImmutableString_autogen.cpp": "src/compiler/translator/ImmutableString_autogen.cpp":
"e4496ab13c424a15bb77b80e61b0accf", "e4496ab13c424a15bb77b80e61b0accf",
"src/compiler/translator/Operator_autogen.h": "src/compiler/translator/Operator_autogen.h":
"1c32b1e3ad62d6f0b44a591f4d532472", "340c7966d65f4f46858cc228e103cd86",
"src/compiler/translator/SymbolTable_ESSL_autogen.cpp": "src/compiler/translator/SymbolTable_ESSL_autogen.cpp":
"d61ce1e67574d03128e4abf375084df0", "e4b9dcbb8c5291fcd577693037c8e036",
"src/compiler/translator/SymbolTable_autogen.cpp": "src/compiler/translator/SymbolTable_autogen.cpp":
"6c05e64b546c4daf06532252be416264", "de6cd4d4e80a689af91e8da4c2045b3c",
"src/compiler/translator/SymbolTable_autogen.h": "src/compiler/translator/SymbolTable_autogen.h":
"d43593050c4d1b31b0be9cdd3a2d0ea5", "d43593050c4d1b31b0be9cdd3a2d0ea5",
"src/compiler/translator/builtin_function_declarations.txt": "src/compiler/translator/builtin_function_declarations.txt":
"236adf21399deafd706d93dad20e94c3", "e1067f6d0c321cd49343df4f010e0b2b",
"src/compiler/translator/builtin_variables.json": "src/compiler/translator/builtin_variables.json":
"0663a24c595b9221f44e3776337dec56", "0663a24c595b9221f44e3776337dec56",
"src/compiler/translator/gen_builtin_symbols.py": "src/compiler/translator/gen_builtin_symbols.py":
......
...@@ -179,7 +179,7 @@ class Writer: ...@@ -179,7 +179,7 @@ class Writer:
# If an instruction has a parameter of these types, the instruction is ignored # If an instruction has a parameter of these types, the instruction is ignored
self.unsupported_kinds = set(['LiteralSpecConstantOpInteger']) self.unsupported_kinds = set(['LiteralSpecConstantOpInteger'])
# If an instruction requires a capability of these kinds, the instruction is ignored # If an instruction requires a capability of these kinds, the instruction is ignored
self.unsupported_capabilities = set(['Kernel']) self.unsupported_capabilities = set(['Kernel', 'Addresses'])
# If an instruction requires an extension other than these, the instruction is ignored # If an instruction requires an extension other than these, the instruction is ignored
self.supported_extensions = set([]) self.supported_extensions = set([])
# List of bit masks. These have 'Mask' added to their typename in SPIR-V headers. # List of bit masks. These have 'Mask' added to their typename in SPIR-V headers.
...@@ -245,7 +245,9 @@ class Writer: ...@@ -245,7 +245,9 @@ class Writer:
def requires_unsupported_capability(self, item): def requires_unsupported_capability(self, item):
depends = item.get('capabilities', []) depends = item.get('capabilities', [])
return any([dep in self.unsupported_capabilities for dep in depends]) if len(depends) == 0:
return False
return all([dep in self.unsupported_capabilities for dep in depends])
def requires_unsupported_extension(self, item): def requires_unsupported_extension(self, item):
extensions = item.get('extensions', []) extensions = item.get('extensions', [])
......
...@@ -408,14 +408,6 @@ void WriteTypeFunction(Blob *blob, ...@@ -408,14 +408,6 @@ void WriteTypeFunction(Blob *blob,
} }
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpTypeFunction); (*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpTypeFunction);
} }
void WriteTypeForwardPointer(Blob *blob, IdRef pointerType, spv::StorageClass storageClass)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(pointerType);
blob->push_back(storageClass);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpTypeForwardPointer);
}
void WriteConstantTrue(Blob *blob, IdResultType idResultType, IdResult idResult) void WriteConstantTrue(Blob *blob, IdResultType idResultType, IdResult idResult)
{ {
const size_t startSize = blob->size(); const size_t startSize = blob->size();
...@@ -633,23 +625,6 @@ void WriteCopyMemory(Blob *blob, ...@@ -633,23 +625,6 @@ void WriteCopyMemory(Blob *blob,
} }
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpCopyMemory); (*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpCopyMemory);
} }
void WriteCopyMemorySized(Blob *blob,
IdRef target,
IdRef source,
IdRef size,
const spv::MemoryAccessMask *memoryAccess)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(target);
blob->push_back(source);
blob->push_back(size);
if (memoryAccess)
{
blob->push_back(*memoryAccess);
}
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpCopyMemorySized);
}
void WriteAccessChain(Blob *blob, void WriteAccessChain(Blob *blob,
IdResultType idResultType, IdResultType idResultType,
IdResult idResult, IdResult idResult,
...@@ -698,25 +673,6 @@ void WriteArrayLength(Blob *blob, ...@@ -698,25 +673,6 @@ void WriteArrayLength(Blob *blob,
blob->push_back(arraymember); blob->push_back(arraymember);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpArrayLength); (*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpArrayLength);
} }
void WriteInBoundsPtrAccessChain(Blob *blob,
IdResultType idResultType,
IdResult idResult,
IdRef base,
IdRef element,
const IdRefList &indexesList)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(base);
blob->push_back(element);
for (const auto &operand : indexesList)
{
blob->push_back(operand);
}
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpInBoundsPtrAccessChain);
}
void WriteDecorate(Blob *blob, void WriteDecorate(Blob *blob,
IdRef target, IdRef target,
spv::Decoration decoration, spv::Decoration decoration,
...@@ -1234,6 +1190,29 @@ void WriteImage(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef ...@@ -1234,6 +1190,29 @@ void WriteImage(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef
blob->push_back(sampledImage); blob->push_back(sampledImage);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImage); (*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImage);
} }
void WriteImageQuerySizeLod(Blob *blob,
IdResultType idResultType,
IdResult idResult,
IdRef image,
IdRef levelofDetail)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(image);
blob->push_back(levelofDetail);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImageQuerySizeLod);
}
void WriteImageQuerySize(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef image)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(image);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImageQuerySize);
}
void WriteImageQueryLod(Blob *blob, void WriteImageQueryLod(Blob *blob,
IdResultType idResultType, IdResultType idResultType,
IdResult idResult, IdResult idResult,
...@@ -1248,6 +1227,24 @@ void WriteImageQueryLod(Blob *blob, ...@@ -1248,6 +1227,24 @@ void WriteImageQueryLod(Blob *blob,
blob->push_back(coordinate); blob->push_back(coordinate);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImageQueryLod); (*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImageQueryLod);
} }
void WriteImageQueryLevels(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef image)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(image);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImageQueryLevels);
}
void WriteImageQuerySamples(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef image)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(image);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpImageQuerySamples);
}
void WriteConvertFToU(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue) void WriteConvertFToU(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue)
{ {
const size_t startSize = blob->size(); const size_t startSize = blob->size();
...@@ -1320,27 +1317,6 @@ void WriteQuantizeToF16(Blob *blob, IdResultType idResultType, IdResult idResult ...@@ -1320,27 +1317,6 @@ void WriteQuantizeToF16(Blob *blob, IdResultType idResultType, IdResult idResult
blob->push_back(value); blob->push_back(value);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpQuantizeToF16); (*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpQuantizeToF16);
} }
void WriteConvertPtrToU(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef pointer)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(pointer);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpConvertPtrToU);
}
void WriteConvertUToPtr(Blob *blob,
IdResultType idResultType,
IdResult idResult,
IdRef integerValue)
{
const size_t startSize = blob->size();
blob->push_back(0);
blob->push_back(idResultType);
blob->push_back(idResult);
blob->push_back(integerValue);
(*blob)[startSize] = MakeLengthOp(blob->size() - startSize, spv::OpConvertUToPtr);
}
void WriteBitcast(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand) void WriteBitcast(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand)
{ {
const size_t startSize = blob->size(); const size_t startSize = blob->size();
......
...@@ -84,7 +84,6 @@ void WriteTypeFunction(Blob *blob, ...@@ -84,7 +84,6 @@ void WriteTypeFunction(Blob *blob,
IdResult idResult, IdResult idResult,
IdRef returnType, IdRef returnType,
const IdRefList &parameterList); const IdRefList &parameterList);
void WriteTypeForwardPointer(Blob *blob, IdRef pointerType, spv::StorageClass storageClass);
void WriteConstantTrue(Blob *blob, IdResultType idResultType, IdResult idResult); void WriteConstantTrue(Blob *blob, IdResultType idResultType, IdResult idResult);
void WriteConstantFalse(Blob *blob, IdResultType idResultType, IdResult idResult); void WriteConstantFalse(Blob *blob, IdResultType idResultType, IdResult idResult);
void WriteConstant(Blob *blob, void WriteConstant(Blob *blob,
...@@ -139,11 +138,6 @@ void WriteCopyMemory(Blob *blob, ...@@ -139,11 +138,6 @@ void WriteCopyMemory(Blob *blob,
IdRef target, IdRef target,
IdRef source, IdRef source,
const spv::MemoryAccessMask *memoryAccess); const spv::MemoryAccessMask *memoryAccess);
void WriteCopyMemorySized(Blob *blob,
IdRef target,
IdRef source,
IdRef size,
const spv::MemoryAccessMask *memoryAccess);
void WriteAccessChain(Blob *blob, void WriteAccessChain(Blob *blob,
IdResultType idResultType, IdResultType idResultType,
IdResult idResult, IdResult idResult,
...@@ -159,12 +153,6 @@ void WriteArrayLength(Blob *blob, ...@@ -159,12 +153,6 @@ void WriteArrayLength(Blob *blob,
IdResult idResult, IdResult idResult,
IdRef structure, IdRef structure,
LiteralInteger arraymember); LiteralInteger arraymember);
void WriteInBoundsPtrAccessChain(Blob *blob,
IdResultType idResultType,
IdResult idResult,
IdRef base,
IdRef element,
const IdRefList &indexesList);
void WriteDecorate(Blob *blob, void WriteDecorate(Blob *blob,
IdRef target, IdRef target,
spv::Decoration decoration, spv::Decoration decoration,
...@@ -315,11 +303,19 @@ void WriteImageWrite(Blob *blob, ...@@ -315,11 +303,19 @@ void WriteImageWrite(Blob *blob,
const spv::ImageOperandsMask *imageOperands, const spv::ImageOperandsMask *imageOperands,
const IdRefList &imageOperandIdsList); const IdRefList &imageOperandIdsList);
void WriteImage(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef sampledImage); void WriteImage(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef sampledImage);
void WriteImageQuerySizeLod(Blob *blob,
IdResultType idResultType,
IdResult idResult,
IdRef image,
IdRef levelofDetail);
void WriteImageQuerySize(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef image);
void WriteImageQueryLod(Blob *blob, void WriteImageQueryLod(Blob *blob,
IdResultType idResultType, IdResultType idResultType,
IdResult idResult, IdResult idResult,
IdRef sampledImage, IdRef sampledImage,
IdRef coordinate); IdRef coordinate);
void WriteImageQueryLevels(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef image);
void WriteImageQuerySamples(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef image);
void WriteConvertFToU(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue); void WriteConvertFToU(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue);
void WriteConvertFToS(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue); void WriteConvertFToS(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue);
void WriteConvertSToF(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef signedValue); void WriteConvertSToF(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef signedValue);
...@@ -331,11 +327,6 @@ void WriteUConvert(Blob *blob, IdResultType idResultType, IdResult idResult, IdR ...@@ -331,11 +327,6 @@ void WriteUConvert(Blob *blob, IdResultType idResultType, IdResult idResult, IdR
void WriteSConvert(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef signedValue); void WriteSConvert(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef signedValue);
void WriteFConvert(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue); void WriteFConvert(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef floatValue);
void WriteQuantizeToF16(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef value); void WriteQuantizeToF16(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef value);
void WriteConvertPtrToU(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef pointer);
void WriteConvertUToPtr(Blob *blob,
IdResultType idResultType,
IdResult idResult,
IdRef integerValue);
void WriteBitcast(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand); void WriteBitcast(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand);
void WriteSNegate(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand); void WriteSNegate(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand);
void WriteFNegate(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand); void WriteFNegate(Blob *blob, IdResultType idResultType, IdResult idResult, IdRef operand);
......
...@@ -439,18 +439,6 @@ void ParseTypeFunction(const uint32_t *_instruction, ...@@ -439,18 +439,6 @@ void ParseTypeFunction(const uint32_t *_instruction,
} }
} }
} }
void ParseTypeForwardPointer(const uint32_t *_instruction,
IdRef *pointerType,
spv::StorageClass *storageClass)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpTypeForwardPointer);
uint32_t _o = 1;
*pointerType = IdRef(_instruction[_o++]);
*storageClass = spv::StorageClass(_instruction[_o++]);
}
void ParseConstantTrue(const uint32_t *_instruction, IdResultType *idResultType, IdResult *idResult) void ParseConstantTrue(const uint32_t *_instruction, IdResultType *idResultType, IdResult *idResult)
{ {
spv::Op _op; spv::Op _op;
...@@ -715,25 +703,6 @@ void ParseCopyMemory(const uint32_t *_instruction, ...@@ -715,25 +703,6 @@ void ParseCopyMemory(const uint32_t *_instruction,
*memoryAccess = spv::MemoryAccessMask(_instruction[_o++]); *memoryAccess = spv::MemoryAccessMask(_instruction[_o++]);
} }
} }
void ParseCopyMemorySized(const uint32_t *_instruction,
IdRef *target,
IdRef *source,
IdRef *size,
spv::MemoryAccessMask *memoryAccess)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpCopyMemorySized);
uint32_t _o = 1;
*target = IdRef(_instruction[_o++]);
*source = IdRef(_instruction[_o++]);
*size = IdRef(_instruction[_o++]);
if (memoryAccess && _o < _length)
{
*memoryAccess = spv::MemoryAccessMask(_instruction[_o++]);
}
}
void ParseAccessChain(const uint32_t *_instruction, void ParseAccessChain(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
...@@ -794,30 +763,6 @@ void ParseArrayLength(const uint32_t *_instruction, ...@@ -794,30 +763,6 @@ void ParseArrayLength(const uint32_t *_instruction,
*structure = IdRef(_instruction[_o++]); *structure = IdRef(_instruction[_o++]);
*arraymember = LiteralInteger(_instruction[_o++]); *arraymember = LiteralInteger(_instruction[_o++]);
} }
void ParseInBoundsPtrAccessChain(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *base,
IdRef *element,
IdRefList *indexesList)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpInBoundsPtrAccessChain);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*base = IdRef(_instruction[_o++]);
*element = IdRef(_instruction[_o++]);
if (indexesList)
{
while (_o < _length)
{
indexesList->emplace_back(_instruction[_o++]);
}
}
}
void ParseDecorate(const uint32_t *_instruction, void ParseDecorate(const uint32_t *_instruction,
IdRef *target, IdRef *target,
spv::Decoration *decoration, spv::Decoration *decoration,
...@@ -1464,6 +1409,36 @@ void ParseImage(const uint32_t *_instruction, ...@@ -1464,6 +1409,36 @@ void ParseImage(const uint32_t *_instruction,
*idResult = IdResult(_instruction[_o++]); *idResult = IdResult(_instruction[_o++]);
*sampledImage = IdRef(_instruction[_o++]); *sampledImage = IdRef(_instruction[_o++]);
} }
void ParseImageQuerySizeLod(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image,
IdRef *levelofDetail)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpImageQuerySizeLod);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*image = IdRef(_instruction[_o++]);
*levelofDetail = IdRef(_instruction[_o++]);
}
void ParseImageQuerySize(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpImageQuerySize);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*image = IdRef(_instruction[_o++]);
}
void ParseImageQueryLod(const uint32_t *_instruction, void ParseImageQueryLod(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
...@@ -1480,6 +1455,34 @@ void ParseImageQueryLod(const uint32_t *_instruction, ...@@ -1480,6 +1455,34 @@ void ParseImageQueryLod(const uint32_t *_instruction,
*sampledImage = IdRef(_instruction[_o++]); *sampledImage = IdRef(_instruction[_o++]);
*coordinate = IdRef(_instruction[_o++]); *coordinate = IdRef(_instruction[_o++]);
} }
void ParseImageQueryLevels(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpImageQueryLevels);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*image = IdRef(_instruction[_o++]);
}
void ParseImageQuerySamples(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpImageQuerySamples);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*image = IdRef(_instruction[_o++]);
}
void ParseConvertFToU(const uint32_t *_instruction, void ParseConvertFToU(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
...@@ -1592,34 +1595,6 @@ void ParseQuantizeToF16(const uint32_t *_instruction, ...@@ -1592,34 +1595,6 @@ void ParseQuantizeToF16(const uint32_t *_instruction,
*idResult = IdResult(_instruction[_o++]); *idResult = IdResult(_instruction[_o++]);
*value = IdRef(_instruction[_o++]); *value = IdRef(_instruction[_o++]);
} }
void ParseConvertPtrToU(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *pointer)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpConvertPtrToU);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*pointer = IdRef(_instruction[_o++]);
}
void ParseConvertUToPtr(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *integerValue)
{
spv::Op _op;
uint32_t _length;
GetInstructionOpAndLength(_instruction, &_op, &_length);
ASSERT(_op == spv::OpConvertUToPtr);
uint32_t _o = 1;
*idResultType = IdResultType(_instruction[_o++]);
*idResult = IdResult(_instruction[_o++]);
*integerValue = IdRef(_instruction[_o++]);
}
void ParseBitcast(const uint32_t *_instruction, void ParseBitcast(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
......
...@@ -100,9 +100,6 @@ void ParseTypeFunction(const uint32_t *_instruction, ...@@ -100,9 +100,6 @@ void ParseTypeFunction(const uint32_t *_instruction,
IdResult *idResult, IdResult *idResult,
IdRef *returnType, IdRef *returnType,
IdRefList *parameterList); IdRefList *parameterList);
void ParseTypeForwardPointer(const uint32_t *_instruction,
IdRef *pointerType,
spv::StorageClass *storageClass);
void ParseConstantTrue(const uint32_t *_instruction, void ParseConstantTrue(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult); IdResult *idResult);
...@@ -171,11 +168,6 @@ void ParseCopyMemory(const uint32_t *_instruction, ...@@ -171,11 +168,6 @@ void ParseCopyMemory(const uint32_t *_instruction,
IdRef *target, IdRef *target,
IdRef *source, IdRef *source,
spv::MemoryAccessMask *memoryAccess); spv::MemoryAccessMask *memoryAccess);
void ParseCopyMemorySized(const uint32_t *_instruction,
IdRef *target,
IdRef *source,
IdRef *size,
spv::MemoryAccessMask *memoryAccess);
void ParseAccessChain(const uint32_t *_instruction, void ParseAccessChain(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
...@@ -191,12 +183,6 @@ void ParseArrayLength(const uint32_t *_instruction, ...@@ -191,12 +183,6 @@ void ParseArrayLength(const uint32_t *_instruction,
IdResult *idResult, IdResult *idResult,
IdRef *structure, IdRef *structure,
LiteralInteger *arraymember); LiteralInteger *arraymember);
void ParseInBoundsPtrAccessChain(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *base,
IdRef *element,
IdRefList *indexesList);
void ParseDecorate(const uint32_t *_instruction, void ParseDecorate(const uint32_t *_instruction,
IdRef *target, IdRef *target,
spv::Decoration *decoration, spv::Decoration *decoration,
...@@ -358,11 +344,28 @@ void ParseImage(const uint32_t *_instruction, ...@@ -358,11 +344,28 @@ void ParseImage(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
IdRef *sampledImage); IdRef *sampledImage);
void ParseImageQuerySizeLod(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image,
IdRef *levelofDetail);
void ParseImageQuerySize(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image);
void ParseImageQueryLod(const uint32_t *_instruction, void ParseImageQueryLod(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
IdRef *sampledImage, IdRef *sampledImage,
IdRef *coordinate); IdRef *coordinate);
void ParseImageQueryLevels(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image);
void ParseImageQuerySamples(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *image);
void ParseConvertFToU(const uint32_t *_instruction, void ParseConvertFToU(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
...@@ -395,14 +398,6 @@ void ParseQuantizeToF16(const uint32_t *_instruction, ...@@ -395,14 +398,6 @@ void ParseQuantizeToF16(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
IdRef *value); IdRef *value);
void ParseConvertPtrToU(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *pointer);
void ParseConvertUToPtr(const uint32_t *_instruction,
IdResultType *idResultType,
IdResult *idResult,
IdRef *integerValue);
void ParseBitcast(const uint32_t *_instruction, void ParseBitcast(const uint32_t *_instruction,
IdResultType *idResultType, IdResultType *idResultType,
IdResult *idResult, IdResult *idResult,
......
...@@ -348,6 +348,11 @@ inline bool IsSampler2DMSArray(TBasicType type) ...@@ -348,6 +348,11 @@ inline bool IsSampler2DMSArray(TBasicType type)
} }
} }
inline bool IsSamplerMS(TBasicType type)
{
return IsSampler2DMS(type) || IsSampler2DMSArray(type);
}
inline bool IsFloatImage(TBasicType type) inline bool IsFloatImage(TBasicType type)
{ {
switch (type) switch (type)
...@@ -645,6 +650,62 @@ inline bool IsSamplerArray(TBasicType type) ...@@ -645,6 +650,62 @@ inline bool IsSamplerArray(TBasicType type)
return false; return false;
} }
inline bool IsSampler1D(TBasicType type)
{
switch (type)
{
case EbtSampler1D:
case EbtISampler1D:
case EbtUSampler1D:
case EbtSampler1DShadow:
return true;
case EbtSampler2D:
case EbtSamplerCube:
case EbtSampler3D:
case EbtISampler3D:
case EbtUSampler3D:
case EbtSamplerExternalOES:
case EbtSamplerExternal2DY2YEXT:
case EbtSampler2DRect:
case EbtSampler2DArray:
case EbtSampler2DMS:
case EbtSampler2DMSArray:
case EbtISampler2D:
case EbtISamplerCube:
case EbtISampler2DArray:
case EbtISampler2DMS:
case EbtISampler2DMSArray:
case EbtUSampler2D:
case EbtUSamplerCube:
case EbtUSampler2DArray:
case EbtUSampler2DMS:
case EbtUSampler2DMSArray:
case EbtSampler2DShadow:
case EbtSamplerCubeShadow:
case EbtSampler2DArrayShadow:
case EbtSampler1DArray:
case EbtSampler1DArrayShadow:
case EbtSamplerBuffer:
case EbtSamplerCubeArray:
case EbtSamplerCubeArrayShadow:
case EbtSampler2DRectShadow:
case EbtISampler1DArray:
case EbtISampler2DRect:
case EbtISamplerBuffer:
case EbtISamplerCubeArray:
case EbtUSampler1DArray:
case EbtUSampler2DRect:
case EbtUSamplerBuffer:
case EbtUSamplerCubeArray:
case EbtSamplerVideoWEBGL:
return false;
default:
ASSERT(!IsSampler(type));
}
return false;
}
inline bool IsShadowSampler(TBasicType type) inline bool IsShadowSampler(TBasicType type)
{ {
switch (type) switch (type)
......
...@@ -60,8 +60,8 @@ struct SpirvType ...@@ -60,8 +60,8 @@ struct SpirvType
TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified; TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified;
// For sampled images (i.e. GLSL samplers), there are two type ids; one is the OpTypeImage that // For sampled images (i.e. GLSL samplers), there are two type ids; one is the OpTypeImage that
// declares the image itself, and one OpTypeSampledImage. `imageOnly` distinguishes between // declares the image itself, and one OpTypeSampledImage. `isSamplerBaseImage` distinguishes
// these two types. Note that for the former, the basic type is still Ebt*Sampler* to // between these two types. Note that for the former, the basic type is still Ebt*Sampler* to
// distinguish it from storage images (which have a basic type of Ebt*Image*). // distinguish it from storage images (which have a basic type of Ebt*Image*).
bool isSamplerBaseImage = false; bool isSamplerBaseImage = false;
}; };
......
...@@ -297,12 +297,6 @@ enum TOperator : uint16_t ...@@ -297,12 +297,6 @@ enum TOperator : uint16_t
EOpTexture2DLodVS, EOpTexture2DLodVS,
EOpTexture2DProjLodVS, EOpTexture2DProjLodVS,
EOpTextureCubeLodVS, EOpTextureCubeLodVS,
EOpTexture1DLodVS,
EOpTexture1DProjLodVS,
EOpShadow1DLodVS,
EOpShadow1DProjLodVS,
EOpShadow2DLodVS,
EOpShadow2DProjLodVS,
// Group TextureFirstVersionsLodFS // Group TextureFirstVersionsLodFS
EOpTexture2DLodEXTFS, EOpTexture2DLodEXTFS,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -481,14 +481,6 @@ GROUP BEGIN Texture {"queryFunction": true} ...@@ -481,14 +481,6 @@ GROUP BEGIN Texture {"queryFunction": true}
vec4 texture2DProjLod(sampler2D, vec3, float); vec4 texture2DProjLod(sampler2D, vec3, float);
vec4 texture2DProjLod(sampler2D, vec4, float); vec4 texture2DProjLod(sampler2D, vec4, float);
vec4 textureCubeLod(samplerCube, vec3, float); vec4 textureCubeLod(samplerCube, vec3, float);
DEFAULT METADATA {"hasSideEffects": "true"}
vec4 texture1DLod(sampler1D, float, float);
vec4 texture1DProjLod(sampler1D, vec2, float);
vec4 texture1DProjLod(sampler1D, vec4, float);
vec4 shadow1DLod(sampler1DShadow, vec3, float);
vec4 shadow1DProjLod(sampler1DShadow, vec4, float);
vec4 shadow2DLod(sampler2DShadow, vec3, float);
vec4 shadow2DProjLod(sampler2DShadow, vec4, float);
GROUP END LodVS GROUP END LodVS
// EXT_shader_texture_lod brings some lod variants to fragment shaders // EXT_shader_texture_lod brings some lod variants to fragment shaders
......
...@@ -395,11 +395,14 @@ class RewriteCubeMapSamplersAs2DArrayTraverser : public TIntermTraverser ...@@ -395,11 +395,14 @@ class RewriteCubeMapSamplersAs2DArrayTraverser : public TIntermTraverser
// Create the function parameters: vec3 P, vec3 dPdx, vec3 dPdy, // Create the function parameters: vec3 P, vec3 dPdx, vec3 dPdy,
// out vec2 dUVdx, out vec2 dUVdy // out vec2 dUVdx, out vec2 dUVdy
const TType *vec3Type = StaticType::GetBasic<EbtFloat, 3>(); const TType *vec3Type = StaticType::GetBasic<EbtFloat, 3>();
TVariable *pVar = TType *inVec3Type = new TType(*vec3Type);
new TVariable(mSymbolTable, ImmutableString("P"), vec3Type, SymbolType::AngleInternal); inVec3Type->setQualifier(EvqIn);
TVariable *dPdxVar = new TVariable(mSymbolTable, ImmutableString("dPdx"), vec3Type,
TVariable *pVar = new TVariable(mSymbolTable, ImmutableString("P"), inVec3Type,
SymbolType::AngleInternal);
TVariable *dPdxVar = new TVariable(mSymbolTable, ImmutableString("dPdx"), inVec3Type,
SymbolType::AngleInternal); SymbolType::AngleInternal);
TVariable *dPdyVar = new TVariable(mSymbolTable, ImmutableString("dPdy"), vec3Type, TVariable *dPdyVar = new TVariable(mSymbolTable, ImmutableString("dPdy"), inVec3Type,
SymbolType::AngleInternal); SymbolType::AngleInternal);
const TType *vec2Type = StaticType::GetBasic<EbtFloat, 2>(); const TType *vec2Type = StaticType::GetBasic<EbtFloat, 2>();
......
...@@ -178,5 +178,5 @@ void main() ...@@ -178,5 +178,5 @@ void main()
// Samplers are only supported on ES3. // Samplers are only supported on ES3.
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SamplersTest); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SamplersTest);
ANGLE_INSTANTIATE_TEST_ES3(SamplersTest); ANGLE_INSTANTIATE_TEST_ES3(SamplersTest);
ANGLE_INSTANTIATE_TEST_ES31(SamplersTest31); ANGLE_INSTANTIATE_TEST_ES31_AND(SamplersTest31, WithDirectSPIRVGeneration(ES31_VULKAN()));
} // namespace angle } // namespace angle
...@@ -9482,7 +9482,7 @@ ANGLE_INSTANTIATE_TEST_ES3(Texture2DBaseMaxTestES3); ...@@ -9482,7 +9482,7 @@ ANGLE_INSTANTIATE_TEST_ES3(Texture2DBaseMaxTestES3);
ANGLE_INSTANTIATE_TEST_ES2(Texture3DTestES2); ANGLE_INSTANTIATE_TEST_ES2(Texture3DTestES2);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture3DTestES3); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture3DTestES3);
ANGLE_INSTANTIATE_TEST_ES3(Texture3DTestES3); ANGLE_INSTANTIATE_TEST_ES3_AND(Texture3DTestES3, WithDirectSPIRVGeneration(ES3_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DIntegerAlpha1TestES3); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DIntegerAlpha1TestES3);
ANGLE_INSTANTIATE_TEST_ES3(Texture2DIntegerAlpha1TestES3); ANGLE_INSTANTIATE_TEST_ES3(Texture2DIntegerAlpha1TestES3);
...@@ -9491,13 +9491,14 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DUnsignedIntegerAlpha1Test ...@@ -9491,13 +9491,14 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DUnsignedIntegerAlpha1Test
ANGLE_INSTANTIATE_TEST_ES3(Texture2DUnsignedIntegerAlpha1TestES3); ANGLE_INSTANTIATE_TEST_ES3(Texture2DUnsignedIntegerAlpha1TestES3);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ShadowSamplerPlusSampler3DTestES3); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ShadowSamplerPlusSampler3DTestES3);
ANGLE_INSTANTIATE_TEST_ES3(ShadowSamplerPlusSampler3DTestES3); ANGLE_INSTANTIATE_TEST_ES3_AND(ShadowSamplerPlusSampler3DTestES3,
WithDirectSPIRVGeneration(ES3_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SamplerTypeMixTestES3); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SamplerTypeMixTestES3);
ANGLE_INSTANTIATE_TEST_ES3(SamplerTypeMixTestES3); ANGLE_INSTANTIATE_TEST_ES3_AND(SamplerTypeMixTestES3, WithDirectSPIRVGeneration(ES3_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DArrayTestES3); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture2DArrayTestES3);
ANGLE_INSTANTIATE_TEST_ES3(Texture2DArrayTestES3); ANGLE_INSTANTIATE_TEST_ES3_AND(Texture2DArrayTestES3, WithDirectSPIRVGeneration(ES3_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TextureSizeTextureArrayTest); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TextureSizeTextureArrayTest);
ANGLE_INSTANTIATE_TEST_ES3(TextureSizeTextureArrayTest); ANGLE_INSTANTIATE_TEST_ES3(TextureSizeTextureArrayTest);
...@@ -9553,12 +9554,12 @@ ANGLE_INSTANTIATE_TEST_ES3(Texture2DArrayIntegerTestES3); ...@@ -9553,12 +9554,12 @@ ANGLE_INSTANTIATE_TEST_ES3(Texture2DArrayIntegerTestES3);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture3DIntegerTestES3); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Texture3DIntegerTestES3);
ANGLE_INSTANTIATE_TEST_ES3(Texture3DIntegerTestES3); ANGLE_INSTANTIATE_TEST_ES3(Texture3DIntegerTestES3);
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(Texture2DDepthTest); ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND(Texture2DDepthTest, WithDirectSPIRVGeneration(ES3_VULKAN()));
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(PBOCompressedTextureTest); ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(PBOCompressedTextureTest);
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ETC1CompressedTextureTest); ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ETC1CompressedTextureTest);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TextureBufferTestES31); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TextureBufferTestES31);
ANGLE_INSTANTIATE_TEST_ES31(TextureBufferTestES31); ANGLE_INSTANTIATE_TEST_ES31_AND(TextureBufferTestES31, WithDirectSPIRVGeneration(ES31_VULKAN()));
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CopyImageTestES31); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CopyImageTestES31);
ANGLE_INSTANTIATE_TEST_ES31(CopyImageTestES31); ANGLE_INSTANTIATE_TEST_ES31(CopyImageTestES31);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment