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

Best way to update Interaction.Behaviors

I'm currently using Interaction.Behaviors in my app in order to use BackgroundEffectBehavior. I'm trying to figure our the best way to update this on a regular basis in XAML or C#. I've already tried c# and C# is turning out to be a dud because of…
Eric Zhu
  • 27
  • 4
0
votes
1 answer

HLSL (Unity-specific ok, not necessary) combining Stencil and worldspace "reverse" clipping

I've built a working surface shader (call it "wonderland") that renders as invisible unless a companion "lookingGlass" shader intersects with it from the viewpoint of the camera. Simple stencil shader arrangement. Easy peasy. I can add shader…
EddieOffermann
  • 145
  • 1
  • 7
0
votes
1 answer

Linear Depth to World Position

I have the following fragment and vertex shaders. HLSL code ` // Vertex shader //----------------------------------------------------------------------------------- void mainVP( float4 position : POSITION, out float4 outPos :…
nickygs
  • 47
  • 8
0
votes
1 answer

Problems with HLSL render to texture

Question: How can I render to target through HLSL by returning a struct with semantic mappings? Hi there. I'm new to DirectX11 and am trying to set up render to texture so I can implement deferred shading. I've spent over a day scouring the net for…
KiraBox
  • 69
  • 1
  • 10
0
votes
1 answer

Is there an equivalent to gl_LocalInvocationIndex in a HLSL compute shader?

Or do I need to calculate this myself? I can't find a reference for built in global variables in HLSL compute shaders.
Jordan
  • 476
  • 7
  • 16
0
votes
1 answer

Is there support for 8bits per channel and 16bits per channel UAV in a compute shader?

I'm working on a compute shader. It needs to output some textures as UAVs. Some of them have 8bits components and some have 16bits per channel. Consider this line: RWTexture2D _watNormTex; I bind a R8G8B8A8_UNORM texture to it and the…
morteza khosravi
  • 1,599
  • 1
  • 20
  • 36
0
votes
1 answer

Different between multi_pragma vs shader_feature

I go through a lot of documentation and google but still unclear. As state here, in unity doc, pragma_multi #pragma multi_compile A B C #pragma multi_compile D E This would produce three variants for first line, and two for the second line, or in…
Tengku Fathullah
  • 1,279
  • 1
  • 18
  • 43
0
votes
1 answer

Win2D: Correct usage of CanvasVirtualControl

I want to draw the mandelbrot-set taken from the Win2D-Example-Gallery and tweak it a little. At first I had all my code to generate the mandelbrot inside the CreateResources-Method of CanvasAnimatedControl, but due to performance issues I went on…
Manticore
  • 1,284
  • 16
  • 38
0
votes
1 answer

PSSetSamplers doens't work (The Pixel Shader unit expects a Sampler)

I'm very new at directx11, and I wanted to add texture to a shader I'm using. (until now, I hadn't used any texture yet in directx11) But sampling doesn't seem to work (it's always float4(0,0,0,0)), and I get the warning: "D3D11 WARNING:…
Stef
  • 315
  • 3
  • 14
0
votes
2 answers

Set shader's texture filter from C# in MonoGame

Say I have these two variables in my shader: HLSL texture ModelTexture; sampler2D TextureSampler And this is how I would set the texture: C# myEffect.Parameters["ModelTexture"].SetValue(woodTexture); What do about the sampler? There's no…
matt-pielat
  • 1,659
  • 3
  • 20
  • 33
0
votes
1 answer

C++ Shader matrix question

While examining shader examples I recently found that it's pretty often to pass the world inverse transpose matrix with the world and world-view-projection matrices. float4x4 worldMatrix; float4x4 worldViewProjectionMatrix; float4x4…
Yippie-Ki-Yay
  • 22,026
  • 26
  • 90
  • 148
0
votes
2 answers

3D Buffers in HLSL?

I wanna send a series of integers to HLSL in the form of a 3D array using unity. I've been trying to do this for a couple of days now, but without any gain. I tried to pack the buffers into each other…
None
  • 609
  • 7
  • 22
0
votes
1 answer

How to add a variable to a constantbuffer

I'm working on a Directx C++/CX (Universal Windows) project. I'm not all that familiar with Directx11 by the way. My code is mostly based on the sample projects on MSDN related to rendering directx in UWP using swapchainpanels. Now I wanted to add a…
Stef
  • 315
  • 3
  • 14
0
votes
0 answers

Difference between Sample and SampleLevel wrt texture filtering

I noticed what I think is a subtle difference between SampleLevel and Sample. The observation was made using Direct3D11, and it is reproducible on different versions of Windows (Win7, Win10) and different GPUs (Intel, NVidia, AMD). If the sampler…
ptahmose
  • 117
  • 3
0
votes
0 answers

How to write a Three-view drawings shader(in Unity3d)?

I attempt implement a Three-view drawings shader for simple geometry and have test with this shader,simple as: float doCos = dot(viewDirection, normalDirection); float4 texColor; //2. need board bool isBackSide = doCos < 0; if(isBackSide) { …
LoranceChen
  • 2,453
  • 2
  • 22
  • 48