Allow select resource for library profile.

This commit is contained in:
Xiang Li 2017-08-02 21:17:14 -07:00
Родитель 459b5998a4
Коммит 5d23e2c3d3
2 изменённых файлов: 16 добавлений и 1 удалений

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

@ -846,6 +846,8 @@ void DxilGenerationPass::AddCreateHandleForPhiNodeAndSelect(OP *hlslOP) {
UpdateHandleOperands(Res, handleMap, nonUniformOps);
}
bool bIsLib = m_pHLModule->GetShaderModel()->IsLib();
// ResClass and ResID must be uniform.
// Try to merge res class, res id into imm.
while (1) {
@ -866,7 +868,7 @@ void DxilGenerationPass::AddCreateHandleForPhiNodeAndSelect(OP *hlslOP) {
}
if (!bUpdated) {
if (!nonUniformOps.empty()) {
if (!nonUniformOps.empty() && !bIsLib) {
for (Instruction *I : nonUniformOps) {
// Non uniform res class or res id.
FT->getContext().emitError(I, kResourceMapErrorMsg);

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

@ -0,0 +1,13 @@
// RUN: %dxc -T lib_6_1 %s | FileCheck %s
// Make sure select resource works for lib profile.
// CHECK: call %dx.types.Handle @dx.op.createHandle(
RWStructuredBuffer<float2> buf0;
RWStructuredBuffer<float2> buf1;
void Store(bool bBufX, float2 v, uint idx) {
RWStructuredBuffer<float2> buf = bBufX ? buf0: buf1;
buf[idx] = v;
}