376e61a | Tim Foley | 22 July 2017, 21:07:19 UTC | Merge pull request #136 from tfoleyNV/explicit-sampler-fix Make the "hack" sampler explicit for now | 22 July 2017, 21:07:19 UTC |
edf8caf | Tim Foley | 22 July 2017, 21:05:07 UTC | Make the "hack" sampler explicit for now - We use this to work around the fact that, e.g., `Texture2D.Load` doesn't take a sampler, but the equivalent GLSL operation `texelFetch` requires one - Previously we tried to hide the sampler from the user, hoping that glslang would drop it and we could just ignore it, but that doesn't work - For now we'll go ahead and explicitly show the sampler in the reflection info so that an app can react appropriately - We also generate a unique binding for the sampler, instead of the old behavior that fixed it with `binding = 0` - We still fix it with `set = 0`, so it might still surprise users | 22 July 2017, 21:05:07 UTC |
30fbf64 | Tim Foley | 21 July 2017, 20:48:58 UTC | Merge pull request #135 from tfoleyNV/falcor-hashed-alpha-fixups Map HLSL `frac()` to GLSL `fract()` | 21 July 2017, 20:48:58 UTC |
5a63cb0 | Tim Foley | 21 July 2017, 20:48:12 UTC | Map HLSL `frac()` to GLSL `fract()` | 21 July 2017, 20:48:12 UTC |
6992d0e | Tim Foley | 21 July 2017, 19:31:18 UTC | Merge pull request #134 from tfoleyNV/gh-133 Don't add `flat` qualifier to integer fragment output | 21 July 2017, 19:31:18 UTC |
0048a81 | Tim Foley | 21 July 2017, 19:19:01 UTC | Don't add `flat` qualifier to integer fragment output Fixes #133 We already had logic to skip adding `flat` to a vertex input, and this just extends it to not adding `flat` to a fragment output. Note that explicit qualifiers in the input HLSL/Slang will still be carried through to the output, so it is still possible for a Slang user to shoot themself in the foot with interpolation qualifiers. | 21 July 2017, 19:19:01 UTC |
3fa85ed | Tim Foley | 21 July 2017, 18:52:17 UTC | Merge pull request #132 from tfoleyNV/line-directive-control Add an API option to control emission of `#line` directives | 21 July 2017, 18:52:17 UTC |
9718ab3 | Tim Foley | 21 July 2017, 18:37:31 UTC | Add an API option to control emission of `#line` directives - API users can use this to get "clean" output to aid with debugging Slang issues - Also changes the prefix on intermediate files that Slang dumps, to make them easier to ignore with a regexp | 21 July 2017, 18:37:31 UTC |
85f60e0 | Tim Foley | 20 July 2017, 22:20:25 UTC | Merge pull request #130 from tfoleyNV/vs-write-gllayer Require extension when using `gl_Layer` in VS | 20 July 2017, 22:20:25 UTC |
0cf9bcf | Tim Foley | 20 July 2017, 22:14:35 UTC | Require extension when using `gl_Layer` in VS The requirements for using `gl_Layer` differ by stage, and so we need to pick an appropriate GL version based on the target stage, and then also require a specific extension for anything other than geometry or fragment. | 20 July 2017, 22:14:35 UTC |
b8478a4 | Tim Foley | 20 July 2017, 17:13:54 UTC | Merge pull request #129 from tfoleyNV/single-pass-stereo-ext Translate NV single-pass stereo extension from Slang to GLSL | 20 July 2017, 17:13:54 UTC |
76dca35 | Tim Foley | 19 July 2017, 15:32:44 UTC | Translate NV single-pass stereo extension from Slang to GLSL - The easy part here is treating `NV_` prefixed semantics as another case of "system-value" semantics - Mapping the new semantics (`NV_X_RIGHT` and `NV_VIEWPORT_MASK`) to their GLSL equivalents is harder - Instead of a single "right-eye vertex" output, GLSL defines an array of per-view positions - Instead of a vector of masks, GLSL defines an array of per-view masks - Another point here is that a lot of semantics that appear as `uint` in HLSL are `int` in GLSL, which can lead to conversion issues. - The approach here is to have the lowering pass introduce a notion of assignment with "fixups," which will try to cast things as needed - When assigning to a simple value with the "wrong" type, introduce a cast - When assigning to an array from a vector, break out multiple assignments of individual vector/array elements - In order to facilitate the above, I needed to add actual types to the magic expressions I introduce to represent GLSL builtin variables. These were taken by scanning the online documentation for GL, so they might not be perfect. - Major issues with the approach in this change: - No attempt is being made here to check that the original declaration used a type appropriate to the semantic. The assumption is that this logic only ever triggers for Slang entry points, or GLSL entry points using a Slang `struct` type for input/output (and for right now Slang code is only ever written by "understanding" developers) - In the case of a Slang entry point, we always copy varying parameters in/out around the call to `main_`, so this approach should handle calls to functions with `out` or `in out` parameters okay, but it is *not* robust to cases where we don't want to copy in all the entry point parameters first thing (e.g., a GS), so that will have to change - In the GLSL case (or if we revise the approach to Slang entry points), there is going to be a problem if these converted varying parameters are ever passed as arguments to `out` or `in out` parameters. In these cases we need to do more sleight-of-hand to reify a temporary variable and do the necessary copy-in/copy-out. Being able to do that logic relies on having correct information about callees, which requires having robust semantic analysis of the function body. There is only so much we can do... - A better long-term approach would not rely on an ad-hoc "fixup" conversion during assignment, but would instead implement the GLSL builtin variables as, effectively, global "property" declarations that have both `get` and `set` accessors, and then tunnel a reference to such a property down through lowering, where it can lower to uses of the "getter" or "setter" as appropriate in context (and the result type of the getter/setter can be what we'd want/expect). | 20 July 2017, 17:09:25 UTC |
f07c01c | Tim Foley | 20 July 2017, 01:52:38 UTC | Merge pull request #128 from tfoleyNV/improve-failure-modes Try to improve handling of failures during compilation | 20 July 2017, 01:52:38 UTC |
3f48e1c | Tim Foley | 19 July 2017, 16:36:35 UTC | Try to improve handling of failures during compilation The change is mostly about trying to make sure the compiler "fails safe" when it encounters an internal assumption that isn't met. Most internal errors will now throw exceptions (yes, exceptions are evil, but this will work for now), and these get caught in `spCompile` so that they don't propagate to the user (they just see a message that compilation aborted due to an internal error). Subsequent changes are going to need to work on diagnosing as many of these situations as possible, so that users can at least know what construct in their code was unexpected or unhandled by the compiler. | 20 July 2017, 01:15:37 UTC |
a2b8b4c | Tim Foley | 19 July 2017, 21:54:32 UTC | Merge pull request #127 from tfoleyNV/deployment Use AppVeyor to deploy to GitHub Releases | 19 July 2017, 21:54:32 UTC |
6c71681 | Tim Foley | 19 July 2017, 18:54:42 UTC | Use AppVeyor to deploy to GitHub Releases - Change naming convention for output directory - `windows-x86` and `windows-x64` - Lower-case for `debug`, `release` - Test script needed to be patched up for this - Add packaging and deployment logic to AppVeyor CI script - Trigger deployment on new tag - Compute a release version based on Git tag name (`vX.Y.Z` becomes `X.Y.Z`) - Fallback to hash in case tag isn't available (it should always be) - Bundle files into a few artifacts (binary package + source package) - Set up to push those files into existing GitHub tag/release | 19 July 2017, 21:28:26 UTC |
019bc0d | Tim Foley | 19 July 2017, 18:52:59 UTC | Merge pull request #126 from tfoleyNV/dynamic-library-build Build a dynamic library for Slang | 19 July 2017, 18:52:59 UTC |
a97eac2 | Tim Foley | 19 July 2017, 18:27:23 UTC | Build a dynamic library for Slang - Change the `slang` project from a static library to a dynamic one - Add some details around `slang.h` to make sure DLL export stuff is working - Make the `slangc` executable use the dynamic library - Rename the `glslang` sub-project to `slang-glslang` and move it into the main source hierarchy - This reflects the fact that it isn't a stand-alone tool, and isn't in any way a standard binary of glslang, but rather just an artifact of how Slang uses glslang | 19 July 2017, 18:27:23 UTC |
c5ed9e8 | Tim Foley | 19 July 2017, 17:20:12 UTC | Merge pull request #124 from tfoleyNV/gh-122 Fix up translation of `GetDimensions()` | 19 July 2017, 17:20:12 UTC |
55a2904 | Tim Foley | 19 July 2017, 17:10:17 UTC | Fix up translation of `GetDimensions()` Fixes #122 - In cases with an explicit mip level being specified, there was a mistake in how the argument for setting the mip level in the GLSL code was constructed that led to a parse error in GLSL - Also, that argument is a `uint` in HLSL and an `int` in GLSL, so an explicit cast was needed - The GLSL functions here seem to require a newer GLSL (at least higher than `420`), so I had to add in a capability for builtins to specify a required GLSL version. For now I made these ones require `450`. - Added a test case to confirm that our lowering works (for some definition of "works") | 19 July 2017, 17:12:58 UTC |
a727017 | Tim Foley | 19 July 2017, 16:06:53 UTC | Merge pull request #123 from tfoleyNV/parameter-block-name-fixes Fixes for how parameter block names are set up. | 19 July 2017, 16:06:53 UTC |
efedd5e | Tim Foley | 19 July 2017, 15:49:58 UTC | Fixes for how parameter block names are set up. We generate implicit names for global-scope parameter blocks (including HLSL `cbuffer`s, since the "name" the user sees is really just for reflection purposes), but this had a few problems: - We used the generated names for parameter-binding purposes - Except for a GLSL block with an explicit name, in which case we'd use the internal name and not the reflection name for matching - The generated named didn't match between GLSL and HLSL/Slang declarations This change tries to fix both of these issues. I changed the name generation to try to make it identical between HLSL and GLSL (to the extent we can control it), just in case. But then I also went and changed the parameter-binding-generation logic to use the *reflection* name instead of the internal name when deciding if things are the "same" parameter. | 19 July 2017, 15:49:58 UTC |
4c3d56a | Tim Foley | 18 July 2017, 22:26:20 UTC | Merge pull request #121 from tfoleyNV/gaussian-blur-fixes Gaussian blur fixes | 18 July 2017, 22:26:20 UTC |
a010145 | Tim Foley | 18 July 2017, 22:22:20 UTC | Merge pull request #120 from tfoleyNV/compile-time-loop Add a compile-time loop construct to Slang | 18 July 2017, 22:22:20 UTC |
4d6da3a | Tim Foley | 18 July 2017, 22:21:04 UTC | Swizzle result of buffer load based on element type When lowering `buf[i]` to `texelFetch(..., i)` we need to deal with the case where the type of `b` might be `Buffer<float>` in which case we want to add a `.x` swizzle to the end of the fetch. | 18 July 2017, 22:21:04 UTC |
b2b46a9 | Tim Foley | 18 July 2017, 22:13:44 UTC | Add basic GLSL lowering buffer `Buffer` loads - This isn't going to work for writable buffers, and certainly not for writes - As it exists right now, this shows a flaw in how I'm handling texture-type results on fetches | 18 July 2017, 22:13:44 UTC |
2476c03 | Tim Foley | 18 July 2017, 21:51:12 UTC | Add a compile-time loop construct to Slang The basic syntax is: $for(i in Range(0,99)) { /* stuff goes here */ } Note that the exact form is very restrictive. All that you are allowed to change is `i`, `0`, `99` or `/* stuff goes here */`. As a tiny bit of syntax sugar, the following should work: $for(i in Range(99)) { /* stuff goes here */ } Note that the range given is half-open (C++ iterator `[begin,end)` style). Both the beginning and end of the range must be compile-time constant expressions that Slang knows how to constant-fold. The implementation will basically generate code for `/* stuff goes here */` N times, once for each value in the half-open range. Each time, the variable `i` will be replaced with a different compile-time-constant expression. While I was working on a test case for this, I also found that our build of glslang had an issue with resource limits, so I fixed that. Clients will need to build a new glslang to use the fix. | 18 July 2017, 21:51:12 UTC |
3d313d9 | Tim Foley | 18 July 2017, 20:32:56 UTC | Merge pull request #118 from tfoleyNV/falcor-shadow-fixes Falcor shadow fixes | 18 July 2017, 20:32:56 UTC |
1c022e2 | Tim Foley | 18 July 2017, 14:49:33 UTC | Support scalarization of varying input/output for GLSL GLSL technically supports varying (`in`, `out`) parameters of `struct` type, but there are some annoying constraints (not allowed for VS input), and it doesn't work with how an HLSL user would usually put "system-value" inputs/outputs into a `struct` together with ordinary inputs/outputs. To work around this, this change adds support for using an imported Slang `struct` type for an `in` or `out` parameter, in which case it will (1) be scalarized and (2) will have system-value semantics mapped appropriately, just as for an entry-point parameter when cross-compiling an HLSL-style `main()`. Changes: - Add a notion of a `VaryingTupleExpr` and `VaryingTupleVarDecl`, similar to those for the resources-in-structs case - Trigger use of these when we have a global-scope varying in/out using an imported `struct` type - Also use these in the cross-compilation case for ordinary varying input/output (since this approach seems like it should be more general, and can hopefully handle stuff like GS input/output some day) - When generating parameter binding information, special case global-scope input/output, and treat it the same as entry-point-parameter input/output - Revamp how used resource ranges are computed so that we can eventually make this specific to an entry point - Actually implement first signs of life for `maybeMoveTemp` so that assignments to the tuple-ified outputs will work better - Add first test case that actually seems to work - Add diagnostics for conflicting explicit bindings on a parameter - Add diagnostic for different parameters with overlapping bindings - Make global-scope varying input/output use a tracking data structure specific to the translation unit for computing locations (so that they are independent of other TUs) | 18 July 2017, 19:58:48 UTC |
361e295 | Tim Foley | 18 July 2017, 03:08:31 UTC | Map HLSL `GatherRed` to GLSL `textureGather`, etc. This is a straightforward mapping given the infrastructure already in place. | 18 July 2017, 19:58:47 UTC |
f04bf3c | Tim Foley | 18 July 2017, 02:37:24 UTC | Don't allow varying parameters to be merged in reflection data All varying input/output parameters need to be specified to the entry point that declared them. In the case of HLSL/Slang this happens for free, but in the case of GLSL we need to be careful not to merge global-scope `in` or `out` parameters in ways that don't make sense. | 18 July 2017, 19:58:47 UTC |
ac310e2 | Tim Foley | 18 July 2017, 00:30:02 UTC | Merge pull request #114 from tfoleyNV/csm-shadow-sampler-fix Make sure to treat imported modules as Slang | 18 July 2017, 00:30:02 UTC |
ac2d419 | Tim Foley | 17 July 2017, 23:42:32 UTC | Make sure to treat imported modules as Slang - When generating parameter binding/reflection info, treated imported modules as Slang code, instead of the source language of the outer translation unit - This fixes an issue where global-scope shader parameters in a `.slang` file were getting ignored for binding-generation purposes when imported by a GLSL file | 17 July 2017, 23:42:32 UTC |
400e347 | Tim Foley | 17 July 2017, 23:37:34 UTC | Merge pull request #112 from tfoleyNV/gh-94 Handle `Buffer` types more like textures | 17 July 2017, 23:37:34 UTC |
ff46214 | Tim Foley | 17 July 2017, 22:13:37 UTC | Handle `Buffer` types more like textures Fixes #94 We'd been handling HLSL `Buffer` and `RWBuffer` in a one-off fashion, and that led to a lot of code duplication, and also to the issue that we weren't handling `RasterizerOrderedBuffer` at all. This change basically folds `Buffer` in so that it is conceptually a texture type (just with a unique shape). Hopefully all the other logic still works. | 17 July 2017, 22:13:37 UTC |
0059ccb | Tim Foley | 17 July 2017, 20:43:58 UTC | Merge pull request #111 from tfoleyNV/falcor-shadows-fixes Falcor shadows fixes | 17 July 2017, 20:43:58 UTC |
453a9ca | Tim Foley | 17 July 2017, 20:32:20 UTC | 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). | 17 July 2017, 20:35:22 UTC |
77e3c3b | Tim Foley | 17 July 2017, 19:03:05 UTC | Map HLSL `SampleGrad` to GLSL `textureGrad[Offset]` - This was an easy case, as far as these things go. | 17 July 2017, 20:35:22 UTC |
fcf0072 | Tim Foley | 17 July 2017, 18:54:58 UTC | Add hacky GLSL lowering for `GetDimensions` This is hacky for two big reasons: 1. It uses "operator comma" in the output to deal with calling multiple functions in an expression context 2. The way I'm lowering things to GLSL ends up using certain function arguments more than once, which means they get emitted as GLSL more than once, which means their *side effects* get evaluated more than once. Please don't put an expression with side effects in as an argument to `GetDimensions` when cross-compiling. Solving these issues requires the translation of builtins to be more directly handled as part of lowering, rather than a purely textual operation done during emission. I don't have time to fix that right now. | 17 July 2017, 20:35:22 UTC |
5d5aca4 | Tim Foley | 17 July 2017, 18:37:29 UTC | Improve handling of `SampleCmpLevelZero` - We map `SampleCmpLevelZero` to either `textureLod` or `textureGrad` based on what the GLSL spec seems to allow - We map `SamplerComparisonState` to `samplerShadow` (instead of just `sampler`) | 17 July 2017, 20:35:22 UTC |
6f239b0 | Tim Foley | 17 July 2017, 18:01:27 UTC | Map HLSL `linear` to GLSL... nothing The behavior of the `linear` modifier should be the default interpolation behavior in GLSL. | 17 July 2017, 20:35:22 UTC |
b4977c1 | Tim Foley | 17 July 2017, 18:53:56 UTC | Merge pull request #110 from tfoleyNV/gl-layer-pick-version Pick correct GLSL version when `gl_Layer` used | 17 July 2017, 18:53:56 UTC |
dc0e9d7 | Tim Foley | 17 July 2017, 17:51:18 UTC | Pick correct GLSL version when `gl_Layer` used `gl_Layer` as a fragment input requires at least version 4.30 of GLSL, so we try to track that information when we see the name used. Note that this does *not* override a user-specified `#version` line. This required re-ordering when lowering happens relative to emitting the `#version` directive, since this code works by actually modifying the chosen profile for the entry point. Yes, that is kind of gross and we should do something cleaner in the long term. | 17 July 2017, 17:54:05 UTC |
0b4992f | Tim Foley | 17 July 2017, 17:27:52 UTC | Merge pull request #108 from tfoleyNV/gh-105 Don't crash-fail on errors in entry point parameters | 17 July 2017, 17:27:52 UTC |
c69060a | Tim Foley | 17 July 2017, 17:08:22 UTC | Merge pull request #107 from tfoleyNV/glsl-matrix-mult-bug Add explicit operator overloads for scalar/matrix cases | 17 July 2017, 17:08:22 UTC |
782e6f0 | Tim Foley | 17 July 2017, 16:49:32 UTC | Add emit logic for generic app expressions Work on #105 These can occur in unchecked code (or code that had a semantic error), so we need to be able to handle them. | 17 July 2017, 16:49:32 UTC |
f23738e | Tim Foley | 17 July 2017, 16:48:45 UTC | Fix AST node type for `TriangleStream` - This was being mapped to `HLSLLineStreamType` because of a copy-paste typo | 17 July 2017, 16:48:45 UTC |
fbae51f | Tim Foley | 17 July 2017, 16:47:23 UTC | Skip unknown types during parameter-binding/-reflection step Work on #105 If a semantic error occurs in the type of an entry-point parameter, we need to be able to skip over it when doing parameter binding and reflection-generation work. | 17 July 2017, 16:47:23 UTC |
f881f52 | Tim Foley | 17 July 2017, 16:26:53 UTC | Add explicit operator overloads for scalar/matrix cases Fixes #103 - Previously I was relying on scalar-to-vector promotion to pick the right type in these cases, but I hadn't implemented scalar-to-matrix promotion (I should...) - Rather than relying on promotion behavior, this change goes ahead and adds explicit overloads. I think this is probably a better decision in the long term, since one might want to support these cases for operators, while warning (or erroring) on the more general cases of implicit conversion. - This covers matrix/scalar, scalar/matrix, vector/scalar, and scalar/vector cases | 17 July 2017, 16:30:24 UTC |
fdab35e | Tim Foley | 17 July 2017, 16:27:34 UTC | Merge pull request #106 from tfoleyNV/varying-integer Handle `flat` interpolation cases in cross compilation | 17 July 2017, 16:27:34 UTC |
15aba2f | Tim Foley | 17 July 2017, 15:58:47 UTC | Handle `flat` interpolation cases in cross compilation Fixes #104 - Map HLSL `nointerpolation` to GLSL `flat` - When lowering a `struct` type varying input/output, look for interpolation modifiers along the "chain" from the leaf field up to the original shader input variable (and take the first one found) - Not sure if this is strictly needed, but it seems like a reasonable policy - Add `flat` to varying input of integer type, with no other interpolation modifier - Note: I do *not* do anything to ignore a manually imposed interpolation modifier that might be incorrect | 17 July 2017, 15:58:47 UTC |
eecb6c5 | Tim Foley | 15 July 2017, 00:15:51 UTC | Merge pull request #92 from tfoleyNV/glsl-thread-group-size Add reflection support for GLSL thread-group-size modifier | 15 July 2017, 00:15:51 UTC |
66bae40 | Tim Foley | 14 July 2017, 21:38:13 UTC | Add reflection support for GLSL thread-group-size modifier Fixes #15 These are the modifiers like: layout(local_size_x = 16) in; Unlike the HLSL case, these don't get attache to the entry point function itself, so there is a bit more work involed in looking them up. Just to make sure I didn't mess up the HLSL case, I went ahead and added two tests for this capability: one for GLSL and one for HLSL. | 14 July 2017, 21:42:51 UTC |
ffa7f2a | Tim Foley | 14 July 2017, 19:07:45 UTC | Merge pull request #90 from tfoleyNV/cbuffer-field-layout-fix Adjust type layout when parameter block constains member using the sa… | 14 July 2017, 19:07:45 UTC |
f4ac13d | Tim Foley | 14 July 2017, 19:00:29 UTC | Adjust type layout when parameter block constains member using the same resource If we have something like to following in HLSL: cbuffer C { Texture2D t; ... } and we are compiling to GLSL, then both `C` and `C.t` consume the same kind of resource (a descriptor-table slot). The way reflection was working right now, querying the index of `C` would return its binding (let's say it is `4` just to be concrete) and then a query on `C::t` would give its offset, which was being computed as `0` because it is the first field in the logical `struct` type. That obviously leads to bad math and requires some subtle `+1`s in cases to get things right (e.g., when scalaring during lowering, I had to carefully add one in some cases). It is unreasonable to expect users to deal with this. This commit changes it so that the offset of field `C::t` is `1` so that hopefully more things Just Work. The special-case logic in lowering is now gone. One important catch here is that this pretty much only works in the case where the element type of a parameter block is a `struct` type (which is really all that makes sense right now). If we ever want to generalize this in the future, then it will probably be necessary to change the `TypeLayout` case for parameter blocks to store a `VarLayout` for the element, rather than just a `TypeLayout`. | 14 July 2017, 19:00:29 UTC |
d9366db | Tim Foley | 14 July 2017, 18:31:23 UTC | Merge pull request #89 from tfoleyNV/glpervertex-location-fix Don't use "auto locations" mode in glslang | 14 July 2017, 18:31:23 UTC |
2bf8774 | Tim Foley | 14 July 2017, 17:44:42 UTC | Don't assign a `binding` to a `push_constant` buffer Fixes #12 - This was a latent issue, but the previous commit brought it to the front. - As indicated in #12, I don't allocate a descriptor-table slot to the block - Instead I allocate a `PushConstantBuffer` - Unlike what #12 asks for, I don't use a different resource type for the contents of the block - Pretty much all the logic is easiest if these continue to be just plain `Uniform` data | 14 July 2017, 18:09:10 UTC |
082003a | Tim Foley | 14 July 2017, 17:05:38 UTC | Don't use "auto locations" mode in glslang Fixes #88 The code was using `glslang::TShader::setAutoMapLocations` as a workaround for an old glslang issue, but apparently this mode has a bug where it ends up applying a `location` layout to the implicitly-created `gl_PerVertex` definition (which shouldn't be allowed). This change drops the call to `setAutoMapLocations` (and `setAutoMapBindings`) since it should no longer be required. | 14 July 2017, 17:05:38 UTC |
47e94a1 | Tim Foley | 13 July 2017, 20:24:56 UTC | Merge pull request #87 from tfoleyNV/debug-dump Add support for dumping intermediates for debugging. | 13 July 2017, 20:24:56 UTC |
6d7be36 | Tim Foley | 13 July 2017, 19:10:08 UTC | Add support for dumping intermediates for debugging. Calling: spSetDumpIntermedites(compileRequest, true); will set up a mode where Slang tries to dump every intermediate HLSL, GLSL, DXBC, SPIR-V, etc. file it generates. If SPIR-V or DXBC is requested then we also dump assembly of those. Right now the files are all named as `slang-<counter>.<ext>`, and get dropped in whatever the working directory is, but I'm open to ideas on how to improve that. Note: this change introduces a new binary interface to `glslang`, so pulling it requires an updated `glslang.dll`. | 13 July 2017, 20:00:38 UTC |
4bc59f8 | Tim Foley | 13 July 2017, 17:31:09 UTC | Merge pull request #86 from tfoleyNV/resource-array-layout-fix An array of resources in Vulkan only consumes one binding | 13 July 2017, 17:31:09 UTC |
c963b44 | Tim Foley | 13 July 2017, 16:54:47 UTC | Merge pull request #85 from tfoleyNV/working Various bug fixes | 13 July 2017, 16:54:47 UTC |
bb8ebb4 | Tim Foley | 13 July 2017, 16:50:27 UTC | An array of resources in Vulkan only consumes one binding Fixes #84 - When computing resource usage for an array type, don't multiply the resource usage of the element type by the element count foor descriptor-table-slot resources. - When reporting the "stride" of an array type through reflection, report the stride for descriptor table slots as zero, always. | 13 July 2017, 16:52:19 UTC |
c51fd4e | Tim Foley | 13 July 2017, 16:33:07 UTC | Add several missing GLSL qualifiers Fixes #81 - This is based on a san over the GLSL spec (but is probably not exhaustive) - There are some qualifiers that are currently being handled by general-case code for all languages, and some of these happen to cover GLSL qualifiers too - Some of the qualifiers being handled by the general-case mechanism are *accidentally* working for GLSL (e.g., the HLSL `shared` qualifier doesn't mean the same thing as GLSL `shared`, but as long as we spit it back out nobody seems to care). - This should be fixed sooner or later. | 13 July 2017, 16:35:20 UTC |
6da80f5 | Tim Foley | 13 July 2017, 16:12:50 UTC | Allow GLSL `#version` to be selected based on profile Fixes #83 - The basic idea is that I added a bunch of more specific profile names line `glsl_vertex_430` which indicate the desired GLSL version the user wants. - An explicit `#version` line in the code always overrides one specified by profile, though | 13 July 2017, 16:17:27 UTC |
72a3e97 | Tim Foley | 13 July 2017, 15:36:47 UTC | Allow `spGetEntryPointCode` to return text results too Fixes #77 - The `spGetEntryPointSource` function is now no longer needed, but I'm not going to "deprecate" it just yet | 13 July 2017, 15:36:47 UTC |
f48035f | Tim Foley | 13 July 2017, 15:31:18 UTC | Don't emit C-style `#line` directives when directly generating GLSL - This fixes the render tests, which aren't tested by the continuous integration setup - This was broken in the commit that decided to use C-style directives all the time. - This works for stuff that eventually passes through glslang (or at least our build of it) - It *doensn't* work if we take the GLSL and pass it off to an OpenGL driver (which is what I do for testing) - A longer-term fix is still required to deal with line directives properly | 13 July 2017, 15:31:18 UTC |
c2fca57 | Tim Foley | 13 July 2017, 15:25:38 UTC | Update version of `glslang` in submodule | 13 July 2017, 15:25:38 UTC |
9058358 | Tim Foley | 12 July 2017, 21:52:21 UTC | Merge pull request #80 from tfoleyNV/falcor-work Fixes for shader cross-compilation | 12 July 2017, 21:52:21 UTC |
02f77bb | Tim Foley | 12 July 2017, 21:21:52 UTC | Add ability for intrinsics to require GLSL extensions When cross-compiling, we need to detect when an intrinsic is used that required non-default GLSL capabilities and emit an appropriate `#extension ... : require` line. I'm handling this by attaching a custom modifier to declarations that require an extension in order to be callable. | 12 July 2017, 21:21:52 UTC |
d43ee03 | Tim Foley | 12 July 2017, 20:48:20 UTC | Don't report error on assigning to an erroneous expression An expression with error type may still fail the l-value check, but we don't want to emit an error in that case. | 12 July 2017, 20:48:20 UTC |
aca34e7 | Tim Foley | 12 July 2017, 20:40:30 UTC | Don't emit interpolation modifiers on struct fields when outputting GLSL HLSL (and thus Slang) commonly puts interpolation modifiers like `sample` on the fields of `struct` types used as stage input/output, while GLSL only allows them on global-scope `in` and `out` variables (or ones in blocks). This change emits a really hacky filtering step to skip over certain modifiers when emitting a declaration. This lets us skip interpolation-mode modifiers when outputting a struct field to GLSL. Note: this probably gets the `in` or `out` block case wrong... | 12 July 2017, 20:40:30 UTC |
b65861f | Tim Foley | 12 July 2017, 20:32:24 UTC | Use C-style line directives, even for GLSL - As long as we are always going to pass GLSL through glslang, there should be no harm in this - Eventually we may need to re-enable the old style | 12 July 2017, 20:32:24 UTC |
0174470 | Tim Foley | 12 July 2017, 20:26:53 UTC | Properly register error on downstream compiler failure - The old code was just doing `exit(1)` if glslang or `D3DCompile` failed, which is obviously unacceptable - The new approach adds the output to the diagnostic buffer (or invokes the callback), and tracks the error count just like any other errors | 12 July 2017, 20:26:53 UTC |
11f12cd | Tim Foley | 12 July 2017, 18:56:02 UTC | Add tuple lowering logic for assignment - When assigning tuples `(a0, ...) = (b0, ...)` generate a tuple of assignments `(a0 = b0, ...)` - Given an expression statement on a tuple `(a0, ...);` generate a sequence of statements `a0; ...` | 12 July 2017, 18:56:02 UTC |
6101e48 | Tim Foley | 12 July 2017, 18:30:43 UTC | Merge pull request #79 from tfoleyNV/sample-rate-reflection Sample rate reflection | 12 July 2017, 18:30:43 UTC |
7496346 | Tim Foley | 12 July 2017, 18:07:45 UTC | Add basic reflection query for checking if entry point is "sample-rate" - This really just checks two basic things: 1. Was there any global variable declared with `in` and `sample`? 2. Did any code encountered during lowering referenece `gl_SampleIndex`? - This doesn't cover what HLSL could need, nor what we would need for cross-compilation. Consider it GLSL-specific for now. - In order to generate the information with even a reasonable chance of being accurate (not giving a ton of false positives) I tried to integrate the checks into the lowering process (so they only see code that is referenced, one hopes). - For this to work with my testing setup, I needed to make sure that lowering is always performed, prior to emitting reflection info - This change broke several reflection tests, because they had been using code that wouldn't actually pass the downstream compiler. I checked in fixes for those. | 12 July 2017, 18:07:45 UTC |
2c6c501 | Tim Foley | 12 July 2017, 17:18:11 UTC | Add per-entry-point information to reflection JSON dumps - This also adds reflection API for querying: - Entry point name - Entry point parameter list | 12 July 2017, 17:18:11 UTC |
88f451c | Tim Foley | 12 July 2017, 00:47:58 UTC | Merge pull request #76 from tfoleyNV/gh-75 Make parser recovering more robust to avoid infinite loops | 12 July 2017, 00:47:58 UTC |
24a44ff | Tim Foley | 11 July 2017, 22:43:18 UTC | Make parser recovering more robust to avoid infinite loops Fixes #75 In order to avoid cascaded errors, I went ahead and made the parser refuse to skip past a `}` in recovery mode. The problem with this is that we fail to make forward progress if we are stuck on a `}` (this happens if you have an extra `}` at the global scope. | 11 July 2017, 22:43:18 UTC |
d8d8fef | Tim Foley | 11 July 2017, 22:10:24 UTC | Merge pull request #74 from tfoleyNV/resources-in-structs Resources in structs | 11 July 2017, 22:10:24 UTC |
5d06d42 | Tim Foley | 11 July 2017, 21:46:12 UTC | Bug fixes for resources-in-structs. | 11 July 2017, 21:46:48 UTC |
88ccba1 | Tim Foley | 11 July 2017, 20:08:42 UTC | Add GLSL lowerings for `ddx*` and `ddy*` | 11 July 2017, 21:46:48 UTC |
20aac94 | Tim Foley | 11 July 2017, 19:33:15 UTC | Bug fix for lowering of tuple types without layout. - Don't try to extract the body layout for a field without a layout | 11 July 2017, 21:46:48 UTC |
fa48d2d | Tim Foley | 11 July 2017, 20:04:58 UTC | Merge pull request #73 from tfoleyNV/image-type-reflection Improve reporting of GLSL `image*` types | 11 July 2017, 20:04:58 UTC |
a60dd57 | Tim Foley | 11 July 2017, 19:41:05 UTC | Merge pull request #72 from tfoleyNV/resources-in-structs Resources in structs | 11 July 2017, 19:41:05 UTC |
0cd5602 | Tim Foley | 11 July 2017, 19:18:13 UTC | Improve reporting of GLSL `image*` types - Update stdlib so taht `image*` types have read-write access encoded in their type - TODO: this isn't 100% right, since there are GLSL qualifiers that might override this - Add a test case to verify that the reflection API reports `image*` parameters | 11 July 2017, 19:18:13 UTC |
bd7105f | Tim Foley | 10 July 2017, 22:40:42 UTC | Initial work on handling resources in structs during cross-compilation - The basic idea is that during the "lowering" pass, some types (notably: aggregate types that contain resource variables) will get turned into "tuple" types, which are pseduo-types that aren't meant to survive lowering. - An attempt to declare a variable with a tuple type expands into a tuple of declarations - An attempt to reference such a tuple-ified variable leads to a tuple of expressions - An attempt to extract a member from such a tuple expression will pick the appropriate sub-element - Dereference a tuple by dereferencing the primary expression - Expand a tuple in the argument list to a call into N arguments (by recursively flattening the tuple) - Don't create tuple types when not generating GLSL - Make sure to preserve the specialized type of a call expression through lowering, since emission of unchecked calls relies on that info. - TODO: maybe the infix/prefix/postifx/select information should come in as a side-band? Should we have modifiers on expressions? - Make sure to offset the layout for a nested field based on teh base offset of its parent variable, when generating declarations for nested fields | 11 July 2017, 19:07:09 UTC |
6723329 | Tim Foley | 11 July 2017, 18:06:58 UTC | Fixup for binary/string output. Actually output SPIR-V/DXBC assembly as text, instead of binary. This fixes a bunch of tests that were passing on accident, because nothing was producing output. | 11 July 2017, 19:07:09 UTC |
98b3e5b | Tim Foley | 11 July 2017, 16:57:13 UTC | Merge pull request #70 from tfoleyNV/support-more-sv-semantics Support more sv semantics | 11 July 2017, 16:57:13 UTC |
1b6af03 | Tim Foley | 10 July 2017, 19:17:36 UTC | Add GLSL translations for many `SV_*` semantics I haven't tried to be 100% exhaustie, but this should cover the main cases we are likely to encounter in library code. | 11 July 2017, 16:38:28 UTC |
d86748d | Tim Foley | 10 July 2017, 18:31:16 UTC | Don't emitting an imported declaration unless it is used. This helps avoid the problem where we emit a function that does a `discard` and thus get a GLSL compilation failure in a vertex shader (that doesn't even call the function). | 11 July 2017, 16:38:28 UTC |
7d2c2f1 | Tim Foley | 10 July 2017, 18:19:00 UTC | Update `.gitignore` to deal with render-test output The rule of thumb so far is that expected output for `.slang` files should be checked in, but not for `.hlsl` or `.glsl`. The render test breaks that rule, because we never want to check in the expected output. | 11 July 2017, 16:38:28 UTC |
a923aff | Tim Foley | 11 July 2017, 02:45:21 UTC | Merge pull request #67 from kyaoNV/spirv SPIR-V Support | 11 July 2017, 02:45:21 UTC |
22c7a4d | Kai-Hwa Yao | 11 July 2017, 00:44:14 UTC | Removed spGetTranslationUnitCode; Unified EntryPointResult/TranslationUnitResult, added helper functionality; Ensure null termination when printing raw data | 11 July 2017, 00:54:50 UTC |
61a816c | Kai-Hwa Yao | 10 July 2017, 21:11:26 UTC | Don't assume vector contains contents | 11 July 2017, 00:49:35 UTC |
7c0ebee | Kai-Hwa Yao | 10 July 2017, 20:50:16 UTC | Refactored compile output to work with raw data instead of Strings | 11 July 2017, 00:49:35 UTC |
4bb88c4 | Kai-Hwa Yao | 10 July 2017, 05:58:41 UTC | Allow glslang wrapper to output regular SPIRV before disassembly | 11 July 2017, 00:49:35 UTC |
5577e2d | Tim Foley | 10 July 2017, 22:06:14 UTC | Merge pull request #69 from tfoleyNV/falcor-fixes Handle function name properly for unchecked call | 10 July 2017, 22:06:14 UTC |
f8c6905 | Tim Foley | 10 July 2017, 22:02:47 UTC | Handle function name properly for unchecked call The emit logic was checking for a missing decl, and then asking that same (missing) declaration for its name. | 10 July 2017, 22:02:47 UTC |