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

Compatibility between DirectX 9 and DirectX 10 shaders

I am a beginner to game development and as I am used to programming in C# I decided to go for XNA. I've been playing around with it for a while and now I am learning the basics of HLSL shaders, I have noticed in the MSDN documentation that there…
Delta
  • 4,308
  • 2
  • 29
  • 37
0
votes
0 answers

Write YUY2 textures from HLSL Compute Shader

I want to write a shader to analyze and transform video data in YUY2 format. Since shaders do not support YUY2 format textures, I'm using different views for the shader. The input texture is a DXGI_FORMAT_R8G8_B8G8_UNORM shader resource view, and…
Mastax
  • 175
  • 8
0
votes
3 answers

How to make a list?

I know this question sounds stupid but, what's the syntax to make a list in HLSL ? I found how to make an array (Type name[x]) but not how to make a list. :/
darky89
  • 1
  • 1
  • 2
0
votes
0 answers

ID3D10Blob error message error hlsl

I have this weird error. I'm trying to compile a HLSL file, but my debugging isn't working properly. Here's how I set up the error checking: hresult = D3DCompileFromFile(vs_fn, 0, 0, "VShader", "vs_4_0", D3DCOMPILE_DEBUG, 0, &vertex_shader_blob,…
0
votes
0 answers

HLSL lighting based on texture pixels instead of screen

In HLSL, how can I calculate lighting based on pixels of a texture, instead of pixels that make up the object? In other words, if I have a 64x64px texture being rendered on a 1024x768px screen, I want to calculate the lighting as it affects the…
Felipe
  • 10,606
  • 5
  • 40
  • 57
0
votes
0 answers

directx: shader constant buffer initial value

if I have a constant buffer in my shader like cbuffer buffer { float4 vector; }; what is the value of vector if I forgot to call SetConstantBuffers to set its value in c++ (or pass a nullptr for it in SetConstantBuffers). will…
joe.s234
  • 29
  • 1
0
votes
2 answers

HLSL sampler inside struct possible?

I'm using the DirectX 9 effect framework. I'd like to create a struct which contains a sampler like so: struct Test { texture tex; sampler texSamp = sampler_state { Texture = ; }; }; However the shader compiler fails…
Tom Whittock
  • 4,081
  • 19
  • 24
0
votes
0 answers

HLSL Stream Out Entries don't work correctly

I want implement Particle system based on stream out structure to my bigger project. I saw few articles about that method and I build one particle. It works almost correctly but in geometry shader with stream out i cant get value of InitVel.z and…
0
votes
0 answers

Glowing effect in WPF

On a WPF application, I'm trying to apply a glowing effect to a DrawingGroup or to it's DrawingContext. From what I could find out, there is not a built-in way to do it, the BitmapEffect of DrawingGroup is now obsolete, so we have to use the Effect…
HericDenis
  • 1,364
  • 12
  • 28
0
votes
1 answer

Views over Append/Consume buffers in Direct3D 11

I'm using append/consume buffers to reduce shading work in my path-tracer (immediately shade empty space + emitters in a pre-pass, append the remaining pixels for full processing), and I've heard that I should be using a UAV when I'm accessing…
Paul Ferris
  • 346
  • 5
  • 17
0
votes
1 answer

Having trouble projecting a ShadowMap on to a surface

So I am having trouble rendering a shadow map in a shader I'm kind of new to shader coding(roughly 3 months), I'll talk you through what I am doing(well what I think I am doing). So to start off by creating a script(ShadowCopy.cs) which copies the…
Durdle
  • 3
  • 4
0
votes
1 answer

Directx11 Project will not display graphical output

I'm fairly new to Directx, so I have next to no idea what's going on here. I have confirmed that the initial setup and activation of the window and DirectX API has been successful. However, although the drawing and update functions seem to be fully…
0
votes
1 answer

RenderMonkey not recognising my variables

My HLSL shader takes a parameter: , uniform float4x4 wm Putting this into RM I get an error : "Missing shader constant parameter named '$wm'" I created a 4x4 matrix variable wm but it doesn't change anything (and you aren't allowed to add $wm). How…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
0
votes
0 answers

HLSL alphablending in geometry shader

I am rather new to HLSL and I am struggling with implementing a grass shader. In the geometry shader I create quads which will display the grass blades. However when I try blending in the pixelshader things get weird. Sometimes it ignores everything…
Quinten Henry
  • 125
  • 1
  • 2
  • 10
0
votes
2 answers

Black hole distortion shader in Unity

I found shader code that has the effect of warping a space around a certain point. It's a cool effect, but it's missing some animation, so I've added something to it: Shader "Marek/BlackHoleDistortion" { Properties { _DistortionStrength…
Marek M.
  • 3,799
  • 9
  • 43
  • 93