aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c12
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_feedback.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_program.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_queryobj.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_rasterpos.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_viewport.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_xformfb.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h4
-rw-r--r--mesalib/src/mesa/state_tracker/st_debug.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c24
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp26
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c255
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.h36
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.h16
27 files changed, 154 insertions, 325 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index 625ea2965..f0fe11ffa 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -26,6 +26,7 @@
**************************************************************************/
+#include <stdio.h>
#include "main/glheader.h"
#include "main/context.h"
@@ -197,7 +198,7 @@ void st_validate_state( struct st_context *st )
memset(&examined, 0, sizeof(examined));
prev = *state;
- for (i = 0; i < Elements(atoms); i++) {
+ for (i = 0; i < ARRAY_SIZE(atoms); i++) {
const struct st_tracked_state *atom = atoms[i];
struct st_state_flags generated;
@@ -228,7 +229,7 @@ void st_validate_state( struct st_context *st )
}
else {
- for (i = 0; i < Elements(atoms); i++) {
+ for (i = 0; i < ARRAY_SIZE(atoms); i++) {
if (check_state(state, &atoms[i]->dirty))
atoms[i]->update( st );
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index f24805cf5..1dbc4b905 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -104,9 +104,9 @@ st_bufferobj_subdata(struct gl_context *ctx,
struct st_buffer_object *st_obj = st_buffer_object(obj);
/* we may be called from VBO code, so double-check params here */
- ASSERT(offset >= 0);
- ASSERT(size >= 0);
- ASSERT(offset + size <= obj->Size);
+ assert(offset >= 0);
+ assert(size >= 0);
+ assert(offset + size <= obj->Size);
if (!size)
return;
@@ -148,9 +148,9 @@ st_bufferobj_get_subdata(struct gl_context *ctx,
struct st_buffer_object *st_obj = st_buffer_object(obj);
/* we may be called from VBO code, so double-check params here */
- ASSERT(offset >= 0);
- ASSERT(size >= 0);
- ASSERT(offset + size <= obj->Size);
+ assert(offset >= 0);
+ assert(size >= 0);
+ assert(offset + size <= obj->Size);
if (!size)
return;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h
index a5ab12219..647efe4cc 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -48,7 +48,7 @@ struct st_buffer_object
/** cast wrapper */
-static INLINE struct st_buffer_object *
+static inline struct st_buffer_object *
st_buffer_object(struct gl_buffer_object *obj)
{
return (struct st_buffer_object *) obj;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index 45dea594e..dd81a6273 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -102,7 +102,7 @@ st_destroy_clear(struct st_context *st)
/**
* Helper function to set the fragment shaders.
*/
-static INLINE void
+static inline void
set_fragment_shader(struct st_context *st)
{
if (!st->clear.fs)
@@ -118,7 +118,7 @@ set_fragment_shader(struct st_context *st)
/**
* Helper function to set the vertex shader.
*/
-static INLINE void
+static inline void
set_vertex_shader(struct st_context *st)
{
/* vertex shader - still required to provide the linkage between
@@ -381,7 +381,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
/**
* Return if the scissor must be enabled during the clear.
*/
-static INLINE GLboolean
+static inline GLboolean
is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
return (ctx->Scissor.EnableFlags & 1) &&
@@ -395,7 +395,7 @@ is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
/**
* Return if all of the color channels are masked.
*/
-static INLINE GLboolean
+static inline GLboolean
is_color_disabled(struct gl_context *ctx, int i)
{
return !ctx->Color.ColorMask[i][0] &&
@@ -408,7 +408,7 @@ is_color_disabled(struct gl_context *ctx, int i)
/**
* Return if any of the color channels are masked.
*/
-static INLINE GLboolean
+static inline GLboolean
is_color_masked(struct gl_context *ctx, int i)
{
return !ctx->Color.ColorMask[i][0] ||
@@ -421,7 +421,7 @@ is_color_masked(struct gl_context *ctx, int i)
/**
* Return if all of the stencil bits are masked.
*/
-static INLINE GLboolean
+static inline GLboolean
is_stencil_disabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
const GLuint stencilMax = 0xff;
@@ -434,7 +434,7 @@ is_stencil_disabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
/**
* Return if any of the stencil bits are masked.
*/
-static INLINE GLboolean
+static inline GLboolean
is_stencil_masked(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
const GLuint stencilMax = 0xff;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 14fc13952..3edf31bad 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -201,7 +201,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
GLuint ic = 0;
const GLuint shaderIndex = write_depth * 2 + write_stencil;
- assert(shaderIndex < Elements(st->drawpix.shaders));
+ assert(shaderIndex < ARRAY_SIZE(st->drawpix.shaders));
if (st->drawpix.shaders[shaderIndex]) {
/* already have the proper shader */
@@ -1684,7 +1684,7 @@ st_destroy_drawpix(struct st_context *st)
{
GLuint i;
- for (i = 0; i < Elements(st->drawpix.shaders); i++) {
+ for (i = 0; i < ARRAY_SIZE(st->drawpix.shaders); i++) {
if (st->drawpix.shaders[i])
_mesa_reference_fragprog(st->ctx, &st->drawpix.shaders[i], NULL);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.h b/mesalib/src/mesa/state_tracker/st_cb_fbo.h
index ae13aa677..f3b310b07 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.h
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.h
@@ -65,7 +65,7 @@ struct st_renderbuffer
};
-static INLINE struct st_renderbuffer *
+static inline struct st_renderbuffer *
st_renderbuffer(struct gl_renderbuffer *rb)
{
return (struct st_renderbuffer *) rb;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c
index 6b504b8ab..c5410886a 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c
@@ -69,7 +69,7 @@ struct feedback_stage
* GL Feedback functions
**********************************************************************/
-static INLINE struct feedback_stage *
+static inline struct feedback_stage *
feedback_stage( struct draw_stage *stage )
{
return (struct feedback_stage *)stage;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 5544c6644..6df430049 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -47,7 +47,7 @@
/** Check if we have a front color buffer and if it's been drawn to. */
-static INLINE GLboolean
+static inline GLboolean
is_front_buffer_dirty(struct st_context *st)
{
struct gl_framebuffer *fb = st->ctx->DrawBuffer;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c
index faff9c4bd..aa301d830 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_program.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_program.c
@@ -143,11 +143,6 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
if (stgp->glsl_to_tgsi)
free_glsl_to_tgsi_visitor(stgp->glsl_to_tgsi);
-
- if (stgp->tgsi.tokens) {
- st_free_tokens((void *) stgp->tgsi.tokens);
- stgp->tgsi.tokens = NULL;
- }
}
break;
case GL_FRAGMENT_PROGRAM_ARB:
@@ -207,11 +202,6 @@ st_program_string_notify( struct gl_context *ctx,
st_release_gp_variants(st, stgp);
- if (stgp->tgsi.tokens) {
- st_free_tokens((void *) stgp->tgsi.tokens);
- stgp->tgsi.tokens = NULL;
- }
-
if (st->gp == stgp)
st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h
index e4c6c8643..24063211b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h
+++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h
@@ -49,7 +49,7 @@ struct st_query_object
/**
* Cast wrapper
*/
-static INLINE struct st_query_object *
+static inline struct st_query_object *
st_query_object(struct gl_query_object *q)
{
return (struct st_query_object *) q;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c
index 370746536..272cbb91d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -64,7 +64,7 @@ struct rastpos_stage
};
-static INLINE struct rastpos_stage *
+static inline struct rastpos_stage *
rastpos_stage( struct draw_stage *stage )
{
return (struct rastpos_stage *) stage;
@@ -191,7 +191,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw)
rs->stage.destroy = rastpos_destroy;
rs->ctx = ctx;
- for (i = 0; i < Elements(rs->array); i++) {
+ for (i = 0; i < ARRAY_SIZE(rs->array); i++) {
rs->array[i].Size = 4;
rs->array[i].Type = GL_FLOAT;
rs->array[i].Format = GL_RGBA;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 0525e879f..a8b19a1f3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -25,6 +25,7 @@
*
**************************************************************************/
+#include <stdio.h>
#include "main/bufferobj.h"
#include "main/enums.h"
#include "main/fbobject.h"
diff --git a/mesalib/src/mesa/state_tracker/st_cb_viewport.c b/mesalib/src/mesa/state_tracker/st_cb_viewport.c
index 2bd55f6d2..d7a34125e 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_viewport.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_viewport.c
@@ -39,7 +39,7 @@
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
-static INLINE struct st_framebuffer *
+static inline struct st_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c
index a2bd86aff..07c118e22 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c
@@ -59,7 +59,7 @@ struct st_transform_feedback_object {
struct pipe_stream_output_target *draw_count;
};
-static INLINE struct st_transform_feedback_object *
+static inline struct st_transform_feedback_object *
st_transform_feedback_object(struct gl_transform_feedback_object *obj)
{
return (struct st_transform_feedback_object *) obj;
@@ -95,7 +95,7 @@ st_delete_transform_feedback(struct gl_context *ctx,
pipe_so_target_reference(&sobj->targets[i], NULL);
}
- for (i = 0; i < Elements(sobj->base.Buffers); i++) {
+ for (i = 0; i < ARRAY_SIZE(sobj->base.Buffers); i++) {
_mesa_reference_buffer_object(ctx, &sobj->base.Buffers[i], NULL);
}
@@ -115,8 +115,8 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
unsigned i, max_num_targets;
unsigned offsets[PIPE_MAX_SO_BUFFERS] = {0};
- max_num_targets = MIN2(Elements(sobj->base.Buffers),
- Elements(sobj->targets));
+ max_num_targets = MIN2(ARRAY_SIZE(sobj->base.Buffers),
+ ARRAY_SIZE(sobj->targets));
/* Convert the transform feedback state into the gallium representation. */
for (i = 0; i < max_num_targets; i++) {
@@ -185,7 +185,7 @@ st_transform_feedback_get_draw_target(struct gl_transform_feedback_object *obj)
st_transform_feedback_object(obj);
unsigned i;
- for (i = 0; i < Elements(sobj->targets); i++) {
+ for (i = 0; i < ARRAY_SIZE(sobj->targets); i++) {
if (sobj->targets[i]) {
return sobj->targets[i];
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 5834ebad3..5fe132ac2 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -117,8 +117,8 @@ st_destroy_context_priv(struct st_context *st)
st_destroy_drawpix(st);
st_destroy_drawtex(st);
- for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
- for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
+ for (shader = 0; shader < ARRAY_SIZE(st->state.sampler_views); shader++) {
+ for (i = 0; i < ARRAY_SIZE(st->state.sampler_views[0]); i++) {
pipe_sampler_view_release(st->pipe,
&st->state.sampler_views[shader][i]);
}
@@ -200,7 +200,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
/* Vertex element objects used for drawing rectangles for glBitmap,
* glDrawPixels, glClear, etc.
*/
- for (i = 0; i < Elements(st->velems_util_draw); i++) {
+ for (i = 0; i < ARRAY_SIZE(st->velems_util_draw); i++) {
memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element));
st->velems_util_draw[i].src_offset = i * 4 * sizeof(float);
st->velems_util_draw[i].instance_divisor = 0;
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index b091a8856..8a9504bb7 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -214,7 +214,7 @@ struct st_context
/* Need this so that we can implement Mesa callbacks in this module.
*/
-static INLINE struct st_context *st_context(struct gl_context *ctx)
+static inline struct st_context *st_context(struct gl_context *ctx)
{
return ctx->st;
}
@@ -246,7 +246,7 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state);
#define Y_0_TOP 1
#define Y_0_BOTTOM 2
-static INLINE GLuint
+static inline GLuint
st_fb_orientation(const struct gl_framebuffer *fb)
{
if (fb && _mesa_is_winsys_fbo(fb)) {
diff --git a/mesalib/src/mesa/state_tracker/st_debug.h b/mesalib/src/mesa/state_tracker/st_debug.h
index 49b916fb3..cc8197836 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.h
+++ b/mesalib/src/mesa/state_tracker/st_debug.h
@@ -58,7 +58,7 @@ extern int ST_DEBUG;
void st_debug_init( void );
-static INLINE void
+static inline void
ST_DBG( unsigned flag, const char *fmt, ... )
{
if (ST_DEBUG & flag)
diff --git a/mesalib/src/mesa/state_tracker/st_draw.h b/mesalib/src/mesa/state_tracker/st_draw.h
index 361fe7f91..780d4bde7 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.h
+++ b/mesalib/src/mesa/state_tracker/st_draw.h
@@ -76,7 +76,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
* This function is basically a cast wrapper to avoid warnings when building
* in 64-bit mode.
*/
-static INLINE unsigned
+static inline unsigned
pointer_to_offset(const void *ptr)
{
return (unsigned) (((GLsizeiptr) ptr) & 0xffffffffUL);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index ce29d076c..bc20f7323 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -347,8 +347,8 @@ init_format_extensions(struct pipe_screen *screen,
GLboolean *extension_table = (GLboolean *) extensions;
unsigned i;
int j;
- int num_formats = Elements(mapping->format);
- int num_ext = Elements(mapping->extension_offset);
+ int num_formats = ARRAY_SIZE(mapping->format);
+ int num_ext = ARRAY_SIZE(mapping->extension_offset);
for (i = 0; i < num_mappings; i++) {
int num_supported = 0;
@@ -630,7 +630,7 @@ void st_init_extensions(struct pipe_screen *screen,
extensions->OES_draw_texture = GL_TRUE;
/* Expose the extensions which directly correspond to gallium caps. */
- for (i = 0; i < Elements(cap_mapping); i++) {
+ for (i = 0; i < ARRAY_SIZE(cap_mapping); i++) {
if (screen->get_param(screen, cap_mapping[i].cap)) {
extension_table[cap_mapping[i].extension_offset] = GL_TRUE;
}
@@ -638,16 +638,16 @@ void st_init_extensions(struct pipe_screen *screen,
/* Expose the extensions which directly correspond to gallium formats. */
init_format_extensions(screen, extensions, rendertarget_mapping,
- Elements(rendertarget_mapping), PIPE_TEXTURE_2D,
+ ARRAY_SIZE(rendertarget_mapping), PIPE_TEXTURE_2D,
PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW);
init_format_extensions(screen, extensions, depthstencil_mapping,
- Elements(depthstencil_mapping), PIPE_TEXTURE_2D,
+ ARRAY_SIZE(depthstencil_mapping), PIPE_TEXTURE_2D,
PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SAMPLER_VIEW);
init_format_extensions(screen, extensions, texture_mapping,
- Elements(texture_mapping), PIPE_TEXTURE_2D,
+ ARRAY_SIZE(texture_mapping), PIPE_TEXTURE_2D,
PIPE_BIND_SAMPLER_VIEW);
init_format_extensions(screen, extensions, vertex_mapping,
- Elements(vertex_mapping), PIPE_BUFFER,
+ ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
PIPE_BIND_VERTEX_BUFFER);
/* Figure out GLSL support. */
@@ -758,22 +758,22 @@ void st_init_extensions(struct pipe_screen *screen,
};
consts->MaxSamples =
- get_max_samples_for_formats(screen, Elements(color_formats),
+ get_max_samples_for_formats(screen, ARRAY_SIZE(color_formats),
color_formats, 16,
PIPE_BIND_RENDER_TARGET);
consts->MaxColorTextureSamples =
- get_max_samples_for_formats(screen, Elements(color_formats),
+ get_max_samples_for_formats(screen, ARRAY_SIZE(color_formats),
color_formats, consts->MaxSamples,
PIPE_BIND_SAMPLER_VIEW);
consts->MaxDepthTextureSamples =
- get_max_samples_for_formats(screen, Elements(depth_formats),
+ get_max_samples_for_formats(screen, ARRAY_SIZE(depth_formats),
depth_formats, consts->MaxSamples,
PIPE_BIND_SAMPLER_VIEW);
consts->MaxIntegerSamples =
- get_max_samples_for_formats(screen, Elements(int_formats),
+ get_max_samples_for_formats(screen, ARRAY_SIZE(int_formats),
int_formats, consts->MaxSamples,
PIPE_BIND_SAMPLER_VIEW);
}
@@ -831,7 +831,7 @@ void st_init_extensions(struct pipe_screen *screen,
extensions->ARB_texture_buffer_range = GL_TRUE;
init_format_extensions(screen, extensions, tbo_rgb32,
- Elements(tbo_rgb32), PIPE_BUFFER,
+ ARRAY_SIZE(tbo_rgb32), PIPE_BUFFER,
PIPE_BIND_SAMPLER_VIEW);
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 7868bb501..72dbf3bd4 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1855,7 +1855,7 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
return pf;
/* search table for internalFormat */
- for (i = 0; i < Elements(format_map); i++) {
+ for (i = 0; i < ARRAY_SIZE(format_map); i++) {
const struct format_mapping *mapping = &format_map[i];
for (j = 0; mapping->glFormats[j]; j++) {
if (mapping->glFormats[j] == internalFormat) {
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 0b3477161..bd191d864 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1497,7 +1497,7 @@ void
glsl_to_tgsi_visitor::visit(ir_expression *ir)
{
unsigned int operand;
- st_src_reg op[Elements(ir->operands)];
+ st_src_reg op[ARRAY_SIZE(ir->operands)];
st_src_reg result_src;
st_dst_reg result_dst;
@@ -3515,7 +3515,7 @@ get_src_arg_mask(st_dst_reg dst, st_src_reg src)
*/
for (comp = 0; comp < 4; ++comp) {
const unsigned coord = GET_SWZ(src.swizzle, comp);
- ASSERT(coord < 4);
+ assert(coord < 4);
if (dst.writemask & (1 << comp) && coord <= SWIZZLE_W)
read_mask |= 1 << coord;
}
@@ -4022,7 +4022,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code(void)
/* Continuing the block, clear any channels from the write array that
* are read by this instruction.
*/
- for (unsigned i = 0; i < Elements(inst->src); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(inst->src); i++) {
if (inst->src[i].file == PROGRAM_TEMPORARY && inst->src[i].reladdr){
/* Any temporary might be read, so no dead code elimination
* across this instruction.
@@ -4067,7 +4067,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code(void)
* If there is already an instruction in the write array for one or more
* of the channels, flag that channel write as dead.
*/
- for (unsigned i = 0; i < Elements(inst->dst); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(inst->dst); i++) {
if (inst->dst[i].file == PROGRAM_TEMPORARY &&
!inst->dst[i].reladdr &&
!inst->saturate) {
@@ -4625,7 +4625,7 @@ dst_register(struct st_translate *t,
case PROGRAM_ARRAY:
array = index >> 16;
- assert(array < Elements(t->arrays));
+ assert(array < ARRAY_SIZE(t->arrays));
if (ureg_dst_is_undef(t->arrays[array]))
t->arrays[array] = ureg_DECL_array_temporary(
@@ -4642,7 +4642,7 @@ dst_register(struct st_translate *t,
else
assert(index < VARYING_SLOT_MAX);
- assert(t->outputMapping[index] < Elements(t->outputs));
+ assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs));
return t->outputs[t->outputMapping[index]];
@@ -4659,7 +4659,7 @@ dst_register(struct st_translate *t,
* Map a glsl_to_tgsi src register to a TGSI ureg_src register.
*/
static struct ureg_src
-src_register(struct st_translate *t, const struct st_src_reg *reg)
+src_register(struct st_translate *t, const st_src_reg *reg)
{
switch(reg->file) {
case PROGRAM_UNDEFINED:
@@ -4685,18 +4685,18 @@ src_register(struct st_translate *t, const struct st_src_reg *reg)
return t->immediates[reg->index];
case PROGRAM_INPUT:
- assert(t->inputMapping[reg->index] < Elements(t->inputs));
+ assert(t->inputMapping[reg->index] < ARRAY_SIZE(t->inputs));
return t->inputs[t->inputMapping[reg->index]];
case PROGRAM_OUTPUT:
- assert(t->outputMapping[reg->index] < Elements(t->outputs));
+ assert(t->outputMapping[reg->index] < ARRAY_SIZE(t->outputs));
return ureg_src(t->outputs[t->outputMapping[reg->index]]); /* not needed? */
case PROGRAM_ADDRESS:
return ureg_src(t->address[reg->index]);
case PROGRAM_SYSTEM_VALUE:
- assert(reg->index < (int) Elements(t->systemValues));
+ assert(reg->index < (int) ARRAY_SIZE(t->systemValues));
return t->systemValues[reg->index];
default:
@@ -4824,7 +4824,7 @@ translate_tex_offset(struct st_translate *t,
array = in_offset->index >> 16;
assert(array >= 0);
- assert(array < (int) Elements(t->arrays));
+ assert(array < (int) ARRAY_SIZE(t->arrays));
dst = t->arrays[array];
offset.File = dst.File;
@@ -5200,8 +5200,8 @@ st_translate_program(
unsigned i;
enum pipe_error ret = PIPE_OK;
- assert(numInputs <= Elements(t->inputs));
- assert(numOutputs <= Elements(t->outputs));
+ assert(numInputs <= ARRAY_SIZE(t->inputs));
+ assert(numOutputs <= ARRAY_SIZE(t->outputs));
assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_FRONT_FACE] ==
TGSI_SEMANTIC_FACE);
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 5411d84b0..840f76a13 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -61,7 +61,7 @@
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
-static INLINE struct st_framebuffer *
+static inline struct st_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
@@ -73,7 +73,7 @@ st_ws_framebuffer(struct gl_framebuffer *fb)
/**
* Map an attachment to a buffer index.
*/
-static INLINE gl_buffer_index
+static inline gl_buffer_index
attachment_to_buffer_index(enum st_attachment_type statt)
{
gl_buffer_index index;
@@ -109,7 +109,7 @@ attachment_to_buffer_index(enum st_attachment_type statt)
/**
* Map a buffer index to an attachment.
*/
-static INLINE enum st_attachment_type
+static inline enum st_attachment_type
buffer_index_to_attachment(gl_buffer_index index)
{
enum st_attachment_type statt;
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 3dd8a14b6..2f1016110 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -172,7 +172,7 @@ dst_register( struct st_translate *t,
else
assert(index < VARYING_SLOT_MAX);
- assert(t->outputMapping[index] < Elements(t->outputs));
+ assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs));
return t->outputs[t->outputMapping[index]];
@@ -200,7 +200,7 @@ src_register( struct st_translate *t,
case PROGRAM_TEMPORARY:
assert(index >= 0);
- assert(index < Elements(t->temps));
+ assert(index < ARRAY_SIZE(t->temps));
if (ureg_dst_is_undef(t->temps[index]))
t->temps[index] = ureg_DECL_temporary( t->ureg );
return ureg_src(t->temps[index]);
@@ -216,18 +216,18 @@ src_register( struct st_translate *t,
return t->constants[index];
case PROGRAM_INPUT:
- assert(t->inputMapping[index] < Elements(t->inputs));
+ assert(t->inputMapping[index] < ARRAY_SIZE(t->inputs));
return t->inputs[t->inputMapping[index]];
case PROGRAM_OUTPUT:
- assert(t->outputMapping[index] < Elements(t->outputs));
+ assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs));
return ureg_src(t->outputs[t->outputMapping[index]]); /* not needed? */
case PROGRAM_ADDRESS:
return ureg_src(t->address[index]);
case PROGRAM_SYSTEM_VALUE:
- assert(index < Elements(t->systemValues));
+ assert(index < ARRAY_SIZE(t->systemValues));
return t->systemValues[index];
default:
@@ -1027,8 +1027,8 @@ st_translate_mesa_program(
unsigned i;
enum pipe_error ret = PIPE_OK;
- assert(numInputs <= Elements(t->inputs));
- assert(numOutputs <= Elements(t->outputs));
+ assert(numInputs <= ARRAY_SIZE(t->inputs));
+ assert(numOutputs <= ARRAY_SIZE(t->outputs));
t = &translate;
memset(t, 0, sizeof *t);
@@ -1254,14 +1254,3 @@ out:
return ret;
}
-
-
-/**
- * Tokens cannot be free with free otherwise the builtin gallium
- * malloc debugging will get confused.
- */
-void
-st_free_tokens(const struct tgsi_token *tokens)
-{
- ureg_free_tokens(tokens);
-}
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h
index 1aa797a32..62bb654e9 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -62,9 +62,6 @@ st_translate_mesa_program(
boolean passthrough_edgeflags,
boolean clamp_color);
-void
-st_free_tokens(const struct tgsi_token *tokens);
-
unsigned
st_translate_texture_target(GLuint textarget, GLboolean shadow);
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 10a5f2900..4cfd817ce 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -69,7 +69,7 @@ delete_vp_variant(struct st_context *st, struct st_vp_variant *vpv)
draw_delete_vertex_shader( st->draw, vpv->draw_shader );
if (vpv->tgsi.tokens)
- st_free_tokens(vpv->tgsi.tokens);
+ ureg_free_tokens(vpv->tgsi.tokens);
free( vpv );
}
@@ -108,7 +108,7 @@ delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv)
if (fpv->parameters)
_mesa_free_parameter_list(fpv->parameters);
if (fpv->tgsi.tokens)
- st_free_tokens(fpv->tgsi.tokens);
+ ureg_free_tokens(fpv->tgsi.tokens);
free(fpv);
}
@@ -869,106 +869,79 @@ st_translate_geometry_program(struct st_context *st,
GLuint outputMapping[VARYING_SLOT_MAX];
struct pipe_context *pipe = st->pipe;
GLuint attr;
- GLbitfield64 inputsRead;
- GLuint vslot = 0;
uint gs_num_inputs = 0;
- uint gs_builtin_inputs = 0;
- uint gs_array_offset = 0;
+
+ ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
+ ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
ubyte gs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
ubyte gs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint gs_num_outputs = 0;
GLint i;
- GLuint maxSlot = 0;
struct ureg_program *ureg;
-
+ struct pipe_shader_state state = {0};
struct st_gp_variant *gpv;
gpv = CALLOC_STRUCT(st_gp_variant);
if (!gpv)
return NULL;
- if (!stgp->glsl_to_tgsi) {
- _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT);
- }
-
- ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY );
+ ureg = ureg_create(TGSI_PROCESSOR_GEOMETRY);
if (ureg == NULL) {
free(gpv);
return NULL;
}
- /* which vertex output goes to the first geometry input */
- vslot = 0;
-
memset(inputMapping, 0, sizeof(inputMapping));
memset(outputMapping, 0, sizeof(outputMapping));
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/
- inputsRead = stgp->Base.Base.InputsRead;
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
- if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
- const GLuint slot = gs_num_inputs;
-
- gs_num_inputs++;
+ if ((stgp->Base.Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
+ const GLuint slot = gs_num_inputs++;
inputMapping[attr] = slot;
- stgp->input_map[slot + gs_array_offset] = vslot - gs_builtin_inputs;
- stgp->input_to_index[attr] = vslot;
- stgp->index_to_input[vslot] = attr;
- ++vslot;
-
- if (attr != VARYING_SLOT_PRIMITIVE_ID) {
- gs_array_offset += 2;
- } else
- ++gs_builtin_inputs;
-
-#if 0
- debug_printf("input map at %d = %d\n",
- slot + gs_array_offset, stgp->input_map[slot + gs_array_offset]);
-#endif
-
switch (attr) {
case VARYING_SLOT_PRIMITIVE_ID:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_POS:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_COL0:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_COL1:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- stgp->input_semantic_index[slot] = 1;
+ input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+ input_semantic_index[slot] = 1;
break;
case VARYING_SLOT_FOGC:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_CLIP_VERTEX:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_CLIP_DIST0:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_CLIP_DIST1:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
- stgp->input_semantic_index[slot] = 1;
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ input_semantic_index[slot] = 1;
break;
case VARYING_SLOT_PSIZ:
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
- stgp->input_semantic_index[slot] = 0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
+ input_semantic_index[slot] = 0;
break;
case VARYING_SLOT_TEX0:
case VARYING_SLOT_TEX1:
@@ -979,16 +952,16 @@ st_translate_geometry_program(struct st_context *st,
case VARYING_SLOT_TEX6:
case VARYING_SLOT_TEX7:
if (st->needs_texcoord_semantic) {
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
- stgp->input_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
+ input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
+ input_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
break;
}
/* fall through */
case VARYING_SLOT_VAR0:
default:
assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX);
- stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stgp->input_semantic_index[slot] =
+ input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
+ input_semantic_index[slot] =
st_get_generic_varying_index(st, attr);
break;
}
@@ -1007,10 +980,8 @@ st_translate_geometry_program(struct st_context *st,
*/
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if (stgp->Base.Base.OutputsWritten & BITFIELD64_BIT(attr)) {
- GLuint slot;
+ GLuint slot = gs_num_outputs++;
- slot = gs_num_outputs;
- gs_num_outputs++;
outputMapping[attr] = slot;
switch (attr) {
@@ -1083,7 +1054,7 @@ st_translate_geometry_program(struct st_context *st,
/* fall through */
case VARYING_SLOT_VAR0:
default:
- assert(slot < Elements(gs_output_semantic_name));
+ assert(slot < ARRAY_SIZE(gs_output_semantic_name));
assert(attr >= VARYING_SLOT_VAR0);
gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
gs_output_semantic_index[slot] =
@@ -1093,93 +1064,38 @@ st_translate_geometry_program(struct st_context *st,
}
}
- /* find max output slot referenced to compute gs_num_outputs */
- for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
- if (outputMapping[attr] != ~0U && outputMapping[attr] > maxSlot)
- maxSlot = outputMapping[attr];
- }
- gs_num_outputs = maxSlot + 1;
-
-#if 0 /* debug */
- {
- GLuint i;
- printf("outputMapping? %d\n", outputMapping ? 1 : 0);
- if (outputMapping) {
- printf("attr -> slot\n");
- for (i = 0; i < 16; i++) {
- printf(" %2d %3d\n", i, outputMapping[i]);
- }
- }
- printf("slot sem_name sem_index\n");
- for (i = 0; i < gs_num_outputs; i++) {
- printf(" %2d %d %d\n",
- i,
- gs_output_semantic_name[i],
- gs_output_semantic_index[i]);
- }
- }
-#endif
-
- /* free old shader state, if any */
- if (stgp->tgsi.tokens) {
- st_free_tokens(stgp->tgsi.tokens);
- stgp->tgsi.tokens = NULL;
- }
-
ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, stgp->Base.InputType);
ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, stgp->Base.OutputType);
ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES,
stgp->Base.VerticesOut);
ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, stgp->Base.Invocations);
- if (stgp->glsl_to_tgsi)
- st_translate_program(st->ctx,
- TGSI_PROCESSOR_GEOMETRY,
- ureg,
- stgp->glsl_to_tgsi,
- &stgp->Base.Base,
- /* inputs */
- gs_num_inputs,
- inputMapping,
- stgp->input_semantic_name,
- stgp->input_semantic_index,
- NULL,
- NULL,
- /* outputs */
- gs_num_outputs,
- outputMapping,
- gs_output_semantic_name,
- gs_output_semantic_index,
- FALSE,
- FALSE);
- else
- st_translate_mesa_program(st->ctx,
- TGSI_PROCESSOR_GEOMETRY,
- ureg,
- &stgp->Base.Base,
- /* inputs */
- gs_num_inputs,
- inputMapping,
- stgp->input_semantic_name,
- stgp->input_semantic_index,
- NULL,
- /* outputs */
- gs_num_outputs,
- outputMapping,
- gs_output_semantic_name,
- gs_output_semantic_index,
- FALSE,
- FALSE);
-
- stgp->num_inputs = gs_num_inputs;
- stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
- ureg_destroy( ureg );
-
- if (stgp->glsl_to_tgsi) {
- st_translate_stream_output_info(stgp->glsl_to_tgsi,
- outputMapping,
- &stgp->tgsi.stream_output);
- }
+ st_translate_program(st->ctx,
+ TGSI_PROCESSOR_GEOMETRY,
+ ureg,
+ stgp->glsl_to_tgsi,
+ &stgp->Base.Base,
+ /* inputs */
+ gs_num_inputs,
+ inputMapping,
+ input_semantic_name,
+ input_semantic_index,
+ NULL,
+ NULL,
+ /* outputs */
+ gs_num_outputs,
+ outputMapping,
+ gs_output_semantic_name,
+ gs_output_semantic_index,
+ FALSE,
+ FALSE);
+
+ state.tokens = ureg_get_tokens(ureg, NULL);
+ ureg_destroy(ureg);
+
+ st_translate_stream_output_info(stgp->glsl_to_tgsi,
+ outputMapping,
+ &state.stream_output);
if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
_mesa_print_program(&stgp->Base.Base);
@@ -1187,13 +1103,15 @@ st_translate_geometry_program(struct st_context *st,
}
if (ST_DEBUG & DEBUG_TGSI) {
- tgsi_dump(stgp->tgsi.tokens, 0);
+ tgsi_dump(state.tokens, 0);
debug_printf("\n");
}
/* fill in new variant */
- gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi);
+ gpv->driver_shader = pipe->create_gs_state(pipe, &state);
gpv->key = *key;
+
+ ureg_free_tokens(state.tokens);
return gpv;
}
@@ -1229,51 +1147,6 @@ st_get_gp_variant(struct st_context *st,
}
-
-
-/**
- * Debug- print current shader text
- */
-void
-st_print_shaders(struct gl_context *ctx)
-{
- struct gl_shader_program **shProg = ctx->_Shader->CurrentProgram;
- unsigned j;
-
- for (j = 0; j < 3; j++) {
- unsigned i;
-
- if (shProg[j] == NULL)
- continue;
-
- for (i = 0; i < shProg[j]->NumShaders; i++) {
- struct gl_shader *sh;
-
- switch (shProg[j]->Shaders[i]->Type) {
- case GL_VERTEX_SHADER:
- sh = (i != 0) ? NULL : shProg[j]->Shaders[i];
- break;
- case GL_GEOMETRY_SHADER_ARB:
- sh = (i != 1) ? NULL : shProg[j]->Shaders[i];
- break;
- case GL_FRAGMENT_SHADER:
- sh = (i != 2) ? NULL : shProg[j]->Shaders[i];
- break;
- default:
- assert(0);
- sh = NULL;
- break;
- }
-
- if (sh != NULL) {
- printf("GLSL shader %u of %u:\n", i, shProg[j]->NumShaders);
- printf("%s\n", sh->Source);
- }
- }
- }
-}
-
-
/**
* Vert/Geom/Frag programs have per-context variants. Free all the
* variants attached to the given program which match the given context.
@@ -1374,7 +1247,7 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData)
destroy_program_variants(st, shProg->Shaders[i]->Program);
}
- for (i = 0; i < Elements(shProg->_LinkedShaders); i++) {
+ for (i = 0; i < ARRAY_SIZE(shProg->_LinkedShaders); i++) {
if (shProg->_LinkedShaders[i])
destroy_program_variants(st, shProg->_LinkedShaders[i]->Program);
}
diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h
index 870d0d57a..451d7bb6a 100644
--- a/mesalib/src/mesa/state_tracker/st_program.h
+++ b/mesalib/src/mesa/state_tracker/st_program.h
@@ -203,49 +203,31 @@ struct st_geometry_program
struct gl_geometry_program Base; /**< The Mesa geometry program */
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
- /** map GP input back to VP output */
- GLuint input_map[PIPE_MAX_SHADER_INPUTS];
-
- /** maps a Mesa VARYING_SLOT_x to a packed TGSI input index */
- GLuint input_to_index[VARYING_SLOT_MAX];
- /** maps a TGSI input index back to a Mesa VARYING_SLOT_x */
- GLuint index_to_input[PIPE_MAX_SHADER_INPUTS];
-
- GLuint num_inputs;
-
- GLuint input_to_slot[VARYING_SLOT_MAX]; /**< Maps VARYING_SLOT_x to slot */
- GLuint num_input_slots;
-
- ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
- ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
-
- struct pipe_shader_state tgsi;
-
struct st_gp_variant *variants;
};
-static INLINE struct st_fragment_program *
+static inline struct st_fragment_program *
st_fragment_program( struct gl_fragment_program *fp )
{
return (struct st_fragment_program *)fp;
}
-static INLINE struct st_vertex_program *
+static inline struct st_vertex_program *
st_vertex_program( struct gl_vertex_program *vp )
{
return (struct st_vertex_program *)vp;
}
-static INLINE struct st_geometry_program *
+static inline struct st_geometry_program *
st_geometry_program( struct gl_geometry_program *gp )
{
return (struct st_geometry_program *)gp;
}
-static INLINE void
+static inline void
st_reference_vertprog(struct st_context *st,
struct st_vertex_program **ptr,
struct st_vertex_program *prog)
@@ -255,7 +237,7 @@ st_reference_vertprog(struct st_context *st,
(struct gl_program *) prog);
}
-static INLINE void
+static inline void
st_reference_geomprog(struct st_context *st,
struct st_geometry_program **ptr,
struct st_geometry_program *prog)
@@ -265,7 +247,7 @@ st_reference_geomprog(struct st_context *st,
(struct gl_program *) prog);
}
-static INLINE void
+static inline void
st_reference_fragprog(struct st_context *st,
struct st_fragment_program **ptr,
struct st_fragment_program *prog)
@@ -278,7 +260,7 @@ st_reference_fragprog(struct st_context *st,
/**
* This defines mapping from Mesa VARYING_SLOTs to TGSI GENERIC slots.
*/
-static INLINE unsigned
+static inline unsigned
st_get_generic_varying_index(struct st_context *st, GLuint attr)
{
if (attr >= VARYING_SLOT_VAR0) {
@@ -340,10 +322,6 @@ extern void
st_release_gp_variants(struct st_context *st,
struct st_geometry_program *stgp);
-
-extern void
-st_print_shaders(struct gl_context *ctx);
-
extern void
st_destroy_program_variants(struct st_context *st);
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index 2f540295f..6b7f8c750 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -117,32 +117,32 @@ struct st_texture_object
};
-static INLINE struct st_texture_image *
+static inline struct st_texture_image *
st_texture_image(struct gl_texture_image *img)
{
return (struct st_texture_image *) img;
}
-static INLINE const struct st_texture_image *
+static inline const struct st_texture_image *
st_texture_image_const(const struct gl_texture_image *img)
{
return (const struct st_texture_image *) img;
}
-static INLINE struct st_texture_object *
+static inline struct st_texture_object *
st_texture_object(struct gl_texture_object *obj)
{
return (struct st_texture_object *) obj;
}
-static INLINE const struct st_texture_object *
+static inline const struct st_texture_object *
st_texture_object_const(const struct gl_texture_object *obj)
{
return (const struct st_texture_object *) obj;
}
-static INLINE struct pipe_resource *
+static inline struct pipe_resource *
st_get_texobj_resource(struct gl_texture_object *texObj)
{
struct st_texture_object *stObj = st_texture_object(texObj);
@@ -150,14 +150,14 @@ st_get_texobj_resource(struct gl_texture_object *texObj)
}
-static INLINE struct pipe_resource *
+static inline struct pipe_resource *
st_get_stobj_resource(struct st_texture_object *stObj)
{
return stObj ? stObj->pt : NULL;
}
-static INLINE struct pipe_sampler_view *
+static inline struct pipe_sampler_view *
st_create_texture_sampler_view_format(struct pipe_context *pipe,
struct pipe_resource *texture,
enum pipe_format format)
@@ -169,7 +169,7 @@ st_create_texture_sampler_view_format(struct pipe_context *pipe,
return pipe->create_sampler_view(pipe, texture, &templ);
}
-static INLINE struct pipe_sampler_view *
+static inline struct pipe_sampler_view *
st_create_texture_sampler_view(struct pipe_context *pipe,
struct pipe_resource *texture)
{