From 453a9ca07417bbc17294267c5e44843d16e93c50 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 17 Jul 2017 13:32:20 -0700 Subject: Handle arrays when scalarizing "resources in structs" The basic idea is that an array of `struct`s will get scalarized into per-field arrays (for any fields that need to be scalarized). So given: struct Foo { float x; Texture2D t; }; cbuffer C { Foo foo[4]; } We'll get output like: struct Foo { float x; }; cbuffer C { Foo foo[4]; } Texture2D C_foo_t[4]; (Of course the output would also be translated over to GLSL, but I'm only concerned about this one transformation here). --- source/slang/syntax.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/slang/syntax.h') diff --git a/source/slang/syntax.h b/source/slang/syntax.h index 83b2f5801..3f1c47fb9 100644 --- a/source/slang/syntax.h +++ b/source/slang/syntax.h @@ -244,7 +244,7 @@ namespace Slang : createFunc(createFunc) {} - void* createInstanceImpl() + void* createInstanceImpl() const { return createFunc ? createFunc() : nullptr; } @@ -271,7 +271,7 @@ namespace Slang { } - T* createInstance() + T* createInstance() const { return (T*)createInstanceImpl(); } -- cgit v1.2.3