files extension for HLSL files

Feb 24, 2011 at 10:13 PM

Is it possible to add a new file extension for HLSL files?

I love this addin but at this point I am needing to use *.fx10 file extensions for my shaders.

Hoping this is an easy option to add :)

Cheers

Coordinator
Feb 24, 2011 at 10:21 PM

You can add it yourself with a new registry key (9.0 for VS2008, 10.0 for VS2010)

 

Under 32bits : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\File Extensions
Under 64bits : HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Languages\File Extensions
 
Check for an existing .fx extension and copy the same entry (with subkeys) to your new extension.
Feb 25, 2011 at 3:29 AM

Thank you for this.

 

Worked like a charm.

Feb 28, 2011 at 6:59 PM

I work with Unity3D shaders. They have .shader extension.

>Check for an existing .fx extension and copy

I have Visual Studio 2010 and Windows 7 x64. I checked HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\File Extensions  but there's no .fx extension there, neither .cg or other shader extentions. However if I rename my .shader file into .cg, the plugin works.

Coordinator
Feb 28, 2011 at 7:44 PM
Edited Oct 5, 2011 at 9:53 PM

Sorry, It was changed with VS2010. Go to HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\10.0_Config\Languages\File Extensions

Mar 1, 2011 at 3:21 PM
Edited Mar 1, 2011 at 3:40 PM

There's nothing there:

Piccy.info - Free Image Hosting

PS
Found it in HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config_4120\Languages\File Extensions
Don't know what 4120 means.

 

PPS
Funny thing:
When I start Visual Studio, HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config_NNNN appears, where NNNN is a random four-digit number. And I can't make any changes there in spite of the fact that I have all possible rights to do it. When I close VS, the key just disappears.

Coordinator
Mar 1, 2011 at 4:05 PM

Weird, You gonna have to resolve this yourself, as I'm not able to reproduce this kind of registry layout!

Could you look for the value {479b8c71-c9de-3669-869d-ae1d91602d7c} (it's the nshader package used inside file extensions) inside the whole registry and find where it is used in any Microsoft\VisualStudio\*\Languages\File Extensions\.*

Mar 4, 2011 at 2:06 PM

I checked the registry for {479b8c71-c9de-3669-869d-ae1d91602d7c} and among the file extensions I only found it in the keys for .cg, .cgfx, .fp, .frag, .geom, .psh, .vert, .vp and .vsh.

The keys for .fx, .fxh, .glsl and .hlsl (and maybe some others I didn't check) contained {b2f072b0-abc1-11d0-9d62-00c04fd9dfd9} instead. When i tried to change it to {479b8c71-c9de-3669-869d-ae1d91602d7c} it reverted back to {b2f072b0-abc1-11d0-9d62-00c04fd9dfd9} once i had started Visual Studio 2010.

Coordinator
Mar 20, 2011 at 5:07 PM

I forgot to respond to this issue, sorry.

The key b2f072b0-abc1-11d0-9d62-00c04fd9dfd9 is the default key for VS2010 C++ files, so I don't know why your setup is overriding NShader default associations... As I'm unable to reproduce this, you have to diagnostic this yourself.

Anyway, as I said, to uninstall NShader, you have to run VS2010 in administrator mode. Maybe try to reinstall it and check where registry keys are written...

Apr 14, 2011 at 5:25 AM

I'm having the same issue.  Manually editing the registry key gets reset when I load VS2010.

May 2, 2011 at 9:32 PM
Edited May 2, 2011 at 9:42 PM

Same problem for me...

 

but it seems that I found a workaround:

I only tested it for a Windows7 64 bit machine and VS 10.0!

Go to :   HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Languages\File Extensions

Ad a new key named ".shader" and set its value to {479b8c71-c9de-3669-869d-ae1d91602d7c}.

Afterwards your .shader files should be highlighted and this way it does not get reverted each time you start VS.

Coordinator
May 2, 2011 at 9:39 PM

@NickDarnell and @MrRatherford: Could you verify that you don't have setup any editors for the particular extension you are trying to load? Go to Menu Tools/Options/Text Editor/File Extensions : You shouldn't have any shader extensions attached to an Editor. If you have an extension, you have to remote it.

May 5, 2011 at 1:47 PM

Yea,

I can confirm that the settings don't get reverted when using the following path for Win7 64bit, VS2010:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\File Extensions\

and adding a new subkey with the extension you want to highlight (e.g. ".shd") with a default key value of {479b8c71-c9de-3669-869d-ae1d91602d7c} (this is the CLSID for NShader v1.2, other versions need other CLSIDs!!).

MrRatherfords workaround seems strange, as his path obviously points to Visual Studio 9.0, aka VS 2008, though he said he tested it on 10.0. My solution (having the correct VS2010 = 10.0 reference in the path) was successfully tested on .shd files, as Humus uses them.

The important thing to note here are

  • HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER as suggested earlier on; the newly created key under HKEY_CURRENT_USER was vanishing for me as well after each VS restart.

Coordinator
May 5, 2011 at 7:47 PM

I didn't realize that in the meantime, I erroneously advised to switch from HKEY_LOCAL_MACHINE to HKEY_USER_MACHINE, but It must remain to HKEY_LOCAL_MACHINE of course, thanks for pointing that ChaosCom!

Jun 17, 2011 at 2:37 PM

I have the same problem as above: I have a .fx entry in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\File Extensions which is overwritten with the default Visual Studio 2010 ID at launch. I don't have anything in Menu Tools/Options/Text Editor/File Extensions, however I do have a cagetory under Text Editor called Shader Language. I don't see any way to override. I have the following additional software installed, which may be responsible:

DirectX11 (June 2010) SDK

NVIDIA CUDA Toolkit v3.2 and v4.0

NVIDIA Parallel Nsight 2.0

Coordinator
Jun 17, 2011 at 3:17 PM

I have the same problem at work, Nsight is overwriting shader extensions. Unfortunately, I don't have any solution right now to overcome this problem. Though I will try to have a look.

Coordinator
Jun 22, 2011 at 7:44 AM

"Bug" of NSight overriding NShader configuration is fixed. You can try this by following instructions here.