{"id":48,"date":"2007-05-29T09:48:12","date_gmt":"2007-05-29T08:48:12","guid":{"rendered":"http:\/\/www.ozone3d.net\/blogs\/lab\/?p=48"},"modified":"2011-09-07T20:47:23","modified_gmt":"2011-09-07T19:47:23","slug":"glsl-ati-vs-nvidia","status":"publish","type":"post","link":"https:\/\/www.ozone3d.net\/blogs\/lab\/20070529\/glsl-ati-vs-nvidia\/","title":{"rendered":"GLSL: ATI vs NVIDIA"},"content":{"rendered":"<p>Today two new differences between Radeon and Geforce GLSL support.<\/p>\n<p>1 &#8211; float2 \/ vec2<br \/>\n<b>vec2<\/b> is the GLSL type to hold a 2d vector. <b>vec2<\/b> is supported by NVIDIA and ATI. <b>float2<\/b> is a 2d vector but for Direct3D HLSL and for Cg. The GLSL compilation for Geforce is done via the NVIDIA Cg compiler. Here is the GLSL version displayed by <a href=\"http:\/\/www.ozone3d.net\/gpu_caps_viewer\/\">GPU Caps Viewer<\/a>: <b>1.20 NVIDIA via Cg compiler<\/b>. That explains why a GLSL source that contains a <b>float2<\/b> is compilable on NVIDIA hardware. But the GLSL compiler of ATI is strict and doesn&#8217;t recognize the <b>float2<\/b> type. <\/p>\n<p>2 &#8211; the following line:<\/p>\n<pre>\r\nvec2 vec = texture2D( tex, gl_TexCoord[0].st );\r\n<\/pre>\n<p>is valid for NVIDIA compiler but produces an error with ATI compiler. One again, the ATI GLSL compiler has done a good job. By default, <b>texture2D()<\/b> returns a 4d vector. The right syntax is:<\/p>\n<pre>\r\nvec2 vec = texture2D( tex, gl_TexCoord[0].st ).xy;\r\n<\/pre>\n<p>Conclusion: always test your shaders on both ATI and NVIDIA platforms unless you target one platform only. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today two new differences between Radeon and Geforce GLSL support. 1 &#8211; float2 \/ vec2 vec2 is the GLSL type to hold a 2d vector. vec2 is supported by NVIDIA and ATI. float2 is a 2d vector but for Direct3D HLSL and for Cg. The GLSL compilation for Geforce is done via the NVIDIA Cg compiler. Here is the GLSL version displayed by GPU Caps &hellip; <a href=\"https:\/\/www.ozone3d.net\/blogs\/lab\/20070529\/glsl-ati-vs-nvidia\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">GLSL: ATI vs NVIDIA<\/span> <span class=\"meta-nav\">&raquo;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,8],"tags":[22,172,171,18,51,173],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-opengl","category-programming","tag-ati","tag-cg","tag-compiler","tag-glsl","tag-nvidia","tag-texture2d"],"aioseo_notices":[],"views":1641,"_links":{"self":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":0,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}