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

HLSL Particle system will not display

I have been trying to add a particle system to my Directx11 graphics demo, and so i have been using the 'Introduction to 3d Game Programming with directx 11' book. Because of this am attempting to use a HLSL StreamOut technique to update the…
user3640122
  • 15
  • 1
  • 6
0
votes
0 answers

Is a single pass dropshadow pixel shader possible?

I've been working on a project, in WPF/C#, at work which uses quite a few animations. As a whole the project is going very well, and we've managed to make the animations efficient and impressive. The problem is, we had to remove drop shadows to…
BlindGarret
  • 155
  • 7
0
votes
0 answers

Possible to Apply Effect to Individual Textures in the Same Spritebatch?

I have a tile engine set up, all of which use the same SpriteBatch, SpriteSortMode.FrontToBack, so that I can use float depth for different layers, items on map, etc. I wanted to apply an effect to individual layers, but after trying it just applied…
Shyy Guy
  • 232
  • 3
  • 18
0
votes
0 answers

Constant buffer receives wrong value

I have got this HLSL struct and when I pass in a Material buffer from C++ to HLSL, some values in my struct is wrong. I know this because I have tried for example setting the emissive color to Vector4(0, 1, 0, 1) or GREEN and in my pixel shader I…
user2441535
0
votes
0 answers

HLSL not executing code?

Newbie HLSL programmer here. I'm trying to create a very basic shader for directional light and i'm experiencing really bizarre behaviour trying to debug the shader code. I dont know if its my lack of understanding of how this all works or if…
Walter
  • 664
  • 1
  • 6
  • 19
0
votes
2 answers

Loading just a part of a texture in DirectX?

If I have a texture file how would I be able to load up only a part of it using a defined rect (top, left, bottom, right)? Is it technically possibly to only read in the parts I want to load while leaving the rest of the texture untouched?
meds
  • 21,699
  • 37
  • 163
  • 314
0
votes
1 answer

HLSL Reflection - how to get the members of a tbuffer?

I can use GetConstantBufferByIndex to get a pointer to an ID3D11ShaderReflectionConstantBuffer which will allow me to enumerate the members of a cbuffer, but for a tbuffer, I can't find any corresponding function in the D3D Reflection APIs. Am I…
Charlie Skilbeck
  • 1,081
  • 2
  • 15
  • 38
0
votes
1 answer

HLSL, Program pixel shader with different Texture2D downscaling algorithms

I'm trying to port some image interpolation algorithms into HLSL code, for now I got: float2 texSize; float scale; int method; sampler TextureSampler : register(s0); float4 PixelShader(float4 color : COLOR0, float2 texCoord : TEXCOORD0) :…
Kaminari
  • 1,387
  • 3
  • 17
  • 32
0
votes
1 answer

Issues with calculate final pixel color with multiple point lights DX11

As the header denotes I've got some issues calculating the final pixel color when rendering a scene with multiple point lights. When I calculate one light, the scene looks just fine but when I calculate more than one the light it seems to be a bit…
SvinSimpe
  • 850
  • 1
  • 12
  • 28
0
votes
1 answer

HLSL Constant Buffer Packing Unexpected Error

I have an HLSL shader that is giving an unexpected error when I add a particular variable to a constant buffer. The entire shader is below. To rule everything out I included the entire shader. The error occurs when I add the NewVariable to the third…
Russell Trahan
  • 783
  • 4
  • 34
0
votes
1 answer

Directx: HLSL Texture based height map. (Shader 5.0)

I'm trying to implement a GPU based height map the simplest (and fastest) way that I know how. I passed a (.png, D3DX11CreateShaderResourceViewFromFile()) texture into the shader, and I'm attempting to sample it for the current pixel value. Seeing a…
Rashid Ellis
  • 330
  • 3
  • 22
0
votes
1 answer

Visual studio 2012 crashes when I try to edit .hlsl or .fx files

Visual studio 2012 crashes when I try to edit .hlsl or .fx files, even after I disabled all of my extensions. I also uninstalled Parallel NSight and NShader but the syntax highlighting still shows up for these file types (and seems to be the cause…
maogenc
  • 203
  • 7
  • 13
0
votes
1 answer

How can I reduce or optimize instruction slots on this shader code for SM3?

I am getting too many instruction slots on the following shader code: float2 texture_size; float4x4 matrixTransform; const static float coef = 2.0; const static float3 yuv_weighted = float3(14.352, 28.176, 5.472); sampler decal :…
test
  • 2,589
  • 2
  • 24
  • 52
0
votes
1 answer

DirectX 11: Encoded Vertex Shader size doesn't match specified size

I'm using DirectX 11. I pre-compiling the shader and then loading at a runtime. I'm loading the file into a buffer and then sending it in to CreateVertexShader. When I call CreateVertexShader with the debug layer turned on, I get the following…
101010
  • 14,866
  • 30
  • 95
  • 172
0
votes
2 answers

DirectX 9 + Shader Effect: disable a smooth transition of color

I created a simple shader effect, which must paint left-half part is blue color and right-half part is red color. But the transition is not sharp colors and is made with a gradient see picture: I need to turn off the smooth transition of colors…
Jarikus
  • 774
  • 8
  • 18