Closed Lex-DRL closed 7 years ago
Hi @Lex-DR!
Are there any plans to continue developing it in the nearest future?
Yes - if you look in the master branch, you'll see lots of ShaderLab-related activity in the last few days and weeks. I've also been posting some screenshots on Twitter:
However, there's still more to do before ShaderLab support is fully baked, so in the meantime:
shadertoolsconfig.json
feature to specify an additionai #include
path to a folder of Unity's built-in cginc files (i.e. C:\Program Files\Unity\Editor\Data\CGIncludes
)shadertoolsconfig.json
file in your project root folder, with an "hlsl.additionalIncludeDirectories"
entry of "."
, it will resolve .cginc
files relative to the project root..cginc
files, you should get support for fixed
etc. (I think they're typedef
d or #define
d somewhere in those files)__INTELLISENSE__
macro.Hopefully that helps. And keeps you going until full ShaderLab support arrives 😄
Hey @tgjones! Thanks for the response, great news!
Preprocessor directives are already supported - what behaviour are you seeing / not seeing?
Autocompletion doesn't work. No suggestions appear, even if I have a macro/keyword defined a few lines above. Even compiler directives themselves are not completed. (ifdef, undef, define etc.):
I tried Ctrl+Space, too. It works fine (with no hotkey) in other parts of code, but not with compiler directives.
If you place a shadertoolsconfig.json file in your project root folder, with an "hlsl.additionalIncludeDirectories" entry of ".", it will resolve .cginc files relative to the project root.
Unfortunately, it doesn't. :disappointed:
I put shadertoolsconfig.json
with the following code to my root project folder:
{
"hlsl.additionalIncludeDirectories": [
"." // Directory containing this config file
]
}
And the file I'm including do exist on the disk:
And shader works perfectly fine in the Unity itself (no compile errors/warnings).
But HLSLtools can't find this cginc:
However, Unity's built-in CGINC folder is detected properly when I add shadertoolsconfig.json
which point to it's absolute path:
{
"hlsl.additionalIncludeDirectories": [
"C:\\1-CG\\Unity\\5.6.1f1\\Editor\\Data\\CGIncludes"
]
}
Finally, do you have a semi-stable (beta?) release for the version of HLSLTools with Unity support? Even partial support of ShaderLab stuff would be great (Pass/Subshader/CGPROGRAM blocks). I couldn't find it anywhere: not here, nor at the VS marketplace. And I have no experience developing VS extentions, so I'm not even sure if I can build it myself from sources. "Build your first extension" tutorial page tells in the prerequisites block that I need a Visual Studio Team Services account, among with plenty of other stuff. But I don't seem to have one, I'm using a Community edition of VS.
P.S.: I've always been using Notepad++ for shader development, because formerly the only thing any VS extention was adding is just a syntax highlight. With no completion/IntelliSense. So no benefit over N++, but VS loads extremely longer. However your extention changes the game entirely. Great job, already. :+1:
I'm going to create a training course about unity shader programming in the nearest future. And it'd be awesome if there will be at least somewhat-working release of Unity-HLSLTools, so I could show the process in VS instead of N++. No pressure, just explaining why I'm so impatient/excited about your ext :wink:
Macro names: I've logged this as #93. Macros are parsed correctly (AFAIK), so you shouldn't get any syntax errors, but you're right that there's no IntelliSense for them either. (Actually that's not true, you do get Quick Info hover tooltips, but not automatic completion.)
Include file paths: It turns out that you can't actually put comments in shadertoolsconfig.json
files, so my example in the readme was wrong (I've updated it). If you remove the // Directory...
comment, it should work.
Beta: No, ShaderLab support is not yet in the nightly build (i.e. the one here on vsixgallery.com). This is beacuse it's still missing very basic functionality, specifically correctly updating the parent ShaderLab text buffer and nested HLSL buffers, when the contents change. This is a basic requirement, but actually really hard - probably the hardest challenge in all the work to support ShaderLab, just because the underlying Visual Studio APIs are both quite advanced and poorly documented. I'm getting close to tackling that problem, but until that's done, I won't enable ShaderLab in nightly builds. (The screenshot above cheated a little: ShaderLab support is pretty good already, as long as you don't actually, err, type anything.) For the same reason, it wouldn't help to build it from GitHub source yourself, because it's not at all usable yet.
I don't want to give an estimate on when the first nightly build with ShaderLab support will be ready, because I've done that before on other open source projects and been wildly wrong. But it is what I'm working on most evenings (after my little one goes to bed, so "evening" is a bit of an exaggeration). I'm going to get it finished as soon as I can.
Ok, then I'm looking forward to the stable release with Unity support.
After I removed the comment from shadertoolsconfig.json
file, it indeed started to work. Yaay! :smile: It's already amazing.
Thanks for all your help and being so responsive.
P.S.: after all my cgincs started to work, I've found one extra area of improvement: #94 . It's totally minor, so my duty is just to request it, and it's up to you to decide whether it worth implementing or not. Thanks again :+1:
Thanks, #94 would be a nice enhancement.
I'm going to close this issue: ShaderLab support is in progress, but it's not really necessary to track such a large feature with a single issue like this one.
Hi guys, Is there a setting to make this extension work with .shader files or is that only available in the Unity branch? Thanks
Hi guys, Is there a setting to make this extension work with .shader files or is that only available in the Unity branch? Thanks
Yeah... I agree - I installed it, hoping to be able to get auto-completion for .shader files... but nothing happens and my guess is that it doesn't recognize the .shader extension?
The last commit in "unity" banch was almost a year ago, with no stable release yet. Are there any plans to continue developing it in the nearest future?
If not, is there any workaround to avoid the most crucial errors at least in the CG part of Unity shaders with the current stable version of HLSL tools? By errors I mean a lack of:
The whole ShaderLab part is not as important. After all, you can extract the entire CG code to the external cginc file, if you don't want to see errors. But inability to include cgincs and the lack of support for internal types devalues all the benefits of this amazing extention for Unity-shader development :disappointed_relieved: .