XML shader rework

I’ve reworked XML shader support somewhat in Git.

  • 100% Compatibility with older XML shaders will be maintained.
  • ruby prefix deprecated. No purpose using it anymore.
  • Possible to use no prefix, e.g. instead of rubyTexture, rubyTexCoord, etc, just Texture, TexCoord can be used.
  • Possible to use custom prefix in XML root node: <shader language=“GLSL” style=“GLES” prefix=“foo”>. This will make it fooTexture, fooTexCoord, etc. For compat reasons, “ruby” prefix will be checked for automatically.
  • Legacy shaders (fixed function style) are deprecated, GLES2/GL2 style is preferred.
  • Option is now called video_xml_shader instead of video_bsnes_shader (which hasn’t been correct for quite some time anyways). Phoenix is also updated to reflect this.

Example stock shader:


<?xml version="1.0" encoding="UTF-8"?>
<shader language="GLSL" style="GLES2">
   <vertex><![CDATA[
      attribute vec2 TexCoord;
      attribute vec2 VertexCoord;
      uniform mat4 MVPMatrix;
      varying vec2 tex;
      void main()
      {
         gl_Position = MVPMatrix * vec4(VertexCoord, 0.0, 1.0);
         tex = TexCoord;
      }
   ]]></vertex>
   <fragment><![CDATA[
      varying vec2 tex;
      uniform sampler2D Texture;
      void main()
      {
         gl_FragColor = texture2D(Texture, tex);
      }
   ]]></fragment>
</shader>

2 Likes