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
3
votes
2 answers

How would I write an HLSL bevel shader for Silverlight?

I know that Silverlight doesn't directly support the WPF bitmap effects, but I also know that Silverlight 3 supports HLSL shaders. Would it be relatively simple to write a bevel effect, ilke the one in WPF, and if so, can somebody recommend a good…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
3
votes
0 answers

Strange smeared edges pattern using HLSL for YUV to RGB conversion

I'm trying to write a YUV to RGB shader in HLSL. Specifically, it converts the Yuv420p format which consists of an NM plane of Y values, followed by an (N/2)(M/2) plane of U values and then an (N/2)*(M/2) plane of V values. For example this 1280x720…
Asik
  • 21,506
  • 6
  • 72
  • 131
3
votes
1 answer

Understanding the "sampler array index must be a literal expression" error in ComputeShaders

Let's say I have a compute shader that retrieves data from a Texture2DArray using the Id of the group like this: Texture2DArray gTextureArray[2]; [numthreads(32, 1, 1)] void Kernel(uint3 GroupID : SV_GroupID, uint3 GroupThreadID :…
Gabriel C.
  • 97
  • 1
  • 10
3
votes
1 answer

Interlocked average (CAS) not working on HLSL

Hy everyone. I tried to implement an interlocked moving average, using InterlockedCompareExchange, on HLSL, but I got the GPU stuck on an infinite loop. So, the code is this: [allow_uav_condition] while (true) { // Get old value uint old =…
Santiago Pacheco
  • 197
  • 1
  • 13
3
votes
2 answers

Compute Shaders Input 3d array of floats

Writing a Compute Shader to be used in Unity 4. I'm attempting to get 3d noise. The goal is to get a multidiminsional float3 array into my compute shader from my C# code. Is this possible in a straightforward manner (using some kind of declaration)…
PandemoniumSyndicate
  • 2,855
  • 6
  • 29
  • 49
3
votes
1 answer

Pixel Shader Effect in WPF

I was following along this tutorial about how to include Pixel Shader Effects in the form of an animation within a WPF application. Background I felt like things were going smoothly, however I wanted to make a change to the application. In the…
mwjohnson
  • 661
  • 14
  • 26
3
votes
2 answers

How to play HLS Wowza Live Stream (m3u8) on videojs

I am trying to play h264 encoded live stream using html5 video tag. Live stream is broadcasted by wowza media server and when visiting src link I get a valid playlist file. When trying to play the stream on android chrome browser, player does…
user2656834
  • 31
  • 1
  • 1
  • 3
3
votes
4 answers

HLSL DirectX9: Is there a getTime() function or similar?

I'm currently working on a project using C++ and DirectX9 and I'm looking into creating a light source which varies in colour as time goes on. I know C++ has a timeGetTime() function, but was wondering if anyone knows of a function in HLSL that will…
Mike
  • 135
  • 1
  • 2
  • 8
3
votes
1 answer

Change display format of DirectX "Object Table"

While debugging with VS 2012 Graphic's Debugger, I want to look at an index buffer, but the format that is showing it in is as float. This means the numbers are different than they would be with an int or short format. Does somebody know how to…
Miguel
  • 872
  • 1
  • 12
  • 26
3
votes
2 answers

How to use vertex, normal and texture indices together?

I'm writing a small rendering engine using C++ and DirectX 11. I've managed to render models using indexed vertices. Now I want to support textures and vertex normals as well. I'm using Wavefront OBJ files, which uses indices to reference to the…
Krienie
  • 611
  • 1
  • 6
  • 14
3
votes
1 answer

Sampling from single channel textures in DirectX

I have a 2D texture formatted as DXGI_FORMAT_R32_FLOAT. In my pixel shader I sample from it thusly: float sample = texture.Sample(sampler, coordinates); This results in the following compiler warning: warning X3206: implicit truncation of vector…
Justin R.
  • 23,435
  • 23
  • 108
  • 157
3
votes
0 answers

DirectX11 Radix Sort

I'm struggling to implement an efficient Radix Sort in DirectX11. I need to quickly sort no more than 256K items. It doesn't need to be in-place. Using CUDA / OpenCL is not an option. I have it almost working, but it has a few problems: The…
Hybrid
  • 396
  • 4
  • 20
3
votes
2 answers

Fetching the vertices from the backbuffer (HLSL) on XNA

Hello and sorry for the obscure title :} I`ll try to explain the best i can. First of all, i am new to HLSL but i understand about the pipeline and stuff that are from the fairy world. What i`m trying to do is use the gpu for general computations…
user179142
3
votes
1 answer

How to do smooth Alpha chanel keying with Silverlight 3 Pixel Shaders?

How to do smooth Alpha channel keying with Silverlight 3 Pixel Shaders? I want some HLSL filter (like this Shazzam HLSL example) sampler2D implicitInputSampler : register(S0); float4 main(float2 uv : TEXCOORD) : COLOR …
Rella
  • 65,003
  • 109
  • 363
  • 636
3
votes
1 answer

HLSL error X4507: maximum constant register index exceeded

I have a vertex shader with a cbuffer that contains this member: float4 myArray[16]; In the body of the shader I can read and use the array values using a variable index: float4 anElement = myArray[(int)(input.Color.g * 255)]; This compiles fine.…
Justin R.
  • 23,435
  • 23
  • 108
  • 157