ユーザ用ツール

サイト用ツール


opengl:glsl_hlsl

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
opengl:glsl_hlsl [2014/07/02 16:34] – [GLSL/HLSL 命令対応表] ogaopengl:glsl_hlsl [2016/09/12 14:53] (現在) – [GLSL/HLSL/Metal 命令対応表] oga
行 1: 行 1:
-====== GLSL/HLSL 命令対応表 ======+====== GLSL/HLSL/Metal 命令対応表 ======
  
 +  * HLSL = DirectX (D3D8/D3D9/D3D10/D3D11/D3D12)
 +  * GLSL = OpenGL 2/3/4, OpenGL ES 2/3, Vulkan, SpliteKit (watchOS)
 +  * Metal = Metal (iOS/tvOS/macOS)
  
-^ GLSL                              ^ HLSL                           MT                           ^    ^+ 
 + 
 +^ GLSL                              ^ HLSL                           Metal                        ^    ^
 | float                             | float                          | float                        |    | | float                             | float                          | float                        |    |
-                                  | float1                                                         +--                                | float1                         --                           HLSLのみ single vector 可能  
-| vec2                              | float2                         | float2                       |    | +| vec2/vec3/vec4                    | float2/float3/float4           | float2/float3/float4         |    |
-| vec3                              | float3                         | float3                          | +
-| vec4                              | float4                         float4                       |    |+
 | mat3                              | float3x3                       | float3x3                        | | mat3                              | float3x3                       | float3x3                        |
 | mat4                              | float4x4                       | float4x4                        | | mat4                              | float4x4                       | float4x4                        |
行 13: 行 16:
 | int                               | int                            | int                          |    | | int                               | int                            | int                          |    |
 | ivec2/ivec3/ivec4                 | int2/int3/int4                 | int2/int3/int4                  | | ivec2/ivec3/ivec4                 | int2/int3/int4                 | int2/int3/int4                  |
 +| uint                              | uint                           | uint  (unsigned int)            |
 +| uvec2/uvec3/uvec4                 | uint2/uint3/uint4              | uint2/uint3/uint4            |    |
 | bool                              | bool                           | bool                            | | bool                              | bool                           | bool                            |
 | bvec2/bvec3/bvec4                 | bool2/bool3/bool4              | bool2/bool3/bool4            |    | | bvec2/bvec3/bvec4                 | bool2/bool3/bool4              | bool2/bool3/bool4            |    |
-| lowp float                        | min10float                                                  少なくても 10bit fixed 以上 | +| lowp float                        | min10float                     --                           | 10bit fixed 以上 | 
-| mediump float                     | half (min16float)              | half                         少なくても 16bit fp 以上 |+| mediump float                     | half (min16float)              | half                         | 16bit fp 以上  |
 | highp float                       | float                          | float                        | 32bit fp  | | highp float                       | float                          | float                        | 32bit fp  |
-| double                            | double                                                      | 64bit fp  | +| double                            | double                         --                           | 64bit fp  | 
-| highp int                         | int                            | int                          | 32bit int  | +| highp int / uint                  | int / uint                     | int / uint                   | 32bit int  | 
-highp uint                        uint                           uint                         32bit unsigned int  | +mediump int / uint                min16int / min16uint           short / ushort               16bit int 以上  | 
-mediump int                       min16int                       | short                        16bit int  |+lowp int  / uint                  min12int                       | --                           9bit int 以上  
 +| --                                | --                             | char / uchar                 | 8bit int   |
 | vec3 x= vec3( a, b, c );          | float3 x= { a, b, c };         | float3 x= { a, b, c };       | | 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 ); |    | | :::                               | 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 };        | | float x[3]= float[]( a, b, c );   | float x[3]= { a, b, c };       | float x[3]= { a, b, c };        |
-| type( x )                         | (type)x                        | (type)x                      | cast  |+| type( x )                         | (type)x                        | (type)x, type(x)             | cast  |
 | matrix * matrix                   | mul( matrix, matrix )          | matrix * matrix              |    | | matrix * matrix                   | mul( matrix, matrix )          | matrix * matrix              |    |
 | vector * matrix                   | mul( vector, matrix )          | vecotr * matrix              |    | | vector * matrix                   | mul( vector, matrix )          | vecotr * matrix              |    |
