diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-01-28 12:28:05 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-28 12:28:05 -0500 |
| commit | df9dc5710725d00630831b77ca7005e390383aa6 (patch) | |
| tree | d75dd22c377ee4396c43e6d75518733589d1cf9a /source/slang/emit.cpp | |
| parent | 41fde4b836dbab627f8643a5002b2b6dd0417211 (diff) | |
Feature/bit cast glsl (#808)
* First attempt at asint, asuint, asfloat intrinsics.
* Test with countbits
* Placing glsl definitions first makes them get picked up.
* Some more improvements around asint.
* Add support for vector versions of asint/asunit
* Fix some typos in asuint/asint intrinsics for glsl.
Simplified and increased coverage of as/u/int tests.
* Added bit-cast-double test.
Added notional support for asdouble bit casts to glsl - but couldn't test because glslang doesn't seem to support the extension.
* Try to get double bit casts working - doesn't work cos of block issue.
* Only output parents on intrinic replacement if return type is not void.
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 914aea7fd..71b961616 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -3002,9 +3002,19 @@ struct EmitVisitor } else { + // If it returns void -> then we don't need parenthesis + + const auto returnType = inst->getDataType(); + const bool isVoid = as<IRVoidType>(returnType) != nullptr; + + // We could determine here is the return type is void... if so no braces? + // General case: we are going to emit some more complex text. - Emit("("); + if (!isVoid) + { + Emit("("); + } char const* cursor = name.begin(); char const* end = name.end(); @@ -3364,7 +3374,10 @@ struct EmitVisitor } } - Emit(")"); + if (!isVoid) + { + Emit(")"); + } } } |
