mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Uses vertex streams to get attribute locations reducing duplication in XML.
Also adds missing streams. This was SVN commit r26792.
This commit is contained in:
parent
37645670c1
commit
eaac0b0dbe
33 changed files with 270 additions and 325 deletions
|
|
@ -2,10 +2,8 @@
|
|||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/canvas2d.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/canvas2d.fs"/>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/cas.fs"/>
|
||||
<fragment file="glsl/cas.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/fxaa.fs"/>
|
||||
<fragment file="glsl/fxaa.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -46,28 +46,7 @@
|
|||
<element name="vertex">
|
||||
<attribute name="file"><text/></attribute>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<element name="attrib">
|
||||
<ref name="conditional"/>
|
||||
<attribute name="name"><text/></attribute>
|
||||
<attribute name="semantics">
|
||||
<choice>
|
||||
<value>gl_Vertex</value>
|
||||
<value>gl_Normal</value>
|
||||
<value>gl_Color</value>
|
||||
<value>gl_MultiTexCoord0</value>
|
||||
<value>gl_MultiTexCoord1</value>
|
||||
<value>gl_MultiTexCoord2</value>
|
||||
<value>gl_MultiTexCoord3</value>
|
||||
<value>gl_MultiTexCoord4</value>
|
||||
<value>gl_MultiTexCoord5</value>
|
||||
<value>gl_MultiTexCoord6</value>
|
||||
<value>gl_MultiTexCoord7</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</element>
|
||||
<ref name="streamContent"/>
|
||||
</choice>
|
||||
<ref name="streamContent"/>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
|
||||
|
|
@ -115,8 +94,15 @@
|
|||
<value>uv1</value>
|
||||
<value>uv2</value>
|
||||
<value>uv3</value>
|
||||
<value>uv4</value>
|
||||
<value>uv5</value>
|
||||
<value>uv6</value>
|
||||
<value>uv7</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="attribute"><text/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/bloom.fs"/>
|
||||
<fragment file="glsl/bloom.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/debug_overlay.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0" if="DEBUG_TEXTURED"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0" if="DEBUG_TEXTURED"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/debug_overlay.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0" if="DEBUG_TEXTURED"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/debug_overlay.fs"/>
|
||||
<fragment file="glsl/debug_overlay.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/dof.fs"/>
|
||||
<fragment file="glsl/dof.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/dummy.vs">
|
||||
<stream name="pos"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/dummy.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/dummy.fs"/>
|
||||
<fragment file="glsl/dummy.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/foreground_overlay.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/foreground_overlay.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/foreground_overlay.fs"/>
|
||||
<fragment file="glsl/foreground_overlay.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/simple.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/hdr.fs"/>
|
||||
<fragment file="glsl/hdr.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/los_interp.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/los_interp.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/los_interp.fs"/>
|
||||
<fragment file="glsl/los_interp.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/minimap.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0" if="MINIMAP_BASE || MINIMAP_LOS || MINIMAP_MASK"/>
|
||||
<stream name="color" if="MINIMAP_POINT"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0" if="MINIMAP_BASE || MINIMAP_LOS || MINIMAP_MASK"/>
|
||||
<attrib name="a_color" semantics="gl_Color" if="MINIMAP_POINT"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/minimap.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0" if="MINIMAP_BASE || MINIMAP_LOS || MINIMAP_MASK"/>
|
||||
<stream name="color" attribute="a_color" if="MINIMAP_POINT"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/minimap.fs"/>
|
||||
<fragment file="glsl/minimap.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="normal"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1" if="USE_AO"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_normal" semantics="gl_Normal"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1" if="USE_AO"/>
|
||||
<attrib name="a_skinJoints" semantics="gl_MultiTexCoord4" if="USE_GPU_SKINNING"/>
|
||||
<attrib name="a_skinWeights" semantics="gl_MultiTexCoord5" if="USE_GPU_SKINNING"/>
|
||||
<attrib name="a_tangent" semantics="gl_MultiTexCoord6" if="USE_INSTANCING || USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1" if="USE_AO"/>
|
||||
<stream name="uv2" attribute="a_skinJoints" if="USE_GPU_SKINNING"/>
|
||||
<stream name="uv3" attribute="a_skinWeights" if="USE_GPU_SKINNING"/>
|
||||
<stream name="uv4" attribute="a_tangent" if="USE_INSTANCING || USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/model_common.fs"/>
|
||||
<fragment file="glsl/model_common.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_skinJoints" semantics="gl_MultiTexCoord4" if="USE_GPU_SKINNING"/>
|
||||
<attrib name="a_skinWeights" semantics="gl_MultiTexCoord5" if="USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv2" attribute="a_skinJoints" if="USE_GPU_SKINNING"/>
|
||||
<stream name="uv3" attribute="a_skinWeights" if="USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/solid.fs"/>
|
||||
<fragment file="glsl/solid.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_skinJoints" semantics="gl_MultiTexCoord4" if="USE_GPU_SKINNING"/>
|
||||
<attrib name="a_skinWeights" semantics="gl_MultiTexCoord5" if="USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv2" attribute="a_skinJoints" if="USE_GPU_SKINNING"/>
|
||||
<stream name="uv3" attribute="a_skinWeights" if="USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/solid_player.fs"/>
|
||||
<fragment file="glsl/solid_player.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_skinJoints" semantics="gl_MultiTexCoord4" if="USE_GPU_SKINNING"/>
|
||||
<attrib name="a_skinWeights" semantics="gl_MultiTexCoord5" if="USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/model_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv2" attribute="a_skinJoints" if="USE_GPU_SKINNING"/>
|
||||
<stream name="uv3" attribute="a_skinWeights" if="USE_GPU_SKINNING"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/solid_tex.fs"/>
|
||||
<fragment file="glsl/solid_tex.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/model_water.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="normal"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1" if="USE_AO"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_normal" semantics="gl_Normal"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1" if="USE_AO"/>
|
||||
<attrib name="a_tangent" semantics="gl_MultiTexCoord4" if="USE_INSTANCING"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/model_water.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1" if="USE_AO"/>
|
||||
<stream name="uv4" attribute="a_tangent" if="USE_INSTANCING"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/model_water.fs"/>
|
||||
<fragment file="glsl/model_water.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/model_waterfall.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="normal"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_normal" semantics="gl_Normal"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1"/>
|
||||
<attrib name="a_tangent" semantics="gl_MultiTexCoord4" if="USE_INSTANCING"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/model_waterfall.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1"/>
|
||||
<stream name="uv4" attribute="a_tangent" if="USE_INSTANCING"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/model_waterfall.fs"/>
|
||||
<fragment file="glsl/model_waterfall.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
<vertex file="glsl/overlay_solid.vs">
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
</vertex>
|
||||
<fragment file="glsl/overlay_solid.fs"/>
|
||||
<vertex file="glsl/overlay_solid.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
</vertex>
|
||||
<fragment file="glsl/overlay_solid.fs"/>
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/overlayline.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="color" if="!USE_OBJECTCOLOR"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_color" semantics="gl_Color" if="!USE_OBJECTCOLOR"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/overlayline.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="color" attribute="a_color" if="!USE_OBJECTCOLOR"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/overlayline.fs"/>
|
||||
<fragment file="glsl/overlayline.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/particle.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="color"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_color" semantics="gl_Color"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/particle.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="color" attribute="a_color"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/particle.fs"/>
|
||||
<fragment file="glsl/particle.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/particle.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="color"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_color" semantics="gl_Color"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/particle.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="color" attribute="a_color"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/particle.fs"/>
|
||||
<fragment file="glsl/particle.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/sky.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/sky.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/sky.fs"/>
|
||||
<fragment file="glsl/sky.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/solid.vs">
|
||||
<stream name="pos"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/solid.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/solid.fs"/>
|
||||
<fragment file="glsl/solid.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/terrain_common.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1" if="BLEND"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_normal" semantics="gl_Normal"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1" if="BLEND"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/terrain_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1" if="BLEND"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/terrain_common.fs"/>
|
||||
<fragment file="glsl/terrain_common.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<define name="BLEND" value="1"/>
|
||||
<define name="BLEND" value="1"/>
|
||||
|
||||
<vertex file="glsl/terrain_common.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<stream name="uv1"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
<attrib name="a_uv1" semantics="gl_MultiTexCoord1"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/terrain_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_uv1"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/terrain_common.fs"/>
|
||||
<fragment file="glsl/terrain_common.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<define name="DECAL" value="1"/>
|
||||
<define name="DECAL" value="1"/>
|
||||
|
||||
<vertex file="glsl/terrain_common.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="normal"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_normal" semantics="gl_Normal"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/terrain_common.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/terrain_common.fs"/>
|
||||
<fragment file="glsl/terrain_common.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/water_high.vs">
|
||||
<stream name="pos"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
<attrib name="a_waterInfo" semantics="gl_MultiTexCoord4"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/water_high.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
<stream name="uv1" attribute="a_waterInfo"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/water_high.fs"/>
|
||||
<fragment file="glsl/water_high.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/water_simple.vs">
|
||||
<stream name="pos"/>
|
||||
<attrib name="a_vertex" semantics="gl_Vertex"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/water_simple.vs">
|
||||
<stream name="pos" attribute="a_vertex"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/water_simple.fs"/>
|
||||
<fragment file="glsl/water_simple.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<program type="glsl">
|
||||
|
||||
<vertex file="glsl/waves.vs">
|
||||
<stream name="pos"/>
|
||||
<stream name="uv0"/>
|
||||
<attrib name="a_basePosition" semantics="gl_Vertex"/>
|
||||
<attrib name="a_apexPosition" semantics="gl_MultiTexCoord4"/>
|
||||
<attrib name="a_splashPosition" semantics="gl_MultiTexCoord5"/>
|
||||
<attrib name="a_retreatPosition" semantics="gl_MultiTexCoord6"/>
|
||||
<attrib name="a_normal" semantics="gl_Normal"/>
|
||||
<attrib name="a_uv0" semantics="gl_MultiTexCoord0"/>
|
||||
</vertex>
|
||||
<vertex file="glsl/waves.vs">
|
||||
<stream name="pos" attribute="a_basePosition"/>
|
||||
<stream name="normal" attribute="a_normal"/>
|
||||
<stream name="uv0" attribute="a_uv0"/>
|
||||
<stream name="uv1" attribute="a_apexPosition"/>
|
||||
<stream name="uv2" attribute="a_splashPosition"/>
|
||||
<stream name="uv3" attribute="a_retreatPosition"/>
|
||||
</vertex>
|
||||
|
||||
<fragment file="glsl/waves.fs"/>
|
||||
<fragment file="glsl/waves.fs"/>
|
||||
|
||||
</program>
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ void InstancingModelRenderer::UpdateModelData(CModel* UNUSED(model), CModelRData
|
|||
// Setup one rendering pass.
|
||||
void InstancingModelRenderer::BeginPass(int streamflags)
|
||||
{
|
||||
ENSURE(streamflags == (streamflags & (STREAM_POS|STREAM_NORMAL|STREAM_UV0|STREAM_UV1)));
|
||||
ENSURE(streamflags == (streamflags & (STREAM_POS|STREAM_NORMAL|STREAM_UV0|STREAM_UV1|STREAM_UV2|STREAM_UV3|STREAM_UV4)));
|
||||
}
|
||||
|
||||
// Cleanup rendering pass.
|
||||
|
|
@ -345,8 +345,7 @@ void InstancingModelRenderer::PrepareModelDef(
|
|||
GL_FALSE, stride, base + m->imodeldef->m_Tangent.offset);
|
||||
}
|
||||
|
||||
// The last UV set is STREAM_UV3
|
||||
for (size_t uv = 0; uv < 4; ++uv)
|
||||
for (size_t uv = 0; uv < 2; ++uv)
|
||||
if (streamflags & (STREAM_UV0 << uv))
|
||||
{
|
||||
if (def.GetNumUVsPerVertex() >= uv + 1)
|
||||
|
|
|
|||
|
|
@ -100,41 +100,47 @@ GLenum GLTypeFromFormat(const Renderer::Backend::Format format)
|
|||
return type;
|
||||
}
|
||||
|
||||
int ParseAttribSemantics(Renderer::Backend::GL::CDevice* device, const CStr& str)
|
||||
int GetAttributeLocationFromStream(Renderer::Backend::GL::CDevice* device, const int stream)
|
||||
{
|
||||
// Old mapping makes sense only if we have an old/low-end hardware. Else we
|
||||
// need to use sequential numbering to fix #3054. We use presence of
|
||||
// compute shaders as a check that the hardware has universal CUs.
|
||||
if (device->GetCapabilities().computeShaders)
|
||||
{
|
||||
if (str == "gl_Vertex") return 0;
|
||||
if (str == "gl_Normal") return 1;
|
||||
if (str == "gl_Color") return 2;
|
||||
if (str == "gl_MultiTexCoord0") return 3;
|
||||
if (str == "gl_MultiTexCoord1") return 4;
|
||||
if (str == "gl_MultiTexCoord2") return 5;
|
||||
if (str == "gl_MultiTexCoord3") return 6;
|
||||
if (str == "gl_MultiTexCoord4") return 7;
|
||||
if (str == "gl_MultiTexCoord5") return 8;
|
||||
if (str == "gl_MultiTexCoord6") return 9;
|
||||
if (str == "gl_MultiTexCoord7") return 10;
|
||||
switch (stream)
|
||||
{
|
||||
case STREAM_POS: return 0;
|
||||
case STREAM_NORMAL: return 1;
|
||||
case STREAM_COLOR: return 2;
|
||||
case STREAM_UV0: return 3;
|
||||
case STREAM_UV1: return 4;
|
||||
case STREAM_UV2: return 5;
|
||||
case STREAM_UV3: return 6;
|
||||
case STREAM_UV4: return 7;
|
||||
case STREAM_UV5: return 8;
|
||||
case STREAM_UV6: return 9;
|
||||
case STREAM_UV7: return 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Map known semantics onto the attribute locations documented by NVIDIA:
|
||||
// https://download.nvidia.com/developer/Papers/2005/OpenGL_2.0/NVIDIA_OpenGL_2.0_Support.pdf
|
||||
// https://developer.download.nvidia.com/opengl/glsl/glsl_release_notes.pdf
|
||||
if (str == "gl_Vertex") return 0;
|
||||
if (str == "gl_Normal") return 2;
|
||||
if (str == "gl_Color") return 3;
|
||||
if (str == "gl_MultiTexCoord0") return 8;
|
||||
if (str == "gl_MultiTexCoord1") return 9;
|
||||
if (str == "gl_MultiTexCoord2") return 10;
|
||||
if (str == "gl_MultiTexCoord3") return 11;
|
||||
if (str == "gl_MultiTexCoord4") return 12;
|
||||
if (str == "gl_MultiTexCoord5") return 13;
|
||||
if (str == "gl_MultiTexCoord6") return 14;
|
||||
if (str == "gl_MultiTexCoord7") return 15;
|
||||
switch (stream)
|
||||
{
|
||||
case STREAM_POS: return 0;
|
||||
case STREAM_NORMAL: return 2;
|
||||
case STREAM_COLOR: return 3;
|
||||
case STREAM_UV0: return 8;
|
||||
case STREAM_UV1: return 9;
|
||||
case STREAM_UV2: return 10;
|
||||
case STREAM_UV3: return 11;
|
||||
case STREAM_UV4: return 12;
|
||||
case STREAM_UV5: return 13;
|
||||
case STREAM_UV6: return 14;
|
||||
case STREAM_UV7: return 15;
|
||||
}
|
||||
}
|
||||
|
||||
debug_warn("Invalid attribute semantics");
|
||||
|
|
@ -815,6 +821,7 @@ public:
|
|||
const GLint size = GLSizeFromFormat(format);
|
||||
const GLenum type = GLTypeFromFormat(format);
|
||||
glVertexAttribPointer(it->second, size, type, normalized, stride, pointer);
|
||||
m_ValidStreams |= STREAM_UV0 << (it->second - (m_Device->GetCapabilities().computeShaders ? 3 : 8));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -875,17 +882,16 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
|||
// Define all the elements and attributes used in the XML file
|
||||
#define EL(x) int el_##x = XeroFile.GetElementID(#x)
|
||||
#define AT(x) int at_##x = XeroFile.GetAttributeID(#x)
|
||||
EL(attrib);
|
||||
EL(define);
|
||||
EL(fragment);
|
||||
EL(stream);
|
||||
EL(uniform);
|
||||
EL(vertex);
|
||||
AT(attribute);
|
||||
AT(file);
|
||||
AT(if);
|
||||
AT(loc);
|
||||
AT(name);
|
||||
AT(semantics);
|
||||
AT(type);
|
||||
AT(value);
|
||||
#undef AT
|
||||
|
|
@ -904,72 +910,86 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
|||
std::map<CStrIntern, int> vertexAttribs;
|
||||
int streamFlags = 0;
|
||||
|
||||
XERO_ITER_EL(root, Child)
|
||||
XERO_ITER_EL(root, child)
|
||||
{
|
||||
if (Child.GetNodeName() == el_define)
|
||||
if (child.GetNodeName() == el_define)
|
||||
{
|
||||
defines.Add(CStrIntern(Child.GetAttributes().GetNamedItem(at_name)), CStrIntern(Child.GetAttributes().GetNamedItem(at_value)));
|
||||
defines.Add(CStrIntern(child.GetAttributes().GetNamedItem(at_name)), CStrIntern(child.GetAttributes().GetNamedItem(at_value)));
|
||||
}
|
||||
else if (Child.GetNodeName() == el_vertex)
|
||||
else if (child.GetNodeName() == el_vertex)
|
||||
{
|
||||
vertexFile = L"shaders/" + Child.GetAttributes().GetNamedItem(at_file).FromUTF8();
|
||||
vertexFile = L"shaders/" + child.GetAttributes().GetNamedItem(at_file).FromUTF8();
|
||||
|
||||
XERO_ITER_EL(Child, Param)
|
||||
XERO_ITER_EL(child, param)
|
||||
{
|
||||
XMBAttributeList Attrs = Param.GetAttributes();
|
||||
XMBAttributeList attributes = param.GetAttributes();
|
||||
|
||||
CStr cond = Attrs.GetNamedItem(at_if);
|
||||
CStr cond = attributes.GetNamedItem(at_if);
|
||||
if (!cond.empty() && !preprocessor.TestConditional(cond))
|
||||
continue;
|
||||
|
||||
if (Param.GetNodeName() == el_uniform)
|
||||
if (param.GetNodeName() == el_uniform)
|
||||
{
|
||||
vertexUniforms[CStrIntern(Attrs.GetNamedItem(at_name))] = Attrs.GetNamedItem(at_loc).ToInt();
|
||||
vertexUniforms[CStrIntern(attributes.GetNamedItem(at_name))] = attributes.GetNamedItem(at_loc).ToInt();
|
||||
}
|
||||
else if (Param.GetNodeName() == el_stream)
|
||||
else if (param.GetNodeName() == el_stream)
|
||||
{
|
||||
CStr StreamName = Attrs.GetNamedItem(at_name);
|
||||
if (StreamName == "pos")
|
||||
streamFlags |= STREAM_POS;
|
||||
else if (StreamName == "normal")
|
||||
streamFlags |= STREAM_NORMAL;
|
||||
else if (StreamName == "color")
|
||||
streamFlags |= STREAM_COLOR;
|
||||
else if (StreamName == "uv0")
|
||||
streamFlags |= STREAM_UV0;
|
||||
else if (StreamName == "uv1")
|
||||
streamFlags |= STREAM_UV1;
|
||||
else if (StreamName == "uv2")
|
||||
streamFlags |= STREAM_UV2;
|
||||
else if (StreamName == "uv3")
|
||||
streamFlags |= STREAM_UV3;
|
||||
}
|
||||
else if (Param.GetNodeName() == el_attrib)
|
||||
{
|
||||
const int attribLoc = ParseAttribSemantics(device, Attrs.GetNamedItem(at_semantics));
|
||||
vertexAttribs[CStrIntern(Attrs.GetNamedItem(at_name))] = attribLoc;
|
||||
const CStr streamName = attributes.GetNamedItem(at_name);
|
||||
const CStr attributeName = attributes.GetNamedItem(at_attribute);
|
||||
if (attributeName.empty())
|
||||
LOGERROR("Empty attribute name in vertex shader description '%s'", vertexFile.string8().c_str());
|
||||
|
||||
int stream = 0;
|
||||
if (streamName == "pos")
|
||||
stream = STREAM_POS;
|
||||
else if (streamName == "normal")
|
||||
stream = STREAM_NORMAL;
|
||||
else if (streamName == "color")
|
||||
stream = STREAM_COLOR;
|
||||
else if (streamName == "uv0")
|
||||
stream = STREAM_UV0;
|
||||
else if (streamName == "uv1")
|
||||
stream = STREAM_UV1;
|
||||
else if (streamName == "uv2")
|
||||
stream = STREAM_UV2;
|
||||
else if (streamName == "uv3")
|
||||
stream = STREAM_UV3;
|
||||
else if (streamName == "uv4")
|
||||
stream = STREAM_UV4;
|
||||
else if (streamName == "uv5")
|
||||
stream = STREAM_UV5;
|
||||
else if (streamName == "uv6")
|
||||
stream = STREAM_UV6;
|
||||
else if (streamName == "uv7")
|
||||
stream = STREAM_UV7;
|
||||
else
|
||||
LOGERROR("Unknown stream '%s' in vertex shader description '%s'", streamName.c_str(), vertexFile.string8().c_str());
|
||||
|
||||
const int attributeLocation = GetAttributeLocationFromStream(device, stream);
|
||||
vertexAttribs[CStrIntern(attributeName)] = attributeLocation;
|
||||
streamFlags |= stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Child.GetNodeName() == el_fragment)
|
||||
else if (child.GetNodeName() == el_fragment)
|
||||
{
|
||||
fragmentFile = L"shaders/" + Child.GetAttributes().GetNamedItem(at_file).FromUTF8();
|
||||
fragmentFile = L"shaders/" + child.GetAttributes().GetNamedItem(at_file).FromUTF8();
|
||||
|
||||
XERO_ITER_EL(Child, Param)
|
||||
XERO_ITER_EL(child, param)
|
||||
{
|
||||
XMBAttributeList Attrs = Param.GetAttributes();
|
||||
XMBAttributeList attributes = param.GetAttributes();
|
||||
|
||||
CStr cond = Attrs.GetNamedItem(at_if);
|
||||
CStr cond = attributes.GetNamedItem(at_if);
|
||||
if (!cond.empty() && !preprocessor.TestConditional(cond))
|
||||
continue;
|
||||
|
||||
if (Param.GetNodeName() == el_uniform)
|
||||
if (param.GetNodeName() == el_uniform)
|
||||
{
|
||||
// A somewhat incomplete listing, missing "shadow" and "rect" versions
|
||||
// which are interpreted as 2D (NB: our shadowmaps may change
|
||||
// type based on user config).
|
||||
GLenum type = GL_TEXTURE_2D;
|
||||
CStr t = Attrs.GetNamedItem(at_type);
|
||||
const CStr t = attributes.GetNamedItem(at_type);
|
||||
if (t == "sampler1D")
|
||||
#if CONFIG2_GLES
|
||||
debug_warn(L"sampler1D not implemented on GLES");
|
||||
|
|
@ -987,8 +1007,8 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
|||
else if (t == "samplerCube")
|
||||
type = GL_TEXTURE_CUBE_MAP;
|
||||
|
||||
fragmentUniforms[CStrIntern(Attrs.GetNamedItem(at_name))] =
|
||||
std::make_pair(Attrs.GetNamedItem(at_loc).ToInt(), type);
|
||||
fragmentUniforms[CStrIntern(attributes.GetNamedItem(at_name))] =
|
||||
std::make_pair(attributes.GetNamedItem(at_loc).ToInt(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,11 @@ enum
|
|||
STREAM_UV0 = (1 << 3),
|
||||
STREAM_UV1 = (1 << 4),
|
||||
STREAM_UV2 = (1 << 5),
|
||||
STREAM_UV3 = (1 << 6)
|
||||
STREAM_UV3 = (1 << 6),
|
||||
STREAM_UV4 = (1 << 7),
|
||||
STREAM_UV5 = (1 << 8),
|
||||
STREAM_UV6 = (1 << 9),
|
||||
STREAM_UV7 = (1 << 10),
|
||||
};
|
||||
|
||||
namespace Renderer
|
||||
|
|
|
|||
Loading…
Reference in a new issue