-| uniform                           | (uniform)                      | (constant)                   |    | +| uniform                           | (uniform)                      | constant                     |    | 
-| in/out , varying/attribute        | (: semantics)                  | [[qualifier]]                | HLSL は in/out に function の引数と戻り値を使う。   | +| in/out , varying/attribute        | var : semantics                <nowiki>var [[qualifier]]</nowiki>  | HLSL は in/out に function の引数と戻り値を使う。   | 
-| builtin gl_* variables            | system semantics SV_*          | [[qualifier]]                |    |+| builtin gl_* variables            | system semantics SV_*          | <nowiki>var [[qualifier]]</nowiki>  |    | 
 + 
 + 
  
  
行 38: 行 47:
  
  
-^ GLSL                        ^ HLSL                          ^ +^ GLSL                        ^ HLSL                       ^ Metal                      ^    ^ 
-| inversesqrt( x )            | rsqrt( x )                 | 1/sqrt( x ) | +| inversesqrt( x )            | rsqrt( x )                 | rsqrt( x )                 | 1/sqrt( x ) | 
-| mix( x, y, s )              | lerp( x, y, s )            |    | +| mix( x, y, s )              | lerp( x, y, s )            | mix( x, y, s )             |    | 
-| clamp( x, min, max )        | clamp( x, min, max  )      |    | +| clamp( x, min, max )        | clamp( x, min, max  )      | clamp( x, min, max )       |    | 
-| clamp( x, 0.0, 1.0  )       | saturate( x )              |    | +| clamp( x, 0.0, 1.0  )       | saturate( x )              | saturate( x )              |    | 
-| step( edge, x )             | step( edge, x )            | x < edge ? 0.0 : 1.0 | +| step( edge, 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 ) |+| smoothstep( min, max, x )   | smoothstep( min, max, x )  | smoothstep( min, max, x )  | clamp( (x-min) / (max-min), 0.0, 1.0 ) |
  
  
  
 +^ GLSL                                       ^ HLSL                                  ^ Metal                                    ^                 ^
 +| sampler2D samplerobj                       | Texture2D<type> texobj                | texture2d<type> texobj                   | sampler type    |
 +| sampler2DShadow depthobj                   | Texture2D<type> depthobj              | depth2d<type> depthobj                   | sampler type    |
 +| 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  |
  
-^ GLSL                                       ^ HLSL                                  ^                 ^ 
-| sampler2D samplerobj                       | Texture2D<type> textureobj            | sampler type    | 
-| sampler2DShadow shadowobj                  | Texture2D<type> shadowobj             | sampler type    | 
-| 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;                   | uint var_name : SV_VertexID ;                  | 
-| :::     | in int gl_InstanceID;                 | uint var_name : SV_InstanceID ;                | 
-| fsh/psh | out vec4 color; (GL2: gl_FragColor)   | float4  ... : SV_Target ; (DX9: COLOR)  |        | 
-|  :::    | out float gl_FragDepth;               | float ... : SV_Depth ; (DX9: DEPTH)            | 
  
 +^ shader  ^ GLSL                                  ^ HLSL                                    ^ Metal                           ^
 +| vsh     | in int gl_VertexID;                   | uint var_name : SV_VertexID ;           | <nowiki>uint var_name [[vertex_id]];</nowiki>    |
 +| :::     | in int gl_InstanceID;                 | uint var_name : SV_InstanceID ;         | <nowiki>uint var_name [[instance_id]];</nowiki>  |
 +| :::     | out vec4 gl_Position;                 | float4 ... : SV_Position ;              | <nowiki>float4 ... [[position]];</nowiki>    |
 +| fsh/psh | out vec4 color; (GL2: gl_FragColor)   | float4  ... : SV_Target ; (DX9: COLOR)  | <nowiki>half4 ... [[color(0)]];</nowiki>     |
 +|  :::    | out float gl_FragDepth;               | float ... : SV_Depth ; (DX9: DEPTH)     | <nowiki>float ... [[depth(less)]];</nowiki>  |
  
  
opengl/glsl_hlsl.1404286468.txt.gz · 最終更新: 2014/07/02 16:34 (外部編集)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki