[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] maximum varying vectors / uniforms etc.

On Tue, Aug 3, 2010 at 4:36 PM, Mark Callow <callow_mark@hicorp.co.jp> wrote:
Hi Gregg,

As I wrote on this topic, what feels like several months ago, MAX_VARYING_FLOATS is deprecated. The translator should do

I mis-stated.

The translator does not look up these values. It expects them to be passed in by whatever code uses it so if that code is running on OpenGL then it uses certain code. If it's running on OpenGL ES 2.0 it uses different code. It's up to the particular implementation to figure out what's appropriate for it's own platform/s

#define MIN(x,y) x > y ? y : x

  glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, &max_vertex_output_comps);
  glGetIntegerv(GL_MAX_FRAGMENT_INPUT_COMPONENTS, &max_fragment_input_comps);
  max_varying_vectors_  = MIN(max_vertex_output_comps, max_fragment_input_comps) / 4;

Most of the WebGL implementations are running on top of OpenGL 2.1  These constants don't appear to exist in OpenGL 2.1.  Am I missing something? Should these constants be used on OpenGL 2.1 or are we talking about some other OpenGL version?



On 2010/07/30 9:25, Gregg Tavares (wrk) wrote:

Coincidently I was going to post a similar question with regards to gl_MaxVertexUniformVectors, gl_MaxFragmentUniformVectors and gl_MaxVaryingVectors ; they do not exist on GL desktop so I guess a GLSL ES to GLSL validator/translator needs to do something here.

Should the translator replace references to those with a literal value as in ES 2.0 spec (ie. 256, 256 and 15 respectively) or use a calculated value using the desktop's gl_Max**Components* with some formula to find the **Vector* equivalent ?

The translator already does this and uses values queried from GL

      GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_fragment_uniform_vectors_);
  max_fragment_uniform_vectors_ /= 4;

  glGetIntegerv(GL_MAX_VARYING_FLOATS, &max_varying_vectors_);
  max_varying_vectors_ /= 4;

  glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_vertex_uniform_vectors_);
  max_vertex_uniform_vectors_ /= 4;