Jump to content
  • Advertisement
Sign in to follow this  
B_old

HLSL syntax highlighting in Visual Studio 2005 Pro

This topic is 4128 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, there was a discussion about this a little while ago. And I am curious about the current state. Has anybody figured out how to enable it?

Share this post


Link to post
Share on other sites
Advertisement
As far as I know Microsoft has permanently removed syntax highlighting in HLSL. If I remember it was removed starting either August or October 2006 SDK. However NVIDIA FX composer has a much better development environment for developing and debugging shaders

Share this post


Link to post
Share on other sites
Quote:
Original post by Asesh
As far as I know Microsoft has permanently removed syntax highlighting in HLSL. If I remember it was removed starting either August or October 2006 SDK.

Why would they do such a thing?

Share this post


Link to post
Share on other sites
Here's how you can get syntax highlighting to work with any hlsl file extension that you use (.hlsl, .fx, .fxh, etc). Don't blame me if you screw up your registry!

Custom Syntax Highlighting


Here is what I did for Visual Studio 2005 (Professional Edition):

1. Open up the registry editor and go to the following location - HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\File Extensions
2. Copy the default value from the .cpp key.
3. Create a new key under the File Extensions with the name of .fx
4. Paste the value you just copied into the default value.
5. Restart Visual Studio and your shaders should now have syntax highlighting.
6. repeat steps 2-6 for the .fxh extension.

For Visual C++ Express Edition, follow the same steps. In step 2 use the following location:
HKLM\SOFTWARE\Microsoft\VCExpress\8.0\Languages\File Extensions


The method is based on this webpage, with minor changes:

http://community.livejournal.com/heos/3643.html

Share this post


Link to post
Share on other sites
Hmmm that sounds to me like you are just duplicated the syntax highlighting for c++ and using it with any hlsl. And if that is the case there is an easier way to do it -

In visual studio 2005
- go to Tools -> Options
- choose Text Editor -> File Extensions
- you can then identify any unknown file extensions that you are using (eg. .fx or .hlsl) and pick which syntax highlighting system you want them to use.

At the moment my .fx ones are mimicking the c++ syntax highlighting, which isn't perfect, but its something at least. If anyone does figure out the proper hlsl highlighting please let us know :)

Cheers.

Share this post


Link to post
Share on other sites
Quote:
Original post by GambitSnax
Hmmm that sounds to me like you are just duplicated the syntax highlighting for c++ and using it with any hlsl. And if that is the case there is an easier way to do it -

In visual studio 2005
- go to Tools -> Options
- choose Text Editor -> File Extensions
- you can then identify any unknown file extensions that you are using (eg. .fx or .hlsl) and pick which syntax highlighting system you want them to use.

At the moment my .fx ones are mimicking the c++ syntax highlighting, which isn't perfect, but its something at least. If anyone does figure out the proper hlsl highlighting please let us know :)

Cheers.

You have to download the CG Toolkit from the nVidia site.
Then in the folder \NVIDIA Corporation\Cg\msdev_syntax_highlighting\ its gonna be a file called usertype.dat then you will have to do this..

1. Copy the usertype.dat file to \Microsoft Visual Studio 8\Common7\IDE
2. Open up the registry editor and go to the following location - HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\File Extensions
3. Copy the default value from the .cpp key.
4. Create a new key under the File Extensions with the name of .cg
5. Paste the value you just copied into the default value.
6. Restart Visual Studio and your shaders should now have syntax highlighting.

and it will be all set.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!