Jump to content
  • Advertisement
Sign in to follow this  
ryan mccabe

hlsl files in visual stuido

This topic is 2600 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

I hate posting something so simple. but its so simple its been ridiculous searching for. im following http://www.rastertek.com/dx11tut04.html and at the start of this tutorial he moves onto hlsl. The first two files are .vs and .ps. A vertex shader and a pixel shader, ive got that. But how do I create those file types in a visual studio solution?

Im down to making dummy files in windows and importing them to my project. This seems really backwards though.

Share this post


Link to post
Share on other sites
Advertisement
uhm .. i do the same: new textfile, rename - there is no "real" support for hlsl files in visual studio. Be sure to check out NShader - its a nice syntax highlighting plugin for visual studo and makes working with shader files much more comfortable

Share this post


Link to post
Share on other sites
You can still create them in the IDE, since you can override the default file extension for a file type.

Juist go to the new item dialogue, pick somthing that doesnt do anything special (eg "Text File (.txt)" in "Visual C++" -> "Utility"), and in the "Name" text box enter a complete name, eg "myshader.ps".

Share this post


Link to post
Share on other sites
Ahh well, I thought since it was part of direct x that there would be support. Oh well. Thanks for confirming, and the tip about doing it inside VS.

Share this post


Link to post
Share on other sites

Ahh well, I thought since it was part of direct x that there would be support. Oh well.


What kind of "support" do you think it should have? What were you hoping it would do?

The file itself is nothing more or less than a text file.

If you have a system like XNA development tools installed those tools can incorporate it to the XNA build pipeline. Perhaps that is what you are expecting?

Share this post


Link to post
Share on other sites
To make a cpp file or winform file in a project you just click on it. I thought that it would include hlsl files in this way. It seems odd to have to rename a text file every time I want an hlsl file. Being that it is just a text file I can see the logic in the way its done. Further, I cant see why changing the vs and ps files in InitializeShader(device, hwnd, L"../Engine/color.vs", L"../Engine/color.ps") to InitializeShader(device, hwnd, L"../Engine/colorvs.txt", L"../Engine/colorps.txt") wouldn't work. So its really not a big issue, just a curiosity about work flow.

Edit: Im not using XNA. Just c++ and directx so far. I want to understand whats going on at a fairly basic level so using XNA would be a little counter productive in that respect.

Share this post


Link to post
Share on other sites
Yeah, the "vs" and "ps" extensions aren't a forced convention - you can choose to name them whatever you want. I personally write multiple vertex and pixel shaders in the same file (with different entry -points), and use "hlsl" for the file extension.

In larger projects, like a "real" game engine, you don't treat shader files in the same way that you treat CPP/H files --- they're more like a game asset / data-file.

i.e. you treat them the same way that you treat a level file, or a model, or an animation, or a texture -- you don't add those kinds of assets to your visual studio solution file.

For example, at work I have a directory of HLSL source-code. Our asset build pipeline (which does things like convert COLLADA models into our engine's native format for model files) then uses the [font="Lucida Console"]fxc[/font] program (which comes with the DX SDK) to compile the HLSL source files into binary shaders, which are then copied into the game's data directory, which is then packaged up into a big ZIP file.
This is a completely different work-flow for us than the way we deal with C++ (or Lua, etc) code.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!