Merge pull request #1972 from andflo-Arm/master
Fix construction issue for 8 and 16 bit types.
This commit is contained in:
commit
86258aab80
82
Test/baseResults/spv.8bit-16bit-construction.frag.out
Normal file
82
Test/baseResults/spv.8bit-16bit-construction.frag.out
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
spv.8bit-16bit-construction.frag
|
||||||
|
Validation failed
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80008
|
||||||
|
// Id's are bound by 43
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
Capability StorageUniformBufferBlock16
|
||||||
|
Capability UniformAndStorageBuffer8BitAccess
|
||||||
|
Extension "SPV_KHR_16bit_storage"
|
||||||
|
Extension "SPV_KHR_8bit_storage"
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Fragment 4 "main"
|
||||||
|
ExecutionMode 4 OriginUpperLeft
|
||||||
|
Source GLSL 450
|
||||||
|
SourceExtension "GL_EXT_shader_16bit_storage"
|
||||||
|
SourceExtension "GL_EXT_shader_8bit_storage"
|
||||||
|
Name 4 "main"
|
||||||
|
Name 11 "B"
|
||||||
|
MemberName 11(B) 0 "i8_from_i16"
|
||||||
|
MemberName 11(B) 1 "i16_from_i8"
|
||||||
|
MemberName 11(B) 2 "u8_from_u16"
|
||||||
|
MemberName 11(B) 3 "u16_from_u8"
|
||||||
|
MemberName 11(B) 4 "f16_from_i8"
|
||||||
|
Name 13 ""
|
||||||
|
MemberDecorate 11(B) 0 Offset 0
|
||||||
|
MemberDecorate 11(B) 1 Offset 2
|
||||||
|
MemberDecorate 11(B) 2 Offset 4
|
||||||
|
MemberDecorate 11(B) 3 Offset 6
|
||||||
|
MemberDecorate 11(B) 4 Offset 8
|
||||||
|
Decorate 11(B) BufferBlock
|
||||||
|
Decorate 13 DescriptorSet 0
|
||||||
|
Decorate 13 Binding 0
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeInt 8 1
|
||||||
|
7: TypeInt 16 1
|
||||||
|
8: TypeInt 8 0
|
||||||
|
9: TypeInt 16 0
|
||||||
|
10: TypeFloat 16
|
||||||
|
11(B): TypeStruct 6(int8_t) 7(int16_t) 8(int8_t) 9(int16_t) 10(float16_t)
|
||||||
|
12: TypePointer Uniform 11(B)
|
||||||
|
13: 12(ptr) Variable Uniform
|
||||||
|
14: TypeInt 32 1
|
||||||
|
15: 14(int) Constant 0
|
||||||
|
16: 14(int) Constant 1
|
||||||
|
19: TypePointer Uniform 6(int8_t)
|
||||||
|
23: TypePointer Uniform 7(int16_t)
|
||||||
|
25: 14(int) Constant 2
|
||||||
|
26: TypeInt 32 0
|
||||||
|
27: 26(int) Constant 1
|
||||||
|
30: TypePointer Uniform 8(int8_t)
|
||||||
|
32: 14(int) Constant 3
|
||||||
|
35: TypePointer Uniform 9(int16_t)
|
||||||
|
37: 14(int) Constant 4
|
||||||
|
39: TypeFloat 32
|
||||||
|
41: TypePointer Uniform 10(float16_t)
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
17: 7(int16_t) SConvert 16
|
||||||
|
18: 6(int8_t) SConvert 17
|
||||||
|
20: 19(ptr) AccessChain 13 15
|
||||||
|
Store 20 18
|
||||||
|
21: 6(int8_t) SConvert 16
|
||||||
|
22: 7(int16_t) SConvert 21
|
||||||
|
24: 23(ptr) AccessChain 13 16
|
||||||
|
Store 24 22
|
||||||
|
28: 9(int16_t) UConvert 27
|
||||||
|
29: 8(int8_t) UConvert 28
|
||||||
|
31: 30(ptr) AccessChain 13 25
|
||||||
|
Store 31 29
|
||||||
|
33: 8(int8_t) UConvert 27
|
||||||
|
34: 9(int16_t) UConvert 33
|
||||||
|
36: 35(ptr) AccessChain 13 32
|
||||||
|
Store 36 34
|
||||||
|
38: 6(int8_t) SConvert 16
|
||||||
|
40:10(float16_t) FConvert 38
|
||||||
|
42: 41(ptr) AccessChain 13 37
|
||||||
|
Store 42 40
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
22
Test/spv.8bit-16bit-construction.frag
Normal file
22
Test/spv.8bit-16bit-construction.frag
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#version 450 core
|
||||||
|
|
||||||
|
#extension GL_EXT_shader_8bit_storage : enable
|
||||||
|
#extension GL_EXT_shader_16bit_storage : enable
|
||||||
|
|
||||||
|
buffer B
|
||||||
|
{
|
||||||
|
int8_t i8_from_i16;
|
||||||
|
int16_t i16_from_i8;
|
||||||
|
uint8_t u8_from_u16;
|
||||||
|
uint16_t u16_from_u8;
|
||||||
|
float16_t f16_from_i8;
|
||||||
|
};
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
i8_from_i16 = int8_t(int16_t(1));
|
||||||
|
i16_from_i8 = int16_t(int8_t(1));
|
||||||
|
u8_from_u16 = uint8_t(uint16_t(1));
|
||||||
|
u16_from_u8 = uint16_t(uint8_t(1));
|
||||||
|
f16_from_i8 = float16_t(int8_t(1));
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||||
// Copyright (C) 2012-2015 LunarG, Inc.
|
// Copyright (C) 2012-2015 LunarG, Inc.
|
||||||
// Copyright (C) 2015-2018 Google, Inc.
|
// Copyright (C) 2015-2018 Google, Inc.
|
||||||
// Copyright (C) 2017 ARM Limited.
|
// Copyright (C) 2017, 2019 ARM Limited.
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
@ -7017,8 +7017,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
if (!intermediate.getArithemeticFloat16Enabled()) {
|
if (!intermediate.getArithemeticFloat16Enabled()) {
|
||||||
TType tempType(EbtFloat, EvqTemporary, type.getVectorSize());
|
TType tempType(EbtFloat, EvqTemporary, type.getVectorSize());
|
||||||
newNode = node;
|
newNode = node;
|
||||||
if (tempType != newNode->getType())
|
if (tempType != newNode->getType()) {
|
||||||
newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructVec2 + op - EOpConstructF16Vec2), tempType, node->getLoc());
|
TOperator aggregateOp;
|
||||||
|
if (op == EOpConstructFloat16)
|
||||||
|
aggregateOp = EOpConstructFloat;
|
||||||
|
else
|
||||||
|
aggregateOp = (TOperator)(EOpConstructVec2 + op - EOpConstructF16Vec2);
|
||||||
|
newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
||||||
|
}
|
||||||
newNode = intermediate.addConversion(EbtFloat16, newNode);
|
newNode = intermediate.addConversion(EbtFloat16, newNode);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
@ -7034,8 +7040,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
if (!intermediate.getArithemeticInt8Enabled()) {
|
if (!intermediate.getArithemeticInt8Enabled()) {
|
||||||
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
||||||
newNode = node;
|
newNode = node;
|
||||||
if (tempType != newNode->getType())
|
if (tempType != newNode->getType()) {
|
||||||
newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructIVec2 + op - EOpConstructI8Vec2), tempType, node->getLoc());
|
TOperator aggregateOp;
|
||||||
|
if (op == EOpConstructInt8)
|
||||||
|
aggregateOp = EOpConstructInt;
|
||||||
|
else
|
||||||
|
aggregateOp = (TOperator)(EOpConstructIVec2 + op - EOpConstructI8Vec2);
|
||||||
|
newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
||||||
|
}
|
||||||
newNode = intermediate.addConversion(EbtInt8, newNode);
|
newNode = intermediate.addConversion(EbtInt8, newNode);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
@ -7051,8 +7063,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
if (!intermediate.getArithemeticInt8Enabled()) {
|
if (!intermediate.getArithemeticInt8Enabled()) {
|
||||||
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
||||||
newNode = node;
|
newNode = node;
|
||||||
if (tempType != newNode->getType())
|
if (tempType != newNode->getType()) {
|
||||||
newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructUVec2 + op - EOpConstructU8Vec2), tempType, node->getLoc());
|
TOperator aggregateOp;
|
||||||
|
if (op == EOpConstructUint8)
|
||||||
|
aggregateOp = EOpConstructUint;
|
||||||
|
else
|
||||||
|
aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU8Vec2);
|
||||||
|
newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
||||||
|
}
|
||||||
newNode = intermediate.addConversion(EbtUint8, newNode);
|
newNode = intermediate.addConversion(EbtUint8, newNode);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
@ -7068,8 +7086,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
if (!intermediate.getArithemeticInt16Enabled()) {
|
if (!intermediate.getArithemeticInt16Enabled()) {
|
||||||
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
||||||
newNode = node;
|
newNode = node;
|
||||||
if (tempType != newNode->getType())
|
if (tempType != newNode->getType()) {
|
||||||
newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructIVec2 + op - EOpConstructI16Vec2), tempType, node->getLoc());
|
TOperator aggregateOp;
|
||||||
|
if (op == EOpConstructInt16)
|
||||||
|
aggregateOp = EOpConstructInt;
|
||||||
|
else
|
||||||
|
aggregateOp = (TOperator)(EOpConstructIVec2 + op - EOpConstructI16Vec2);
|
||||||
|
newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
||||||
|
}
|
||||||
newNode = intermediate.addConversion(EbtInt16, newNode);
|
newNode = intermediate.addConversion(EbtInt16, newNode);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
@ -7085,8 +7109,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
if (!intermediate.getArithemeticInt16Enabled()) {
|
if (!intermediate.getArithemeticInt16Enabled()) {
|
||||||
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
||||||
newNode = node;
|
newNode = node;
|
||||||
if (tempType != newNode->getType())
|
if (tempType != newNode->getType()) {
|
||||||
newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2), tempType, node->getLoc());
|
TOperator aggregateOp;
|
||||||
|
if (op == EOpConstructUint16)
|
||||||
|
aggregateOp = EOpConstructUint;
|
||||||
|
else
|
||||||
|
aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2);
|
||||||
|
newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
||||||
|
}
|
||||||
newNode = intermediate.addConversion(EbtUint16, newNode);
|
newNode = intermediate.addConversion(EbtUint16, newNode);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2016 Google, Inc.
|
// Copyright (C) 2016 Google, Inc.
|
||||||
|
// Copyright (C) 2019 ARM Limited.
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
@ -263,6 +264,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
"spv.8bitstorage_Error-uint.frag",
|
"spv.8bitstorage_Error-uint.frag",
|
||||||
"spv.8bitstorage-ubo.vert",
|
"spv.8bitstorage-ubo.vert",
|
||||||
"spv.8bitstorage-ssbo.vert",
|
"spv.8bitstorage-ssbo.vert",
|
||||||
|
"spv.8bit-16bit-construction.frag",
|
||||||
"spv.accessChain.frag",
|
"spv.accessChain.frag",
|
||||||
"spv.aggOps.frag",
|
"spv.aggOps.frag",
|
||||||
"spv.always-discard.frag",
|
"spv.always-discard.frag",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user