ShaderModel与ES版本和GPU特性的关系
Opengl版本和功能的对应
OpenGL 4.0 (2010)
Addition | Core Extension |
---|---|
Shading language 4.00 | ARB_texture_query_lod, ARB_gpu_shader5, ARB_gpu_shader_fp64, ARB_shader_subroutine, ARB_texture_gather |
Indirect Drawing, without multidraw | ARB_draw_indirect |
Request minimum number of fragment inputs | ARB_sample_shading |
Tessellation, with shader stages | ARB_tessellation_shader |
Buffer Texture formats RGB32F, RGB32I, RGB32UI | ARB_texture_buffer_object_rgb32 |
Cubemap Array Texture | ARB_texture_cube_map_array |
Transform Feedback objects and multiple feedback stream output. | ARB_transform_feedback2, ARB_transform_feedback3 |
Addition | Promoted from |
Individual blend equations for each color output | ARB_draw_buffers_blend |
OpenGL 3.3 (2010)
Addition | Core Extension |
---|---|
Shading language 3.30 | ARB_shader_bit_encoding |
Dual-source blending. | ARB_blend_func_extended |
Shader-defined locations for attributes and fragment shader outputs. | ARB_explicit_attrib_location |
Simple boolean Occlusion Query | ARB_occlusion_query2 |
Sampler Objects | ARB_sampler_objects |
A new image format for unsigned 10.10.10.2 colors | ARB_texture_rgb10_a2ui |
Texture swizzle | ARB_texture_swizzle |
Timer queries | ARB_timer_query |
Instanced arrays | ARB_instanced_arrays |
Vertex attributes 2.10.10.10 | ARB_vertex_type_2_10_10_10_rev |
OpenGL 3.2 (2009)
- Core and compatibility profiles
- Shading language 1.50
Addition | Core Extension |
---|---|
D3D compatible color vertex component ordering | ARB_vertex_array_bgra |
Drawing command allowing modification of the base vertex index | ARB_draw_elements_base_vertex |
Shader fragment coordinate convention control | ARB_fragment_coord_conventions |
Provoking vertex control | ARB_provoking_vertex |
Seamless cube map filtering | ARB_seamless_cube_map |
Multisampled textures and texture samplers for specific sample locations | ARB_texture_multisample |
Fragment Depth Clamping | ARB_depth_clamp |
Fence sync objects | ARB_sync |
Addition | Promoted from |
Geometry Shaders, as well as input/output Interface Blocks | ARB_geometry_shader4, heavily modified. |
OpenGL 3.1 (2009)
- All features deprecated in OpenGL 3.0 are removed except wide lines
- Shading language 1.40
- SNORM texture component formats
Addition | Core Extension |
---|---|
Uniform Buffer Objects | ARB_uniform_buffer_object |
Addition | Promoted from |
Instanced rendering with a per instance counter accessible to vertex shaders | ARB_draw_instanced |
Data copying between buffer objects | EXT_copy_buffer |
Primitive restart | NV_primitive_restart |
Buffer Textures | ARB_texture_buffer_object |
Rectangle Textures | ARB_texture_rectangle |
Microsoft对ShaderModel的定义
HLSL的ShaderModel主要表示不同版本的Shader支持的语言、功能特性。(The HLSL shader model is a versioning approach indicating which new features are added to the language.
应用和游戏可以针对某个版本通用的功能进行开发,硬件和驱动工程师也可以针对这个版本的特性进行支持。
不同的ShaderModel版本:不同的处理阶段(Geometry etc)、约束、处理能力、向下兼容情况。
- Shader Model 1. This was the first shader model created in DirectX. It introduced vertex and pixel shaders to the first implementation of the programmable pipeline.
- Shader Model 2. Adds new intrinsics and increases limits on registers and instructions.
- Shader Model 3. Adds new intrinsics and increases limits on registers and instructions.
- Shader Model 4. This is a superset of the capabilities in Shader Model 3, except that Shader Model 4 doesn’t support the features in Shader Model 1. It has been designed using a common-shader core that gives a common set of features to all programmable shaders, which are only programmable using HLSL. It adds new shader profiles to target geometry shaders.
- Shader Model 5. This is a superset of shader model 4 and adds new resources, compute shaders and tessellation.
- Shader Model 5.1. This is functionally very similar to Shader Model 5; the main change is more flexibility in resource selection by allowing indexing of arrays of descriptors from within a shader.
- Shader Model 6.0. This is a superset of shader model 5.1 with some deprecated language elements and with the addition of wave intrinsics and 64-bit integers for arithmetic.
- Shader Model 6.1. This is a superset of shader model 6.0 that adds support for SV_ViewID, barycentric semantics and the GetAttributeAtVertex intrinsic.
- Shader Model 6.2. Adds support for float16 (as opposed to minfloat16) and denorm mode selection.
- Shader Model 6.3. Adds support for DirectX Raytracing (DXR), including libraries and linking.
- Shader Model 6.4. Adds low-precision packed dot product intrinsics, and support for library sub-objects to simplify raytracing.
Differences between Direct3D 9 and Direct3D 10: Direct3D 9 introduced shader models 1, 2, and 3. Direct3D 10 introduced shader model 4. Direct3D 10.1 introduced shader model 4.1.
Unity对不同版本的定义
https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html
Here is the list of shader models supported, with roughly increasing set of capabilities (and in some cases higher platform/GPU requirements):
#pragma target 2.0
- Works on all platforms supported by Unity. DX9 shader model 2.0.
- Limited amount of arithmetic & texture instructions; 8 interpolators; no vertex texture sampling; no derivatives in fragment shaders ; no explicit LOD texture sampling.
#pragma target 2.5 (default)
- Almost the same as 3.0 target (see below), except still only has 8 interpolators, and does not have explicit LOD texture sampling.
- Compiles into DX11 feature level 9.3 on Windows Phone.
#pragma target 3.0
- DX9 shader model 3.0: derivative instructions, texture LOD sampling, 10 interpolators, more math/texture instructions allowed.
- Not supported on DX11 feature level 9.x GPUs (e.g. most Windows Phone devices).
- Might not be fully supported by some OpenGL ES 2.0 devices, depending on driver extensions present and features used.
#pragma target 3.5 (or es3.0)
- OpenGL ES 3.0 capabilities (DX10 SM4.0 on D3D platforms, just without geometry shaders).
- Not supported on DX11 9.x (WinPhone), OpenGL ES 2.0.
- Supported on DX11+, OpenGL 3.2+, OpenGL ES 3+, Metal, Vulkan, PS4/XB1 consoles.
- Native integer operations in shaders, texture arrays and so on.
#pragma target 4.0
- DX11 shader model 4.0.
- Not supported on DX11 9.x (WinPhone), OpenGL ES 2.0/3.0/3.1, Metal.
- Supported on DX11+, OpenGL 3.2+, OpenGL ES 3.1+AEP, Vulkan, PS4/XB1 consoles.
- Has geometry shaders and everything that
es3.0
target has.
#pragma target 4.5 (or es3.1)
- OpenGL ES 3.1 capabilities (DX11 SM5.0 on D3D platforms, just without tessellation shaders).
- Not supported on DX11 before SM5.0, OpenGL before 4.3 (i.e. Mac), OpenGL ES 2.0/3.0.
- Supported on DX11+ SM5.0, OpenGL 4.3+, OpenGL ES 3.1, Metal, Vulkan, PS4/XB1 consoles.
- Has compute shaders, random access texture writes, atomics and so on. No geometry or tessellation shaders.
#pragma target 4.6 (or gl4.1)
- OpenGL 4.1 capabilities (DX11 SM5.0 on D3D platforms, just without compute shaders). This is basically the highest OpenGL level supported by Macs.
- Not supported on DX11 before SM5.0, OpenGL before 4.1, OpenGL ES 2.0/3.0/3.1, Metal.
- Supported on DX11+ SM5.0, OpenGL 4.1+, OpenGL ES 3.1+AEP, Vulkan, Metal (without geometry), PS4/XB1 consoles.
#pragma target 5.0
- DX11 shader model 5.0.
- Not supported on DX11 before SM5.0, OpenGL before 4.3 (i.e. Mac), OpenGL ES 2.0/3.0/3.1, Metal.
- Supported on DX11+ SM5.0, OpenGL 4.3+, OpenGL ES 3.1+AEP, Vulkan, Metal (without geometry), PS4/XB1 consoles.