From 0f55649cc1aa8ad3218b7f8ba7b1eabdd2ec6526 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 8 Dec 2017 14:23:12 -0800 Subject: Cleanups to `ParameterBlock` behavior. (#304) * Cleanups to `ParameterBlock` behavior. These add some more realistic tests using the `ParameterBlock` support, and show that it can work with the "rewriter" mode. Unfortunately, this code does *not* currently work with the rewriter + the IR at once. That will need to be fixed in a follow-on change, because I now see that the root problem is pretty ugly. * cleanup --- source/slang/ir.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source/slang/ir.cpp') diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index d35ffe2d1..d4d2f0f51 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -956,16 +956,22 @@ namespace Slang IRInst* IRBuilder::emitLoad( IRValue* ptr) { - auto ptrType = ptr->getType()->As(); - if( !ptrType ) + RefPtr valueType; + if(auto ptrType = ptr->getType()->As()) + { + valueType = ptrType->getValueType(); + } + else if(auto ptrLikeType = ptr->getType()->As()) + { + valueType = ptrLikeType->getElementType(); + } + else { // Bad! SLANG_ASSERT(ptrType); return nullptr; } - auto valueType = ptrType->getValueType(); - auto inst = createInst( this, kIROp_Load, -- cgit v1.2.3