Merge pull request #1190 from jfmarquis/hlsl-store-type-propagation

HLSL: Fix possibly incorrect type conversion in Store2-3-4
This commit is contained in:
John Kessenich 2017-12-21 14:59:34 -07:00 коммит произвёл GitHub
Родитель 848a0ccbfd 3f0aff8ee5
Коммит e08ed0ccf4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 853 добавлений и 868 удалений

Просмотреть файл

@ -41,13 +41,13 @@ gl_FragCoord origin is upper left
0:10 Constant:
0:10 2 (const int)
0:? Construct vec2 ( temp 2-component vector of uint)
0:10 indirect index ( temp float)
0:10 indirect index ( temp uint)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 'byteAddrTemp' ( temp int)
0:10 indirect index ( temp float)
0:10 indirect index ( temp uint)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:10 Constant:
@ -73,13 +73,13 @@ gl_FragCoord origin is upper left
0:11 Constant:
0:11 2 (const int)
0:? Construct vec3 ( temp 3-component vector of uint)
0:11 indirect index ( temp float)
0:11 indirect index ( temp uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 'byteAddrTemp' ( temp int)
0:11 indirect index ( temp float)
0:11 indirect index ( temp uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:11 Constant:
@ -88,7 +88,7 @@ gl_FragCoord origin is upper left
0:11 'byteAddrTemp' ( temp int)
0:11 Constant:
0:11 1 (const int)
0:11 indirect index ( temp float)
0:11 indirect index ( temp uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:11 Constant:
@ -111,13 +111,13 @@ gl_FragCoord origin is upper left
0:12 Constant:
0:12 2 (const int)
0:? Construct vec4 ( temp 4-component vector of uint)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 'byteAddrTemp' ( temp int)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
@ -126,7 +126,7 @@ gl_FragCoord origin is upper left
0:12 'byteAddrTemp' ( temp int)
0:12 Constant:
0:12 1 (const int)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
@ -135,7 +135,7 @@ gl_FragCoord origin is upper left
0:12 'byteAddrTemp' ( temp int)
0:12 Constant:
0:12 2 (const int)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
@ -205,13 +205,13 @@ gl_FragCoord origin is upper left
0:10 Constant:
0:10 2 (const int)
0:? Construct vec2 ( temp 2-component vector of uint)
0:10 indirect index ( temp float)
0:10 indirect index ( temp uint)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 'byteAddrTemp' ( temp int)
0:10 indirect index ( temp float)
0:10 indirect index ( temp uint)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:10 Constant:
@ -237,13 +237,13 @@ gl_FragCoord origin is upper left
0:11 Constant:
0:11 2 (const int)
0:? Construct vec3 ( temp 3-component vector of uint)
0:11 indirect index ( temp float)
0:11 indirect index ( temp uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 'byteAddrTemp' ( temp int)
0:11 indirect index ( temp float)
0:11 indirect index ( temp uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:11 Constant:
@ -252,7 +252,7 @@ gl_FragCoord origin is upper left
0:11 'byteAddrTemp' ( temp int)
0:11 Constant:
0:11 1 (const int)
0:11 indirect index ( temp float)
0:11 indirect index ( temp uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:11 Constant:
@ -275,13 +275,13 @@ gl_FragCoord origin is upper left
0:12 Constant:
0:12 2 (const int)
0:? Construct vec4 ( temp 4-component vector of uint)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 'byteAddrTemp' ( temp int)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
@ -290,7 +290,7 @@ gl_FragCoord origin is upper left
0:12 'byteAddrTemp' ( temp int)
0:12 Constant:
0:12 1 (const int)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:
@ -299,7 +299,7 @@ gl_FragCoord origin is upper left
0:12 'byteAddrTemp' ( temp int)
0:12 Constant:
0:12 2 (const int)
0:12 indirect index ( temp float)
0:12 indirect index ( temp uint)
0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:12 Constant:

Просмотреть файл

@ -18,13 +18,13 @@ local_size = (256, 1, 1)
0:6 Constant:
0:6 2 (const int)
0:? Construct vec2 ( temp 2-component vector of uint)
0:6 indirect index ( temp float)
0:6 indirect index ( temp uint)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
0:6 0 (const uint)
0:6 'byteAddrTemp' ( temp int)
0:6 indirect index ( temp float)
0:6 indirect index ( temp uint)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
@ -87,13 +87,13 @@ local_size = (256, 1, 1)
0:6 Constant:
0:6 2 (const int)
0:? Construct vec2 ( temp 2-component vector of uint)
0:6 indirect index ( temp float)
0:6 indirect index ( temp uint)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
0:6 0 (const uint)
0:6 'byteAddrTemp' ( temp int)
0:6 indirect index ( temp float)
0:6 indirect index ( temp uint)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -3302,7 +3302,13 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect
: EOpIndexIndirect;
vec = intermediate.growAggregate(vec, intermediate.addIndex(idxOp, argArray, offsetIdx, loc));
TIntermTyped* indexVal = intermediate.addIndex(idxOp, argArray, offsetIdx, loc);
TType derefType(argArray->getType(), 0);
derefType.getQualifier().makeTemporary();
indexVal->setType(derefType);
vec = intermediate.growAggregate(vec, indexVal);
}
vec->setType(TType(argArray->getBasicType(), EvqTemporary, size));
@ -3366,8 +3372,14 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
const TType derefType(argArray->getType(), 0);
lValue->setType(derefType);
TIntermTyped* rValue = (size == 1) ? argValue :
intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc);
TIntermTyped* rValue;
if (size == 1) {
rValue = argValue;
} else {
rValue = intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc);
const TType indexType(argValue->getType(), 0);
rValue->setType(indexType);
}
TIntermTyped* assign = intermediate.addAssign(EOpAssign, lValue, rValue, loc);