opengl:glsl_hlsl
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
opengl:glsl_hlsl [2013/05/16 22:20] – [Texture] oga | opengl:glsl_hlsl [2016/09/12 14:53] (現在) – [GLSL/HLSL/Metal 命令対応表] oga | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== GLSL/HLSL 命令対応表 ====== | + | ====== GLSL/HLSL/ |
+ | * HLSL = DirectX (D3D8/ | ||
+ | * GLSL = OpenGL 2/3/4, OpenGL ES 2/3, Vulkan, SpliteKit (watchOS) | ||
+ | * Metal = Metal (iOS/ | ||
- | ^ GLSL ^ HLSL | ||
- | | float | float | | | ||
- | | | float1 | ||
- | | vec2 | float2 | ||
- | | vec3 | float3 | ||
- | | vec4 | float4 | ||
- | | mat3 | float3x3 | ||
- | | mat4 | float4x4 | ||
- | | int | int | | | ||
- | | ivec2/ | ||
- | | bool | bool | ||
- | | bvec2/ | ||
- | | lowp float | | 少なくても 10bit fixed 以上 | | ||
- | | mediump float | half | 少なくても 16bit fp 以上 | | ||
- | | highp float | float | 32bit fp | | ||
- | | double | ||
- | | vec3 x= vec3( a, b, c ); | float3 x= { a, b, c }; | ||
- | | ::: | float3 x= float3( a, b, c ); | ||
- | | float x[3]= float[]( a, b, c ); | float x[3]= { a, b, c }; | ||
- | | type( x ) | (type)x | ||
- | | matrix * matrix | ||
- | | vector * matrix | ||
- | | uniform | ||
- | | in/out , varying/ | ||
- | | builtin gl_* variables | ||
+ | ^ GLSL ^ HLSL ^ Metal ^ ^ | ||
+ | | float | float | float | | | ||
+ | | -- | float1 | ||
+ | | vec2/ | ||
+ | | mat3 | float3x3 | ||
+ | | mat4 | float4x4 | ||
+ | | mat3x4 | ||
+ | | int | int | int | | | ||
+ | | ivec2/ | ||
+ | | uint | uint | uint (unsigned int) | ||
+ | | uvec2/ | ||
+ | | bool | bool | bool | ||
+ | | bvec2/ | ||
+ | | lowp float | min10float | ||
+ | | mediump float | half (min16float) | ||
+ | | highp float | float | float | 32bit fp | | ||
+ | | double | ||
+ | | highp int / uint | int / uint | int / uint | 32bit int | | ||
+ | | mediump int / uint | min16int / min16uint | ||
+ | | lowp int / uint | min12int | ||
+ | | -- | -- | char / uchar | 8bit int | | ||
+ | | vec3 x= vec3( a, b, c ); | float3 x= { a, b, c }; | float3 x= { a, b, c }; | | ||
+ | | ::: | float3 x= float3( a, b, c ); | float3 x= float3( a, b, c ); | | | ||
+ | | float x[3]= float[]( a, b, c ); | float x[3]= { a, b, c }; | float x[3]= { a, b, c }; | ||
+ | | type( x ) | (type)x | ||
+ | | matrix * matrix | ||
+ | | vector * matrix | ||
+ | | uniform | ||
+ | | in/out , varying/ | ||
+ | | builtin gl_* variables | ||
- | ^ GLSL ^ HLSL | ||
- | | inversesqrt( x ) | rsqrt( x ) | 1/sqrt( x ) | | ||
- | | mix( x, y, s ) | lerp( x, y, s ) | | | ||
- | | clamp( x, min, max ) | clamp( x, min, max ) | | | ||
- | | clamp( x, 0.0, 1.0 ) | saturate( x ) | | | ||
- | | step( edge, x ) | step( edge, x ) | x < edge ? 0.0 : 1.0 | | ||
- | | smoothstep( min, max, x ) | smoothstep( min, max, x ) | clamp( (x-min) / (max-min), 0.0, 1.0 ) | | ||
- | ^ GLSL ^ HLSL ^ ^ | ||
- | | sampler2D samplerobj | ||
- | | sampler2DShadow shadowobj | ||
- | | v= texture( samplerobj, texcoord.. ); | v= textureobj.Sample( texcoord.. ); | sampling | ||
- | | v= texture2D( sampleobj, texcoord.. ); | v= tex2D( sampler, texcoord.. ); | legacy syntax | ||
- | | v= textureGather( sadowobj, texcoord.. ); | v= shadowobj.SampleCmp( texcoord.. ); | pcf shadow map | | ||
- | ^ shader | + | ^ GLSL ^ HLSL |
- | | vsh | in int gl_VertexID; | + | | inversesqrt( x ) |
- | | ::: | in int gl_InstanceID; | + | | mix( x, y, s ) |
- | | fsh/psh | out vec4 color; | + | | clamp( x, min, max ) | clamp( x, min, max ) | clamp( x, min, max ) |
- | | | + | | clamp( x, 0.0, 1.0 ) | saturate( x ) | saturate( x ) | | |
+ | | step( edge, x ) | step( edge, x ) | step( edge, x ) | ||
+ | | smoothstep( min, max, x ) | ||
+ | |||
+ | |||
+ | ^ GLSL ^ HLSL ^ Metal ^ ^ | ||
+ | | sampler2D samplerobj | ||
+ | | sampler2DShadow depthobj | ||
+ | | v= texture( samplerobj, texcoord.. ); | v= texobj.Sample( texcoord.. ); | v= texobj.sample( sampler, texcoord .. ) | sampling | ||
+ | | v= texture2D( sampleobj, texcoord.. ); | v= tex2D( sampler, texcoord.. ); | -- | legacy syntax | ||
+ | | v= textureGather( depthobj, texcoord.. ); | v= depthobj.SampleCmp( texcoord.. ); | v= depthobj.sample_compare( ... ) | pcf shadow map | | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ^ shader | ||
+ | | vsh | in int gl_VertexID; | ||
+ | | ::: | in int gl_InstanceID; | ||
+ | | ::: | out vec4 gl_Position; | ||
+ | | fsh/psh | out vec4 color; (GL2: gl_FragColor) | ||
+ | | ::: | out float gl_FragDepth; | ||
行 104: | 行 119: | ||
| GL_UNIFORM_BUFFER | | GL_UNIFORM_BUFFER | ||
| GL_TRANSFORM_FEEDBACK_BUFFER | | GL_TRANSFORM_FEEDBACK_BUFFER | ||
+ | ^ ^^^ | ||
+ | | GL_VERTEX_ARRAY_BINDING | ||
+ | |||
+ | |||
opengl/glsl_hlsl.1368710433.txt.gz · 最終更新: 2013/05/16 22:20 by oga