glsl: fix uniform location count used for glsl types

Patch fixes the slot count used by vector types and adds 1 slot
to be used by image and sampler types.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82921
glsl: Structures must have same name to be considered same type.

According to GLSL(4.2) and GLSL-ES (1.0, 3.0) spec, Structures must
have the same name to be considered same type. We currently ignore
the name check while checking if two records are same. This patch
fixes this.

Patch fixes failing tests in WebGL conformance test
'shaders-with-uniform-structs' when running Chrome on OpenGL ES.

v2: Do not force name comparison with unnamed types (Tapani)
v3: Cleanups (Matt)

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83934
glsl: remove unused link_assign_uniform_block_offsets

ubo offsets are assigned by link_uniform_blocks since 514f8c7e

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
st/mesa: Use PIPE_USAGE_STAGING for GL_STATIC/DYNAMIC/STREAM_READ buffers

Such buffers can only be useful by reading from them with the CPU, so we
need to make sure CPU reads are fast.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84178
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable@lists.freedesktop.org
ilo: rename ilo_3d.[ch] to ilo_draw.[ch]

There is not much left in struct ilo_3d.  We want to kill it and ilo_3d.[ch]
will be bad names.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: rename ilo_3d_pipeline*.[ch] to ilo_render*.[ch]

They are used to build render engine commands, which can be more than 3D.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: remove struct ilo_3d

Move members of ilo_3d that still make sense to ilo_context.  With ilo_3d
gone, rename functions whose names begin with ilo_3d to something more
appropriate.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: rename 3d_pipeline to render

Follow the file renaming.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: constify ilo_render in ilo_render_get_sample_position()

It is a getter and is not supposed to modify ilo_render.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: rename state buffer to dynamic buffer

Both dynamic buffer and surface buffer are state buffers.  We should not use
state buffer to refer to the former.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: add ilo_builder_{dynamic,surface}_used()

Return how many DWords are used in dynamic and surface buffers respectively.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: simplify ilo_render invalidation

ilo_render is based on ilo_builder.  We should only care if the builder
buffers are invalidated, or if the hardware context is invalidated.  Replace
ilo_render_invalidate() with flags by ilo_render_invalidate_builder() and
ilo_render_invalidate_hw().

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: make ilo_render_emit_flush() direct

Remove emit_flush() and ILO_RENDER_FLUSH indirections.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: make ilo_render_emit_query() direct

Remove emit_query() and ILO_RENDER_QUERY indirections.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: simplify ilo_render_get_query_len()

For all supported query types, we always emit a PIPE_CONTROL.  Call
ilo_render_get_flush_len() for simplicity and clarity.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: sanity check ilo_render_get_*_len()

Assert that we never write more than what ilo_render_get_*_len() returns.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: clean up draw and rectlist state emission

Add these new high-level functions

  ilo_render_get_draw_dynamic_states_len()
  ilo_render_emit_draw_dynamic_states()
  ilo_render_get_rectlist_dynamic_states_len()
  ilo_render_emit_rectlist_dynamic_states()
  ilo_render_get_draw_surface_states_len()
  ilo_render_emit_draw_surface_states()

for draw and rectlist state emission.  They are implemented in the new
ilo_render_dynamic.c and ilo_render_surface.c.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: make ilo_render_emit_rectlist() direct

Remove emit_rectlist() and ILO_RENDER_RECTLIST indirections.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: make ilo_render_emit_draw() direct

Remove emit_draw() and ILO_RENDER_DRAW indirections.  With all emit functions
being direct now, ilo_render_estimate_size() and more can also be removed.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
ilo: make ilo_render opaque

It is not used outside the render code.  There are also too many details in it
that we do not want other components to access directly.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>