Tool for pixel and vertex shader - xna

Is there any tool for testing pixel and vertex shaders?

nVidia FX Composer (There was also AMD (formerly ATI) RenderMonkey, but it looks like that's been shelved.)
Finally, you may find PIX useful for testing shaders as they are used in your application. It is included in the DirectX SDK.

For HLSL Effects that you can use in XNA (PS 2.0-3.0) you can try:
3DPee (Tridipy) player and shader editor (dead link)
It operates on images and video.
It supports multi pass technique, vertext shader, and has a nice editor with error message reporting on compile.
It's an alpha version i have developed but it can be useful.
Screenshot:

You need to have a Mac to use it, but Apple's OpenGL Shader Builder is pretty nice. You can literally type in shaders and run them live, outside of your application.

A nice one here for WebGL: http://glsl.heroku.com

Related

TEXCOORD0 in my HLSL shader always points to (0,0)

i'm working on directx9 and i'm trying to get my hand on shaders, here is my shader:
sampler texLastPass : register( s0 );
float4 main(in float2 t : TEXCOORD0) : COLOR
{
float4 color = tex2D(texLastPass, t);
return float4(color.rgb, 1.0f);
}
In theory there should be no change with it, but instead my whole objects is filled with pixel that exists on position (0, 0) in texture.
So why provided pixel coordinates to shader are wrong?
Your shader code has a sampler, but where is the texture? From Microsoft Docs:
Three things are required to sample a texture:
* A texture
* A sampler (with sampler state)
* A sampling instruction
Since you are missing the binding to the texture, Direct3D 9 is going to provide you a value of 0,0,0 for all texture references.
texture tex0 : register( t0 );
Without this it still builds because it implicitly assumes you mean t0.
You are using 'explicit binding' in this shader, which is perfectly fine and recommended if you are avoiding the use of the legacy Effects system. That said, Direct3D 9 developer education materials and samples were heavily based on Effects which uses a slightly different syntax, and therefore a source of confusion.
You don't show your C/C++ code, so it could be related to your binding code as well.
Note that if writing Direct3D 9 code these days, a few important things to keep in mind:
The DirectX SDK is deprecated and legacy, and it's use is strongly discouraged. See Microsoft Docs. It has a number of known issues and is challenging to even install.
The core headers for Direct3D 9 are part of the Windows SDK, so they are already part of Visual Studio 2012 or later. You don't need the DirectX SDK to build Direct3D 9 code.
The D3DX9 utility library is also deprecated, but is really the only way to get Direct3D 9 support code. As of earlier this year, you can now consume it from NuGet with a simple side-by-side redistribution rather than rely on the legacy DirectX SDK or the legacy DirectX End-User Runtime Redist. See this blog post.
The Direct3D 9 Debug Device is not supported on Windows 8, Windows 8.1, or Windows 10.
All the samples for Direct3D 9 from the legacy DirectX SDK can be found on GitHub.
You should take a look at DirectX 11 as a better starting point which has much better debugging support, tools support, and open source libraries. See this blog post.

When using opencl with torch, lua uses integrated graphics not dedicated gpu

I am using Andrej Karpathy's code to train a rnn. When I give the flag "-opencl 1" to tell it to use an opencl gpu, it uses integrated graphics and nothing else.
I tried reinstalling cltorch and using different flags, but nothing has seemed to work. To add to this I can't see if my gpu is under load because I'm on macos. I looked through the code and I could't find any errors, but I have little experience with lua.
Code can be found here: https://github.com/karpathy/char-rnn.
I expect with the flag "opencl 1" or something to the like, my radeon pro 560x will be used to train on my dataset and not my cpu or integrated graphics.
When reading instructions I thought just -opencl flag needed to be used but it turns out -gpuid needs to be used in conjuction with it as well. This was also after a reinstall of torch and opencl drivers, so that could have been a problem as well.

Convert DXBC to DXIL (DirectX Bytecode to DirectX Intermediate Language)

Microsoft's open source DirectX Shader Compiler describes the format of a new intermediate language (IL) for HLSL shaders called DXIL.
The documentation makes reference to a converter from the previous HLSL IL, called DXBC, to the new DXIL: https://github.com/Microsoft/DirectXShaderCompiler/blob/master/docs/DXIL.rst.
However, I am unable to find the referenced dxbc2dxil tool, or any other way to convert DXBC to DXIL. I have tried passing DXBC files to the various tools in the DirectX Shader Compiler project, but none have accepted plain DXBC as input.
Is there currently a way to obtain DXIL from old DXBC?
My understanding of this documentation is that Microsoft will take charge of only providing DXIR to the vendor's drivers in the future. The DXBC2DXIL is a Microsoft internal only module.
To my knowledge, nothing in the DirectX Shader Compiler repository has the capability to translate a DXBC IL to a DXIL.
See this project for a working hack: https://github.com/Nukem9/Dxbc2Dxil
They use "dxilconv.dll" from win10 to create an instance of the undocumented DXBC->DXIL converter.

How can I draw a Sphere with SharpDX *3.0*?

The SharpDX toolkit has been abandoned for 3.0 SharpDX :(
Unfortunately, we need/are using this for a current Windows 10 project.
What we need to do is create a Sphere object as a surface so we can project on to it. Can anybody lead me to some things (or simply provide said things) that might help me out?
Thanks!
I can help you with the toolkit side of things, I'm using this atm for my terrain color map building I'm not sure how it will go if you use it every frame for UI type stuff because the guy that converted it to sharpdx 3 used pinvoke instead of the native fixed call.
https://github.com/tomba/Toolkit
just download as zip, load into VS and remove all the test\projects that fail to load then just build and add a ref to you project like normal.

Delphi DX11 Direct3D Vertex and Pixel Shader Issues

I'm attempting to translate some C++ DX11 Direct3d height-map code into Delphi. I'm at at a stage where I have almost the entire code translated across without any compile errors or run-time errors however I cannot for the life of me get anything to render on-screen - which I believe may be a vertex/pixel shader issue.
The code I'm translating across is here:
http://www.rastertek.com/tertut02.html
And I'm using the JSB DirectX11 interface libraries from here:
http://www.jsbmedical.co.uk/DirectXForDelphi/
I know that the Direct3D subsystem is working correctly as I am able to alter the color of the background of the render surface however, I just do not get any polygons rendered on the display.
There is quite a lot of code which I'm unable to upload here so for convenience, here's a copy of my source (without any object files/binaries)
https://www.dropbox.com/s/r90jbl6vz9gb3s7/Delphi%20Height%20Map.zip?dl=0
Unfortunately, there doesn't appear to be many Delphi DX11 or D3D examples on the internet so I have nothing to benchmark the code against.
I'd be eternally grateful if anyone could offer any pointers as to what may be the issue. Like I say, the code compiles and runs without any errors but just nothing is rendered.
Thanks in advance,
Kevin
You can look here on how to do basic rendering with D3D11 using Delphi - https://github.com/AntonAngeloff/DX11_Examples
These examples use another headers translations, though.

Resources