Questions tagged [hlsl]

HLSL(High Level Shader Language) is a proprietary shading language developed by Microsoft for use with the Microsoft Direct3D API

HLSL is a C-like language developed by Microsoft and it's used in Direct3D API to define shaders. HLSL is used by Direct3D 9, and is required by the unified shader model in Direct3D 10+.

HLSL can be used to define pixel shaders, vertex shaders, geometry shaders, compute shaders, tessellation shaders, raytracing shaders and mesh shaders. It is analogous to for OpenGL.

Vulkan SDK and DirectX Shader Compiler also supports compiling HLSL shaders into SPIR-V, enabling its use in Vulkan applications.

Resources

1642 questions
0
votes
1 answer

Are there any shader inputs other than TEXCOORD that wpf supports

I know that you can tie constant registers to dependency properties as well as tie a brush to a sampler, but every example I have seen of a wpf shader uses the declaration main( float2 uv : TEXCOORD ) : COLOR I am a complete newbie to HLSL but I…
user334911
0
votes
1 answer

Instance vs Loops in HLSL Model 5 Geometry Shaders

I'm looking at getting a program written for DirectX11 to play nice on DirectX10. To do that, I need to compile the shaders for model 4, not 5. Right now the only problem with that is that the geometry shaders use instancing which is unsupported by…
Ben
  • 2,867
  • 2
  • 22
  • 32
0
votes
1 answer

DirectX 11 - Compute Shader, copy data from the GPU to the CPU

I've just started up using Direct compute in an attempt to move a fluid simulation I have been working on, onto the GPU. I have found a very similar (if not identical) question here however seems the resolution to my problem is not the same as…
0
votes
2 answers

Calculation failing in the compute shader. HLSL DX11

I'm fairly new to compute shaders and I've just started an implementation of one for an Nbody simulation and I've come across a problem that I can't solve on my own. Here's everything that is contained in the compute file and the entry point is…
DHudson
  • 1
  • 1
  • 3
0
votes
0 answers

SM5 HLSL assembly: under what circumstances will a bfi + a shift have equal or better efficiency than two shifts and an or/xor?

Context: I'm doing repeated bitwise rotations, and I've found that the standard rotate can be replicated with a shift and a bfi. Of note: when I compile an HLSL file that uses rotates with FXC, it uses lots of bfi instructions for this…
MNagy
  • 423
  • 7
  • 20
0
votes
1 answer

Strange behavior of tessFactors inside tessellation stage

i've noticed some super stange behavior on my nvidia 860m. Im programming some 3d engine and i'm using tessellation for terrain rendering. I use a simple quad tessellation algorithm. struct PatchTess { float EdgeTess[4] : SV_TessFactor; …
kaiser
  • 940
  • 1
  • 10
  • 25
0
votes
2 answers

Matrix multiplication does not work in my vertex shader

Currently, I am calculating the World View Projection Matrix in my application instead of the GPU. I want to move this calculation to the GPU, but I am currently unable to do so. Case 1 (see below) works very well, but case 2 doesn't and I have no…
GameDevAlien
  • 195
  • 1
  • 17
0
votes
2 answers

How to create a diagonal HLSL transition shader

I am trying to adapt the code from a couple of the HLSL shaders in the WPF Pixel Shader Effects Library on Codeplex to create a pixel shader which creates a diagonal transition from Texture1 to Texture2 by sliding Texture2 across Texture1 as if it…
Ian Carson
  • 139
  • 1
  • 10
0
votes
0 answers

Shader - Directional Lights Depth

Is there a way to retrieve the deph from directional lights ? I can access the _ShadowMapTexture but this is not the depth. I found how to access the shadow map of, I think, every light type by using the defines such as SHADOW_ATTENUATION(a) or…
MaT
  • 1,556
  • 3
  • 28
  • 64
0
votes
1 answer

Blinn-Phong shading with HLSL and D3D11: point light

I am currently trying to implement point lights in my game using Blinn-Phong shading in HLSL. The tutorial I followed is linked here. The code I have now is: struct VS_INPUT { float4 Position : POSITION; float3 Normal : NORMAL; float2…
featherless biped
  • 163
  • 1
  • 5
  • 16
0
votes
0 answers

HLSL Unity5> Multiple render targets

I am attempting to specify a frag output into a set texture (render target) depending on some logic. To summarise my shader: I am preforming a Texture3D raycasting method that allows for the user to 'see' inside the texture 3D data. My issue arises…
0
votes
1 answer

How would I calculate the normals of a wave for lighting?

I'm doing vertex manipulation of a plane with DirectX11 and for my lighting (multiple point lights with specularity) I need to recalculate the normals of each vertex. My question is essentially what equation would I use to do get the normals (x & y)…
DeanoMachino
  • 59
  • 2
  • 12
0
votes
1 answer

DX11 HLSL Secondary Texture Coordinates Lost

Been banging my head up against the wall with this for a while. Despite the fact that I THINK I have a proper Vertex Format defined with D3D11_INPUT_ELEMENT_DESC, no matter what I do, I can't see to read my TEXCOORD1 values from this shader. To…
jason
  • 99
  • 7
0
votes
1 answer

Shader and Texture Scrolling depending on Direction

I am trying to scroll a texture using its uv in Unity but I don't get the result I need. The aim is to have two components, the speed and the direction. I would like to define the direction in normalized values and the speed should influence the…
MaT
  • 1,556
  • 3
  • 28
  • 64
0
votes
0 answers

Release edition of DirectX 11 code can't create effect

I used D3DX11CreateEffectFromMemory function to create a effect from a .fxo file. D3DX11CreateEffectFromMemory(&compiledShader[0], size, 0, md3dDevice, &mFX) and I found out that the debug edition code works fine with that. But in release…
ItsJingran
  • 147
  • 9