opengl:glsl_hlsl
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン次のリビジョン両方とも次のリビジョン | ||
opengl:glsl_hlsl [2013/05/16 21:02] – [Texture] oga | opengl:glsl_hlsl [2014/09/13 16:03] – [GLSL/HLSL 命令対応表] oga | ||
---|---|---|---|
行 2: | 行 2: | ||
- | ^ GLSL ^ HLSL | + | ^ GLSL ^ HLSL ^ Metal |
- | | float | float | | | + | | float | float |
- | | | + | | -- |
- | | vec2 | float2 | + | | vec2/ |
- | | vec3 | + | | mat3 |
- | | vec4 | + | | mat4 |
- | | mat3 | + | | mat3x4 |
- | | mat4 | + | | int | int |
- | | int | int | | | + | | ivec2/ |
- | | ivec2/ | + | | uint | uint | uint (unsigned int) |
- | | bool | bool | + | | uvec2/ |
- | | bvec2/ | + | | bool | bool | bool | | |
- | | lowp float | | 少なくても | + | | bvec2/ |
- | | mediump float | half | + | | lowp float | min10float |
- | | highp float | float | 32bit fp | | + | | mediump float | half (min16float) |
- | | double | + | | highp float | float |
- | | vec3 x= vec3( a, b, c ); | float3 x= { a, b, c }; | + | | double |
- | | ::: | float3 x= float3( a, b, c ); | + | | highp int / uint | int / uint | int / uint | 32bit int | |
- | | float x[3]= float[]( a, b, c ); | float x[3]= { a, b, c }; | + | | mediump int / uint | min16int / min16uint |
- | | type( x ) | (type)x | + | | lowp int / uint | min12int |
- | | matrix * matrix | + | | -- | -- | char / uchar | 8bit int | |
- | | vector * matrix | + | | vec3 x= vec3( a, b, c ); | float3 x= { a, b, c }; |
- | | uniform | + | | ::: | float3 x= float3( a, b, c ); | float3 x= float3( a, b, c ); | | |
- | | in/out , varying/ | + | | float x[3]= float[]( a, b, c ); | float x[3]= { a, b, c }; | float x[3]= { a, b, c }; | | |
- | | builtin gl_* variables | + | | type( x ) | (type)x |
+ | | matrix * matrix | ||
+ | | vector * matrix | ||
+ | | uniform | ||
+ | | in/out , varying/ | ||
+ | | builtin gl_* variables | ||
行 33: | 行 38: | ||
- | ^ 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 | + | ^ GLSL ^ HLSL |
- | | sampler2D samplerobj | + | | inversesqrt( x ) |
- | | sampler2DShadow shadowobj | + | | mix( x, y, s ) |
- | | v= texture( samplerobj, texcoord.. | + | | clamp( x, min, max ) | clamp( x, min, max |
- | | v= texture2D( sampleobj, texcoord.. ); | v= tex2D( sampler, texcoord.. | + | | clamp( x, 0.0, 1.0 |
- | | v= textureGather( sadowobj, texcoord.. ); | + | | step( edge, x ) | step( edge, x ) | step( edge, x ) | x < edge ? 0.0 : 1.0 | |
+ | | smoothstep( min, max, x ) | smoothstep( min, max, x ) | smoothstep( min, max, x ) | clamp( (x-min) / (max-min), 0.0, 1.0 ) | | ||
- | ^ shader | ||
- | | vsh | in int gl_VertexID; | ||
- | | ::: | in int gl_InstanceID; | ||
- | | fsh/psh | out vec4 color; (GL2: gl_FragColor) | ||
- | | ::: | out float gl_FragDepth; | ||
+ | ^ 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: | 行 114: | ||
| GL_UNIFORM_BUFFER | | GL_UNIFORM_BUFFER | ||
| GL_TRANSFORM_FEEDBACK_BUFFER | | GL_TRANSFORM_FEEDBACK_BUFFER | ||
+ | ^ ^^^ | ||
+ | | GL_VERTEX_ARRAY_BINDING | ||
+ | |||
+ | |||
行 130: | 行 144: | ||
^ min + mip ^ mag ^ min ^ mag ^ mip | ^ min + mip ^ mag ^ min ^ mag ^ mip | ||
| GL_NEAREST | | GL_NEAREST | ||
- | | GL_LINEAR | + | | GL_LINEAR |
| GL_NEAREST | | GL_NEAREST | ||
| GL_LINEAR | | GL_LINEAR | ||
| GL_NEAREST_MIPMAP_NEAREST | | GL_NEAREST_MIPMAP_NEAREST | ||
- | | GL_LINEAR_MIPMAP_NEAREST | + | | GL_LINEAR_MIPMAP_NEAREST |
| GL_NEAREST_MIPMAP_NEAREST | | GL_NEAREST_MIPMAP_NEAREST | ||
| GL_LINEAR_MIPMAP_NEAREST | | GL_LINEAR_MIPMAP_NEAREST | ||
| GL_NEAREST_MIPMAP_LINEAR | | GL_NEAREST_MIPMAP_LINEAR | ||
- | | GL_LINEAR_MIPMAP_LINEAR | + | | GL_LINEAR_MIPMAP_LINEAR |
| GL_NEAREST_MIPMAP_LINEAR | | GL_NEAREST_MIPMAP_LINEAR | ||
| GL_LINEAR_MIPMAP_LINEAR | | GL_LINEAR_MIPMAP_LINEAR | ||
| | | | ||
+ | |||
+ | * Mip Linear = Tri Linear Filter | ||
+ | |||
+ | |||
+ | ^ OpenGL | ||
+ | | GL_REPEAT | ||
+ | | GL_MIRRORED_REPEAT | ||
+ | | GL_CLAMP_TO_EDGE | ||
+ | | GL_CLAMP_TO_BORDER | ||
+ | | | D3D11_TEXTURE_ADDRESS_MIRROR_ONCE | ||
+ | |||
opengl/glsl_hlsl.txt · 最終更新: 2016/09/12 14:53 by oga