message: Tweaked graphics to share one default shader
diff: @@ -12,8 +12,7 @@ import { hex2rgb } from '@pixi/utils';
  import { Mesh } from '@pixi/mesh';
  import { Texture,
  Shader,
  - UniformGroup,
  - generateMultiTextureShader } from '@pixi/core';
  + UniformGroup } from '@pixi/core';
  import FillStyle from './styles/FillStyle';
  import GraphicsGeometry from './GraphicsGeometry';
  import LineStyle from './styles/LineStyle';
  @@ -24,6 +23,11 @@ import Star from './utils/Star';
  const temp = new Float32Array(3);
  +/**
  + * a default shader used by graphics..
  + */
  +let defaultShader = null;
  +
  /**
  * The Graphics class contains methods used to draw primitive shapes such as lines, circles and
  * rectangles to the display, and to color and fill them.
  @@ -842,12 +846,11 @@ export default class Graphics extends Mesh
  // no batching...
  renderer.batch.flush();
  - const s = renderer.plugins.batch.shader;
  -
  - // lets only create a shader if we need to..
  - this.shader = generateMultiTextureShader(renderer.gl, renderer.plugins.batch.MAX_TEXTURES);
  -
  if (!this.shader)
  + {
  + // if there is no shader here, we can use the default shader.
  + // and that only gets created if we actually need it..
  + if (!defaultShader)
  {
  const sampleValues = new Int32Array(16);
  @@ -862,20 +865,17 @@ export default class Graphics extends Mesh
  default: UniformGroup.from({ uSamplers: sampleValues }, true),
  };
  - this.shader = new Shader(s.program, uniforms);
  + // we can bbase default shader of the batch renderers program
  + const program = renderer.plugins.batch.shader.program;
  +
  + defaultShader = new Shader(program, uniforms);
  }
  - // apply the tint..
  - const tint = this.shader.uniforms.tint;
  - const hexTint = this.tint;
  - const wa = this.worldAlpha;
  + this.shader = defaultShader;
  + }
  - tint[0] = (((hexTint >> 16) & 0xFF) / 255) * wa;
  - tint[1] = (((hexTint >> 8) & 0xFF) / 255) * wa;
  - tint[2] = ((hexTint & 0xFF) / 255) * wa;
  - tint[3] = wa;
  + this.shader.uniforms.translationMatrix = this.transform.worldTransform;
  - this.shader.uniforms.translationMatrix = this.transform.worldTransform;// .toArray(true);
  // the first draw call, we can set the uniforms of the shader directly here.
  // this means that we can tack advantage of the sync function of pixi!
  