Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

4D vector

From Wikipedia, the free encyclopedia
4-component vector data type in computer science
Not to be confused withfour-vector.

Incomputer science, a4D vector is a 4-componentvectordata type. Uses includehomogeneous coordinates for3-dimensional space incomputer graphics, andred green blue alpha (RGBA) values forbitmap images with a color andalpha channel (as such they are widely used in computer graphics). They may also representquaternions (useful for rotations) although the algebra they define is different.

Computer hardware support

[edit]

Somemicroprocessors have hardware support for 4D vectors with instructions dealing with 4lanesingle instruction, multiple data (SIMD) instructions, usually with a128-bit data path and32-bit floating point fields.[1]

Specific instructions (e.g., 4 elementdot product) may facilitate the use of one 128-bit register to represent a 4D vector. For example, in chronological order:Hitachi SH4,PowerPC VMX128 extension,[2] and Intelx86 SSE4.[3]

Some 4-element vector engines (e.g., thePS2 vector units) went further with the ability to broadcast components as multiply sources, andcross product support.[4][5] Earlier generations ofgraphics processing unit (GPU) shader pipelines usedvery long instruction word (VLIW)instruction sets tailored for similar operations.

Software support

[edit]

SIMD use for 4D vectors can be conveniently wrapped in avector maths library (commonly implemented inC orC++)[6][7][8] commonly used invideo game development, along with4×4 matrix support. These are distinct from more generallinear algebra libraries in other domains focussing onmatrices of arbitrary size. Such libraries sometimes support 3D vectors padded to 4D or loading 3D data into 4D registers, with arithmetic mapped efficiently to SIMD operations by per platformintrinsic function implementations. There is choice betweenAOS and SOA approaches given the availability of 4 element registers, versus SIMD instructions that are usually tailored toward homogenous data.

Shading languages forgraphics processing unit (GPU) programming usually have a 4D datatypes (along with 2D, 3D) with x-y-z-w accessors includingpermutes orswizzle access, e.g., allowing easy swapping of RGBA or ARGB formats, accessing two 2D vectors packed into one 4D vector, etc.[9] Modern GPUs have since moved to scalarsingle instruction, multiple threads (SIMT) pipelines (for more efficiency ingeneral-purpose computing on graphics processing units (GPGPU)) but still support this programming model.[10]

See also

[edit]

References

[edit]
  1. ^"intel SSE intrinsics".
  2. ^"Putting It All Together: Anatomy of the XBox 360 Game Console (see VMX128 dot product)"(PDF).
  3. ^"intel SSE4 dot product".
  4. ^"VU0 user manual"(PDF).
  5. ^"feasibility study on using the playstation 2 for scientific computing"(PDF).
  6. ^"sce vectormath".GitHub. 19 April 2022.
  7. ^"GLM (vector maths library)".
  8. ^"Microsoft DirectX Maths".
  9. ^"GLSL data types & swizzling".
  10. ^"AMD graphics core next".
Retrieved from "https://en.wikipedia.org/w/index.php?title=4D_vector&oldid=1229841501"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp