How does everyone test their hlsl code?

Started by
10 comments, last by roastedamoeba 8 years ago

I started learning hlsl not to long ago, and realized that the book im using is a few years old.

I use rendermonkey to write and test hlsl shaders, and i was wondering what other people are using? Is there something that is actively being dev'd i should be using instead of rendermonkey?

Advertisement

Depends on what you mean by "testing hlsl":

If by testing you mean prototyping an idea or some math; RenderMonkey works since most of the relevant syntax hasn't changed. Unity can also work. Even ShaderToy can work even though it does GLSL, math is still math and porting to HLSL is a bit of find & replace (e.g. vec4 with float4).

If by testing you mean the shader works well in the actual environment it's going to run (i.e. the game), has proper SM 4.0/5.0 syntax, then nothing's best like your own program as testing, considering you implemented a hot reloading feature that detects changes on disk and reloads them automatically. And RenderDoc, Visual Studio Graphics Debugger and GPUPerfStudio for debugging. In that order.

In my game, I have a button that lets me re-load any modified files. Other engines like Unity also support this.

Then you can simply write code while the game is running and watch the results. If you're not sure about something, you can always add "return" statements in the middle of your code to visualize intermediate values.

very cool, and thanks, Ill look into these

I guess I should mention that Im an effects artist, sry about that. I'm using hlsl for shader programming, and I hope to explore directx more when I'm comfortable. shadertoy was one of the sites that got me interested in graphics programming. I hope to be able to make something to add to the awesomeness over there, sooner rather than later

I will be writing shaders for unity and unreal, and I have some exp with cg in unity. my short time goal is to write an hlsl shader that works and looks the same within 3ds max, unity, and unreal

What i mean by test code - Rendermonkey makes it very easy to write hlsl shaders, preview them, and then compile that working shader into an .fx file

I don't know how to create .fx files anywhere other than rendermonkey and am curious to know what the more experienced programmers are using to write and test their hlsl shaders, especially for dx12, since rendermonkey appears to be a dx9 thing - right now it very much feels like I need/rely on rendermonkey to create hlsl shaders

apologies if these questions belong elsewhere, i just saw the directx and xna forums, but thanks for any guidance

I don't know how to create .fx files anywhere other than rendermonkey and am curious to know what the more experienced programmers are using to write and test their hlsl shaders, especially for dx12, since rendermonkey appears to be a dx9 thing

.fx files are also largely a dx9 thing :(

In my game, I have a button that lets me re-load any modified files. Other engines like Unity also support this.

Then you can simply write code while the game is running and watch the results. If you're not sure about something, you can always add "return" statements in the middle of your code to visualize intermediate values.

You can make it even better. In our engine we load assets instantly if they are changed on disk. This way you don't need to hop between different windows all the time. It sounds very minor improvement but it's drastically make things better. Just small amount window to window hopping lose your focus and ruin the flow.

I'm just adding shaders in VS2015, and Build compiles it to .vso objects, which I copy to debug/release folders with a post build step, then I just load them with DX11 :)

.:vinterberg:.

You can make it even better. In our engine we load assets instantly if they are changed on disk. This way you don't need to hop between different windows all the time.

Our old engine used to do that, now I have a tickbox whether to do it or wait for a button press smile.png
I switched to the button press method because I always habitually hit ctrl+s when working on a file, and having the engine constantly compile your data was annoying. Also when iterating a texture you're often working on a set of files, and the reload should wait until they've all been written to the disk.
But yeah -- at least having the option of auto-reloading modified files is a must-have feature for any modern engine!

> You can make it even better. In our engine we load assets instantly if they are changed on disk

I prefer a key combination for that because you can instantly see old and new behaviour without anything between (alt-tabbing etc.).

edit: I somehow broke the quoting system and can't modify or remove the quoted section.

Aether3D Game Engine: https://github.com/bioglaze/aether3d

Blog: http://twiren.kapsi.fi/blog.html

Control

> You can make it even better. In our engine we load assets instantly if they are changed on disk

I prefer a key combination for that because you can instantly see old and new behaviour without anything between (alt-tabbing etc.).

edit: I somehow broke the quoting system and can't modify or remove the quoted section.

I prefer dual monitor for this. No alt tabbing from shader text editor to game to press hotload button. It would be nice that if engine would take screenshot before and after hotloading. Most of the time this is what I want.

This topic is closed to new replies.

Advertisement