Questions tagged [hlsl2glsl]

12 questions
4
votes
1 answer

GPU HLSL compute shader warnings int and uint division

I keep having warnings from compute shader compilation in that I'm recommended to use uints instead of ints with dividing. By default from the data type I assume uints are faster; however various tests online seem to point to the contrary; perhaps…
3
votes
1 answer

Using input/output structs in GLSL-Shaders

In HLSL I can write: struct vertex_in { float3 pos : POSITION; float3 normal : NORMAL; float2 tex : TEXCOORD; }; and use this struct as an input of a vertex shader: vertex_out VS(vertex_in v) { ... } Is there something similar in…
0xbadf00d
  • 17,405
  • 15
  • 67
  • 107
3
votes
1 answer

What is the correct way to structure a Cg program?

This tutorial uses explicit OUT structures, e.g: struct C3E1v_Output { float4 position : POSITION; float4 color : COLOR; }; C3E1v_Output C3E1v_anyColor(float2 position : POSITION, uniform float4 constantColor) { …
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
2
votes
1 answer

What's the GLSL equivalent of [[vk::binding(0, 0)]] RWStructuredBuffer in a compute shader

I have this HLSL and I want to write the equivalent in GLSL. If it's any use, I'm trying to run this example https://github.com/mcleary/VulkanHpp-Compute-Sample [[vk::binding(0, 0)]] RWStructuredBuffer InBuffer; [[vk::binding(1, 0)]]…
Logos King
  • 121
  • 1
  • 6
2
votes
1 answer

What does square brackets operator do in HLSL

I'm working on porting our application from Windows to Linux and I need to understand what does operator [] do in HLSL and how to port in to GLSL. I have code like this: red = texture.Sample(sampler, uv)[x]; Sample function should return a pixel…
Dmitry
  • 317
  • 3
  • 10
2
votes
0 answers

Sum of absolute difference of 2 geometries within a shader in unity

I am trying to do a Sum of absolute difference within my shader and write back the single result back to a uniform float in a in unity. In the shader I have 2 geometries with the same number of vertices that map one to one. //…
Savashito
  • 29
  • 1
2
votes
2 answers

converting hybrid cg/hlsl shaders to glsl es

I am looking for a tool that can convert cg/hlsl hybrid shaders to glsl es shaders. I have tried hlsl2glsl which doesnt understand the keyword 'extern' although it is a viable hlsl keyword and have looked to cgc but have found no documentation on…
aerlfredith
  • 1,123
  • 4
  • 12
  • 18
1
vote
1 answer

HLSL vs GLSL, in writing Unity shaders

confused about the shading language to use ( HLSL or GLSL ), because of supporting platforms. HLSL resources are available in abundance, but I saw through the web that it's specific to DirectX (windows). Would that be a problem if I'm planning to…
Florida
  • 23
  • 4
0
votes
1 answer

How does one set an array in hlsl?

In glsl, array = int[8]( 0, 0, 0, 0, 0, 0, 0, 0 ); works fine, but in hlsl this doesn't seem to be the case. It doesn't seem to be mentioned in any guides how you do this. What exactly am I meant to do?
Logos King
  • 121
  • 1
  • 6
0
votes
0 answers

Shader Resource View analogous in threejs

Is there any equivalent method for Shader Resource View in Threejs, When I searched on net I found that the equivalent for Shader Resource View in OpenGL is Texture View (glTextureView), But Couldn't find anything in threejs
Renjith Raju
  • 161
  • 1
  • 13
0
votes
1 answer

Pixel Shader performance in Directx9 not equivalent to Opengl ES2.0

I am using a drop effect by the help of pixel shader in directx-9 to be specific SlimDX.Direct3D9 written in hlsl used for transition between two images. I have written the same pixel shader in glsl language to be used in an android project using…
Yashwinder
  • 59
  • 8
0
votes
1 answer

GLSL ES Pixel Shader only works if unused texcoords are passed in

I have a vertex shader, shared between several pixel shaders - GLSL ES 2.0 on iOS. The VS outputs transformed position, normal and one set of 2D uv coords. Here is the bare-bones of it: void main() { vec4 xlt_outPos; vec3 xlt_outNormal; …
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589