[spirv] Emit warning for packoffset (#951)

We do not support packoffset right now. Emit warning and ignore it.
This commit is contained in:
Lei Zhang 2018-01-03 10:13:04 -05:00 коммит произвёл GitHub
Родитель 4bee20cac9
Коммит d39c94c56f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 29 добавлений и 2 удалений

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

@ -2348,4 +2348,8 @@ either because of no Vulkan equivalents at the moment, or because of deprecation
only allowed to be applied to members of structures. A warning will be issued by the compiler.
* The Hull shader ``partitioning`` attribute may not have the ``pow2`` value. The compiler
will emit an error. Other attribute values are supported and described in the
`Hull Entry Point Attributes`_ section.
`Hull Entry Point Attributes`_ section.
* ``cbuffer``/``tbuffer`` member initializer: no Vulkan equivalent. The compiler
will emit an warning and ignore it.
* ``:packoffset()``: Not supported right now. The compiler will emit an warning
and ignore it.

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

@ -883,12 +883,17 @@ void SPIRVEmitter::doHLSLBufferDecl(const HLSLBufferDecl *bufferDecl) {
// Check and emit warnings for member intializers which are not
// supported in Vulkan
for (const auto *member : bufferDecl->decls()) {
if (const auto *varMember = dyn_cast<VarDecl>(member))
if (const auto *varMember = dyn_cast<VarDecl>(member)) {
if (const auto *init = varMember->getInit())
emitWarning("%select{tbuffer|cbuffer}0 member initializer "
"ignored since no equivalent in Vulkan",
init->getExprLoc())
<< bufferDecl->isCBuffer() << init->getSourceRange();
for (const auto *annotation : varMember->getUnusualAnnotations())
if (const auto *packing = dyn_cast<hlsl::ConstantPacking>(annotation))
emitWarning("packoffset ignored since not supported", packing->Loc);
}
}
validateVKAttributes(bufferDecl);
(void)declIdMapper.createCTBuffer(bufferDecl);

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

@ -0,0 +1,14 @@
// Run: %dxc -T vs_6_0 -E main
cbuffer MyCBuffer {
float4 data1;
float4 data2 : packoffset(c1);
float data3 : packoffset(c2.y);
}
float4 main() : A {
return data1 + data2 + data3;
}
// CHECK: :5:20: warning: packoffset ignored since not supported
// CHECK: :6:20: warning: packoffset ignored since not supported

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

@ -1091,6 +1091,10 @@ TEST_F(FileTest, VulkanLayoutPushConstantStd430) {
runFileTest("vk.layout.push-constant.std430.hlsl");
}
TEST_F(FileTest, VulkanLayoutCBufferPackOffset) {
runFileTest("vk.layout.cbuffer.packoffset.hlsl", Expect::Warning);
}
// HS: for different Patch Constant Functions
TEST_F(FileTest, HullShaderPCFVoid) { runFileTest("hs.pcf.void.hlsl"); }
TEST_F(FileTest, HullShaderPCFTakesInputPatch) {