From 990bc3f015a4f8fce2eb918375defcd44980a845 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 8 Jun 2012 09:33:13 +0200 Subject: Used synchronise script to update files --- mesalib/src/mesa/state_tracker/Makefile | 2 +- mesalib/src/mesa/state_tracker/st_atom.h | 146 ++--- mesalib/src/mesa/state_tracker/st_atom_constbuf.h | 82 +-- mesalib/src/mesa/state_tracker/st_atom_msaa.c | 166 +++--- mesalib/src/mesa/state_tracker/st_atom_shader.h | 82 +-- mesalib/src/mesa/state_tracker/st_atom_viewport.c | 188 +++---- mesalib/src/mesa/state_tracker/st_cache.h | 138 ++--- mesalib/src/mesa/state_tracker/st_cb_bitmap.h | 192 +++---- mesalib/src/mesa/state_tracker/st_cb_blit.h | 118 ++-- .../src/mesa/state_tracker/st_cb_bufferobjects.h | 136 ++--- mesalib/src/mesa/state_tracker/st_cb_condrender.h | 74 +-- mesalib/src/mesa/state_tracker/st_cb_drawpixels.h | 140 ++--- mesalib/src/mesa/state_tracker/st_cb_drawtex.h | 82 +-- mesalib/src/mesa/state_tracker/st_cb_eglimage.h | 102 ++-- mesalib/src/mesa/state_tracker/st_cb_feedback.c | 618 ++++++++++----------- mesalib/src/mesa/state_tracker/st_cb_feedback.h | 104 ++-- mesalib/src/mesa/state_tracker/st_cb_flush.h | 102 ++-- mesalib/src/mesa/state_tracker/st_cb_program.h | 76 +-- mesalib/src/mesa/state_tracker/st_cb_queryobj.h | 140 ++--- mesalib/src/mesa/state_tracker/st_cb_rasterpos.h | 100 ++-- mesalib/src/mesa/state_tracker/st_cb_strings.c | 146 ++--- mesalib/src/mesa/state_tracker/st_cb_strings.h | 80 +-- mesalib/src/mesa/state_tracker/st_cb_syncobj.c | 244 ++++---- mesalib/src/mesa/state_tracker/st_cb_texture.c | 135 +---- .../src/mesa/state_tracker/st_cb_texturebarrier.c | 120 ++-- .../src/mesa/state_tracker/st_cb_texturebarrier.h | 74 +-- mesalib/src/mesa/state_tracker/st_cb_viewport.h | 72 +-- mesalib/src/mesa/state_tracker/st_debug.h | 144 ++--- mesalib/src/mesa/state_tracker/st_extensions.c | 4 + mesalib/src/mesa/state_tracker/st_extensions.h | 80 +-- mesalib/src/mesa/state_tracker/st_gen_mipmap.h | 104 ++-- mesalib/src/mesa/state_tracker/st_gl_api.h | 14 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 + mesalib/src/mesa/state_tracker/st_manager.h | 104 ++-- 34 files changed, 2021 insertions(+), 2094 deletions(-) (limited to 'mesalib/src/mesa/state_tracker') diff --git a/mesalib/src/mesa/state_tracker/Makefile b/mesalib/src/mesa/state_tracker/Makefile index 4a38ca8f1..0ab1dc6e6 100644 --- a/mesalib/src/mesa/state_tracker/Makefile +++ b/mesalib/src/mesa/state_tracker/Makefile @@ -1,2 +1,2 @@ -default: +default: cd ../.. ; make \ No newline at end of file diff --git a/mesalib/src/mesa/state_tracker/st_atom.h b/mesalib/src/mesa/state_tracker/st_atom.h index b5f837f78..930a08444 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.h +++ b/mesalib/src/mesa/state_tracker/st_atom.h @@ -1,73 +1,73 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - */ - - -#ifndef ST_ATOM_H -#define ST_ATOM_H - -#include "main/glheader.h" - -struct st_context; -struct st_tracked_state; - -void st_init_atoms( struct st_context *st ); -void st_destroy_atoms( struct st_context *st ); - - -void st_validate_state( struct st_context *st ); - - -extern const struct st_tracked_state st_update_framebuffer; -extern const struct st_tracked_state st_update_clip; -extern const struct st_tracked_state st_update_depth_stencil_alpha; -extern const struct st_tracked_state st_update_fp; -extern const struct st_tracked_state st_update_gp; -extern const struct st_tracked_state st_update_vp; -extern const struct st_tracked_state st_update_rasterizer; -extern const struct st_tracked_state st_update_polygon_stipple; -extern const struct st_tracked_state st_update_viewport; -extern const struct st_tracked_state st_update_scissor; -extern const struct st_tracked_state st_update_blend; -extern const struct st_tracked_state st_update_msaa; -extern const struct st_tracked_state st_update_sampler; -extern const struct st_tracked_state st_update_texture; -extern const struct st_tracked_state st_update_vertex_texture; -extern const struct st_tracked_state st_finalize_textures; -extern const struct st_tracked_state st_update_fs_constants; -extern const struct st_tracked_state st_update_gs_constants; -extern const struct st_tracked_state st_update_vs_constants; -extern const struct st_tracked_state st_update_pixel_transfer; - - -GLuint st_compare_func_to_pipe(GLenum func); - -#endif +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + */ + + +#ifndef ST_ATOM_H +#define ST_ATOM_H + +#include "main/glheader.h" + +struct st_context; +struct st_tracked_state; + +void st_init_atoms( struct st_context *st ); +void st_destroy_atoms( struct st_context *st ); + + +void st_validate_state( struct st_context *st ); + + +extern const struct st_tracked_state st_update_framebuffer; +extern const struct st_tracked_state st_update_clip; +extern const struct st_tracked_state st_update_depth_stencil_alpha; +extern const struct st_tracked_state st_update_fp; +extern const struct st_tracked_state st_update_gp; +extern const struct st_tracked_state st_update_vp; +extern const struct st_tracked_state st_update_rasterizer; +extern const struct st_tracked_state st_update_polygon_stipple; +extern const struct st_tracked_state st_update_viewport; +extern const struct st_tracked_state st_update_scissor; +extern const struct st_tracked_state st_update_blend; +extern const struct st_tracked_state st_update_msaa; +extern const struct st_tracked_state st_update_sampler; +extern const struct st_tracked_state st_update_texture; +extern const struct st_tracked_state st_update_vertex_texture; +extern const struct st_tracked_state st_finalize_textures; +extern const struct st_tracked_state st_update_fs_constants; +extern const struct st_tracked_state st_update_gs_constants; +extern const struct st_tracked_state st_update_vs_constants; +extern const struct st_tracked_state st_update_pixel_transfer; + + +GLuint st_compare_func_to_pipe(GLenum func); + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.h b/mesalib/src/mesa/state_tracker/st_atom_constbuf.h index d53654ee6..97b076629 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.h +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.h @@ -1,41 +1,41 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_ATOM_CONSTBUF_H -#define ST_ATOM_CONSTBUF_H - -struct gl_program_parameter_list; -struct st_context; - - -void st_upload_constants( struct st_context *st, - struct gl_program_parameter_list *params, - unsigned id); - - -#endif /* ST_ATOM_CONSTBUF_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_ATOM_CONSTBUF_H +#define ST_ATOM_CONSTBUF_H + +struct gl_program_parameter_list; +struct st_context; + + +void st_upload_constants( struct st_context *st, + struct gl_program_parameter_list *params, + unsigned id); + + +#endif /* ST_ATOM_CONSTBUF_H */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_msaa.c b/mesalib/src/mesa/state_tracker/st_atom_msaa.c index 73f0ff160..ea9eb9a6d 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_msaa.c +++ b/mesalib/src/mesa/state_tracker/st_atom_msaa.c @@ -1,83 +1,83 @@ -/************************************************************************** - * - * Copyright 2010 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "st_context.h" -#include "pipe/p_context.h" -#include "st_atom.h" - -#include "cso_cache/cso_context.h" - - -/* Second state atom for user clip planes: - */ -static void update_sample_mask( struct st_context *st ) -{ - unsigned sample_mask = 0xffffffff; - unsigned sample_count = 1; - struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer; - - /* dependency here on bound surface (or rather, sample count) is worrying */ - if (framebuffer->zsbuf) - sample_count = framebuffer->zsbuf->texture->nr_samples; - else if (framebuffer->cbufs[0]) - sample_count = framebuffer->cbufs[0]->texture->nr_samples; - - if (st->ctx->Multisample.Enabled && sample_count > 1) { - /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */ - if (st->ctx->Multisample.SampleCoverage) { - unsigned nr_bits; - nr_bits = st->ctx->Multisample.SampleCoverageValue * (float)sample_count; - /* there's lot of ways how to do this. We just use first few bits, - since we have no knowledge of sample positions here. When - app-supplied mask though is used too might need to be smarter. - Also, there's a interface restriction here in theory it is - encouraged this mask not be the same at each pixel. */ - sample_mask = (1 << nr_bits) - 1; - if (st->ctx->Multisample.SampleCoverageInvert) - sample_mask = ~sample_mask; - } - /* TODO merge with app-supplied sample mask */ - } - - /* mask off unused bits or don't care? */ - - if (sample_mask != st->state.sample_mask) { - st->state.sample_mask = sample_mask; - cso_set_sample_mask(st->cso_context, sample_mask); - } -} - - -const struct st_tracked_state st_update_msaa = { - "st_update_msaa", /* name */ - { /* dirty */ - (_NEW_MULTISAMPLE | _NEW_BUFFERS), /* mesa */ - ST_NEW_FRAMEBUFFER, /* st */ - }, - update_sample_mask /* update */ -}; +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "st_context.h" +#include "pipe/p_context.h" +#include "st_atom.h" + +#include "cso_cache/cso_context.h" + + +/* Second state atom for user clip planes: + */ +static void update_sample_mask( struct st_context *st ) +{ + unsigned sample_mask = 0xffffffff; + unsigned sample_count = 1; + struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer; + + /* dependency here on bound surface (or rather, sample count) is worrying */ + if (framebuffer->zsbuf) + sample_count = framebuffer->zsbuf->texture->nr_samples; + else if (framebuffer->cbufs[0]) + sample_count = framebuffer->cbufs[0]->texture->nr_samples; + + if (st->ctx->Multisample.Enabled && sample_count > 1) { + /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */ + if (st->ctx->Multisample.SampleCoverage) { + unsigned nr_bits; + nr_bits = st->ctx->Multisample.SampleCoverageValue * (float)sample_count; + /* there's lot of ways how to do this. We just use first few bits, + since we have no knowledge of sample positions here. When + app-supplied mask though is used too might need to be smarter. + Also, there's a interface restriction here in theory it is + encouraged this mask not be the same at each pixel. */ + sample_mask = (1 << nr_bits) - 1; + if (st->ctx->Multisample.SampleCoverageInvert) + sample_mask = ~sample_mask; + } + /* TODO merge with app-supplied sample mask */ + } + + /* mask off unused bits or don't care? */ + + if (sample_mask != st->state.sample_mask) { + st->state.sample_mask = sample_mask; + cso_set_sample_mask(st->cso_context, sample_mask); + } +} + + +const struct st_tracked_state st_update_msaa = { + "st_update_msaa", /* name */ + { /* dirty */ + (_NEW_MULTISAMPLE | _NEW_BUFFERS), /* mesa */ + ST_NEW_FRAMEBUFFER, /* st */ + }, + update_sample_mask /* update */ +}; diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.h b/mesalib/src/mesa/state_tracker/st_atom_shader.h index fbb3a4137..56d4c68f4 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_shader.h +++ b/mesalib/src/mesa/state_tracker/st_atom_shader.h @@ -1,41 +1,41 @@ -/************************************************************************** - * - * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_ATOM_SHADER_H -#define ST_ATOM_SHADER_H - - -struct st_context; -struct translated_vertex_program; - -extern void -st_free_translated_vertex_programs(struct st_context *st, - struct translated_vertex_program *xvp); - - -#endif /* ST_ATOM_SHADER_H */ +/************************************************************************** + * + * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_ATOM_SHADER_H +#define ST_ATOM_SHADER_H + + +struct st_context; +struct translated_vertex_program; + +extern void +st_free_translated_vertex_programs(struct st_context *st, + struct translated_vertex_program *xvp); + + +#endif /* ST_ATOM_SHADER_H */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c index df26fb4a6..133cc49ea 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c +++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c @@ -1,94 +1,94 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "main/context.h" -#include "st_context.h" -#include "st_atom.h" -#include "pipe/p_context.h" -#include "cso_cache/cso_context.h" - -/** - * Update the viewport transformation matrix. Depends on: - * - viewport pos/size - * - depthrange - * - window pos/size or FBO size - */ -static void -update_viewport( struct st_context *st ) -{ - struct gl_context *ctx = st->ctx; - GLfloat yScale, yBias; - - /* _NEW_BUFFERS - */ - if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - /* Drawing to a window. The corresponding gallium surface uses - * Y=0=TOP but OpenGL is Y=0=BOTTOM. So we need to invert the viewport. - */ - yScale = -1; - yBias = (GLfloat)ctx->DrawBuffer->Height; - } - else { - /* Drawing to an FBO where Y=0=BOTTOM, like OpenGL - don't invert */ - yScale = 1.0; - yBias = 0.0; - } - - /* _NEW_VIEWPORT - */ - { - GLfloat x = (GLfloat)ctx->Viewport.X; - GLfloat y = (GLfloat)ctx->Viewport.Y; - GLfloat z = ctx->Viewport.Near; - GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; - GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; - GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; - - st->state.viewport.scale[0] = half_width; - st->state.viewport.scale[1] = half_height * yScale; - st->state.viewport.scale[2] = half_depth; - st->state.viewport.scale[3] = 1.0; - - st->state.viewport.translate[0] = half_width + x; - st->state.viewport.translate[1] = (half_height + y) * yScale + yBias; - st->state.viewport.translate[2] = half_depth + z; - st->state.viewport.translate[3] = 0.0; - - cso_set_viewport(st->cso_context, &st->state.viewport); - } -} - - -const struct st_tracked_state st_update_viewport = { - "st_update_viewport", /* name */ - { /* dirty */ - _NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */ - 0, /* st */ - }, - update_viewport /* update */ -}; +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "main/context.h" +#include "st_context.h" +#include "st_atom.h" +#include "pipe/p_context.h" +#include "cso_cache/cso_context.h" + +/** + * Update the viewport transformation matrix. Depends on: + * - viewport pos/size + * - depthrange + * - window pos/size or FBO size + */ +static void +update_viewport( struct st_context *st ) +{ + struct gl_context *ctx = st->ctx; + GLfloat yScale, yBias; + + /* _NEW_BUFFERS + */ + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { + /* Drawing to a window. The corresponding gallium surface uses + * Y=0=TOP but OpenGL is Y=0=BOTTOM. So we need to invert the viewport. + */ + yScale = -1; + yBias = (GLfloat)ctx->DrawBuffer->Height; + } + else { + /* Drawing to an FBO where Y=0=BOTTOM, like OpenGL - don't invert */ + yScale = 1.0; + yBias = 0.0; + } + + /* _NEW_VIEWPORT + */ + { + GLfloat x = (GLfloat)ctx->Viewport.X; + GLfloat y = (GLfloat)ctx->Viewport.Y; + GLfloat z = ctx->Viewport.Near; + GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; + GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; + GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; + + st->state.viewport.scale[0] = half_width; + st->state.viewport.scale[1] = half_height * yScale; + st->state.viewport.scale[2] = half_depth; + st->state.viewport.scale[3] = 1.0; + + st->state.viewport.translate[0] = half_width + x; + st->state.viewport.translate[1] = (half_height + y) * yScale + yBias; + st->state.viewport.translate[2] = half_depth + z; + st->state.viewport.translate[3] = 0.0; + + cso_set_viewport(st->cso_context, &st->state.viewport); + } +} + + +const struct st_tracked_state st_update_viewport = { + "st_update_viewport", /* name */ + { /* dirty */ + _NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */ + 0, /* st */ + }, + update_viewport /* update */ +}; diff --git a/mesalib/src/mesa/state_tracker/st_cache.h b/mesalib/src/mesa/state_tracker/st_cache.h index 52c1b378d..6d5de7b13 100644 --- a/mesalib/src/mesa/state_tracker/st_cache.h +++ b/mesalib/src/mesa/state_tracker/st_cache.h @@ -1,69 +1,69 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Zack Rusin - */ - -#ifndef ST_CACHE_H -#define ST_CACHE_H - -struct pipe_blend_state; -struct pipe_depth_stencil_alpha_state; -struct pipe_rasterizer_state; -struct pipe_sampler_state; -struct pipe_shader_state; -struct st_context; - - -const struct cso_blend * -st_cached_blend_state(struct st_context *st, - const struct pipe_blend_state *blend); - -const struct cso_sampler * -st_cached_sampler_state(struct st_context *st, - const struct pipe_sampler_state *sampler); - -const struct cso_depth_stencil_alpha * -st_cached_depth_stencil_alpha_state(struct st_context *st, - const struct pipe_depth_stencil_alpha_state *depth_stencil); - -const struct cso_rasterizer * -st_cached_rasterizer_state(struct st_context *st, - const struct pipe_rasterizer_state *raster); - -const struct cso_fragment_shader * -st_cached_fs_state(struct st_context *st, - const struct pipe_shader_state *templ); - - -const struct cso_vertex_shader * -st_cached_vs_state(struct st_context *st, - const struct pipe_shader_state *templ); - -#endif +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Zack Rusin + */ + +#ifndef ST_CACHE_H +#define ST_CACHE_H + +struct pipe_blend_state; +struct pipe_depth_stencil_alpha_state; +struct pipe_rasterizer_state; +struct pipe_sampler_state; +struct pipe_shader_state; +struct st_context; + + +const struct cso_blend * +st_cached_blend_state(struct st_context *st, + const struct pipe_blend_state *blend); + +const struct cso_sampler * +st_cached_sampler_state(struct st_context *st, + const struct pipe_sampler_state *sampler); + +const struct cso_depth_stencil_alpha * +st_cached_depth_stencil_alpha_state(struct st_context *st, + const struct pipe_depth_stencil_alpha_state *depth_stencil); + +const struct cso_rasterizer * +st_cached_rasterizer_state(struct st_context *st, + const struct pipe_rasterizer_state *raster); + +const struct cso_fragment_shader * +st_cached_fs_state(struct st_context *st, + const struct pipe_shader_state *templ); + + +const struct cso_vertex_shader * +st_cached_vs_state(struct st_context *st, + const struct pipe_shader_state *templ); + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h index cc6d82391..ed1415803 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h @@ -1,96 +1,96 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_BITMAP_H -#define ST_CB_BITMAP_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; -struct gl_fragment_program; -struct st_fragment_program; - -#if FEATURE_drawpix - -extern void -st_init_bitmap_functions(struct dd_function_table *functions); - -extern void -st_init_bitmap(struct st_context *st); - -extern void -st_destroy_bitmap(struct st_context *st); - -extern void -st_make_bitmap_fragment_program(struct st_context *st, - struct gl_fragment_program *fpIn, - struct gl_fragment_program **fpOut, - GLuint *bitmap_sampler); - -extern void -st_flush_bitmap_cache(struct st_context *st); - -/* Flush bitmap cache and release vertex buffer. Needed at end of - * frame to avoid synchronous rendering. - */ -extern void -st_flush_bitmap(struct st_context *st); - -#else - -static INLINE void -st_init_bitmap_functions(struct dd_function_table *functions) -{ -} - -static INLINE void -st_init_bitmap(struct st_context *st) -{ -} - -static INLINE void -st_destroy_bitmap(struct st_context *st) -{ -} - -static INLINE void -st_flush_bitmap_cache(struct st_context *st) -{ -} - -static INLINE void -st_flush_bitmap(struct st_context *st) -{ -} - -#endif /* FEATURE_drawpix */ - -#endif /* ST_CB_BITMAP_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_CB_BITMAP_H +#define ST_CB_BITMAP_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; +struct gl_fragment_program; +struct st_fragment_program; + +#if FEATURE_drawpix + +extern void +st_init_bitmap_functions(struct dd_function_table *functions); + +extern void +st_init_bitmap(struct st_context *st); + +extern void +st_destroy_bitmap(struct st_context *st); + +extern void +st_make_bitmap_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut, + GLuint *bitmap_sampler); + +extern void +st_flush_bitmap_cache(struct st_context *st); + +/* Flush bitmap cache and release vertex buffer. Needed at end of + * frame to avoid synchronous rendering. + */ +extern void +st_flush_bitmap(struct st_context *st); + +#else + +static INLINE void +st_init_bitmap_functions(struct dd_function_table *functions) +{ +} + +static INLINE void +st_init_bitmap(struct st_context *st) +{ +} + +static INLINE void +st_destroy_bitmap(struct st_context *st) +{ +} + +static INLINE void +st_flush_bitmap_cache(struct st_context *st) +{ +} + +static INLINE void +st_flush_bitmap(struct st_context *st) +{ +} + +#endif /* FEATURE_drawpix */ + +#endif /* ST_CB_BITMAP_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.h b/mesalib/src/mesa/state_tracker/st_cb_blit.h index e378e6789..c6d9a3679 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_blit.h +++ b/mesalib/src/mesa/state_tracker/st_cb_blit.h @@ -1,59 +1,59 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_BLIT_H -#define ST_CB_BLIT_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; - - -extern void -st_init_blit(struct st_context *st); - -extern void -st_destroy_blit(struct st_context *st); - -#if FEATURE_EXT_framebuffer_blit - -extern void -st_init_blit_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_blit_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_EXT_framebuffer_blit */ - -#endif /* ST_CB_BLIT_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_BLIT_H +#define ST_CB_BLIT_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; + + +extern void +st_init_blit(struct st_context *st); + +extern void +st_destroy_blit(struct st_context *st); + +#if FEATURE_EXT_framebuffer_blit + +extern void +st_init_blit_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_blit_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_EXT_framebuffer_blit */ + +#endif /* ST_CB_BLIT_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h index 16abaa856..1c991d208 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h @@ -1,68 +1,68 @@ -/************************************************************************** - * - * Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_BUFFEROBJECTS_H -#define ST_CB_BUFFEROBJECTS_H - -#include "main/compiler.h" -#include "main/mtypes.h" - -struct dd_function_table; -struct pipe_resource; -struct st_context; - -/** - * State_tracker vertex/pixel buffer object, derived from Mesa's - * gl_buffer_object. - */ -struct st_buffer_object -{ - struct gl_buffer_object Base; - struct pipe_resource *buffer; /* GPU storage */ - struct pipe_transfer *transfer; /* In-progress map information */ -}; - - -/** cast wrapper */ -static INLINE struct st_buffer_object * -st_buffer_object(struct gl_buffer_object *obj) -{ - return (struct st_buffer_object *) obj; -} - - -extern void -st_bufferobj_validate_usage(struct st_context *st, - struct st_buffer_object *obj, - unsigned usage); - - -extern void -st_init_bufferobject_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_BUFFEROBJECTS_H +#define ST_CB_BUFFEROBJECTS_H + +#include "main/compiler.h" +#include "main/mtypes.h" + +struct dd_function_table; +struct pipe_resource; +struct st_context; + +/** + * State_tracker vertex/pixel buffer object, derived from Mesa's + * gl_buffer_object. + */ +struct st_buffer_object +{ + struct gl_buffer_object Base; + struct pipe_resource *buffer; /* GPU storage */ + struct pipe_transfer *transfer; /* In-progress map information */ +}; + + +/** cast wrapper */ +static INLINE struct st_buffer_object * +st_buffer_object(struct gl_buffer_object *obj) +{ + return (struct st_buffer_object *) obj; +} + + +extern void +st_bufferobj_validate_usage(struct st_context *st, + struct st_buffer_object *obj, + unsigned usage); + + +extern void +st_init_bufferobject_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_condrender.h b/mesalib/src/mesa/state_tracker/st_cb_condrender.h index 24eb09258..79d0db8d0 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_condrender.h +++ b/mesalib/src/mesa/state_tracker/st_cb_condrender.h @@ -1,37 +1,37 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_CONDRENDER_H -#define ST_CB_CONDRENDER_H - - -struct dd_function_table; - -extern void st_init_cond_render_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_CONDRENDER_H +#define ST_CB_CONDRENDER_H + + +struct dd_function_table; + +extern void st_init_cond_render_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h index 9c02263ea..44d7f5ed1 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h @@ -1,70 +1,70 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_DRAWPIXELS_H -#define ST_CB_DRAWPIXELS_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; - -#if FEATURE_drawpix - -extern void st_init_drawpixels_functions(struct dd_function_table *functions); - -extern void -st_destroy_drawpix(struct st_context *st); - -extern void -st_make_drawpix_fragment_program(struct st_context *st, - struct gl_fragment_program *fpIn, - struct gl_fragment_program **fpOut); - -extern struct gl_fragment_program * -st_make_drawpix_z_stencil_program(struct st_context *st, - GLboolean write_depth, - GLboolean write_stencil); - -#else - -static INLINE void -st_init_drawpixels_functions(struct dd_function_table *functions) -{ -} - -static INLINE void -st_destroy_drawpix(struct st_context *st) -{ -} - -#endif /* FEATURE_drawpix */ - -#endif /* ST_CB_DRAWPIXELS_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_CB_DRAWPIXELS_H +#define ST_CB_DRAWPIXELS_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; + +#if FEATURE_drawpix + +extern void st_init_drawpixels_functions(struct dd_function_table *functions); + +extern void +st_destroy_drawpix(struct st_context *st); + +extern void +st_make_drawpix_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut); + +extern struct gl_fragment_program * +st_make_drawpix_z_stencil_program(struct st_context *st, + GLboolean write_depth, + GLboolean write_stencil); + +#else + +static INLINE void +st_init_drawpixels_functions(struct dd_function_table *functions) +{ +} + +static INLINE void +st_destroy_drawpix(struct st_context *st) +{ +} + +#endif /* FEATURE_drawpix */ + +#endif /* ST_CB_DRAWPIXELS_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.h b/mesalib/src/mesa/state_tracker/st_cb_drawtex.h index 0937b48f8..455da04e6 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.h +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.h @@ -1,41 +1,41 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - **************************************************************************/ - - -#ifndef ST_CB_DRAWTEX_H -#define ST_CB_DRAWTEX_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; - -#if FEATURE_OES_draw_texture - -extern void -st_init_drawtex_functions(struct dd_function_table *functions); - -extern void -st_destroy_drawtex(struct st_context *st); - -#else - -static INLINE void -st_init_drawtex_functions(struct dd_function_table *functions) -{ -} - -static INLINE void -st_destroy_drawtex(struct st_context *st) -{ -} - -#endif /* FEATURE_OES_draw_texture */ - -#endif /* ST_CB_DRAWTEX_H */ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + **************************************************************************/ + + +#ifndef ST_CB_DRAWTEX_H +#define ST_CB_DRAWTEX_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; + +#if FEATURE_OES_draw_texture + +extern void +st_init_drawtex_functions(struct dd_function_table *functions); + +extern void +st_destroy_drawtex(struct st_context *st); + +#else + +static INLINE void +st_init_drawtex_functions(struct dd_function_table *functions) +{ +} + +static INLINE void +st_destroy_drawtex(struct st_context *st) +{ +} + +#endif /* FEATURE_OES_draw_texture */ + +#endif /* ST_CB_DRAWTEX_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.h b/mesalib/src/mesa/state_tracker/st_cb_eglimage.h index b325b0608..48567ed9d 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.h +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.h @@ -1,51 +1,51 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#ifndef ST_CB_EGLIMAGE_H -#define ST_CB_EGLIMAGE_H - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; - -#if FEATURE_OES_EGL_image - -extern void -st_init_eglimage_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_eglimage_functions(struct dd_function_table *functions) -{ -} - -#endif - -#endif /* ST_CB_EGLIMAGE_H */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#ifndef ST_CB_EGLIMAGE_H +#define ST_CB_EGLIMAGE_H + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; + +#if FEATURE_OES_EGL_image + +extern void +st_init_eglimage_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_eglimage_functions(struct dd_function_table *functions) +{ +} + +#endif + +#endif /* ST_CB_EGLIMAGE_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c index d390ba192..9b85a39be 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c @@ -1,309 +1,309 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -/** - * GL_SELECT and GL_FEEDBACK render modes. - * Basically, we use a private instance of the 'draw' module for doing - * selection/feedback. It would be nice to use the transform_feedback - * hardware feature, but it's defined as happening pre-clip and we want - * post-clipped primitives. Also, there's concerns about the efficiency - * of using the hardware for this anyway. - * - * Authors: - * Brian Paul - */ - -#include "main/imports.h" -#include "main/context.h" -#include "main/feedback.h" -#include "main/mfeatures.h" - -#include "vbo/vbo.h" - -#include "st_context.h" -#include "st_draw.h" -#include "st_cb_feedback.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" - -#include "draw/draw_context.h" -#include "draw/draw_pipe.h" - - -#if FEATURE_feedback - -/** - * This is actually used for both feedback and selection. - */ -struct feedback_stage -{ - struct draw_stage stage; /**< Base class */ - struct gl_context *ctx; /**< Rendering context */ - GLboolean reset_stipple_counter; -}; - - -/********************************************************************** - * GL Feedback functions - **********************************************************************/ - -static INLINE struct feedback_stage * -feedback_stage( struct draw_stage *stage ) -{ - return (struct feedback_stage *)stage; -} - - -static void -feedback_vertex(struct gl_context *ctx, const struct draw_context *draw, - const struct vertex_header *v) -{ - const struct st_context *st = st_context(ctx); - GLfloat win[4]; - const GLfloat *color, *texcoord; - GLuint slot; - - /* Recall that Y=0=Top of window for Gallium wincoords */ - win[0] = v->data[0][0]; - win[1] = ctx->DrawBuffer->Height - v->data[0][1]; - win[2] = v->data[0][2]; - win[3] = 1.0F / v->data[0][3]; - - /* XXX - * When we compute vertex layout, save info about position of the - * color and texcoord attribs to use here. - */ - - slot = st->vertex_result_to_slot[VERT_RESULT_COL0]; - if (slot != ~0U) - color = v->data[slot]; - else - color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - - slot = st->vertex_result_to_slot[VERT_RESULT_TEX0]; - if (slot != ~0U) - texcoord = v->data[slot]; - else - texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; - - _mesa_feedback_vertex(ctx, win, color, texcoord); -} - - -static void -feedback_tri( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - struct draw_context *draw = stage->draw; - _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); - _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ - feedback_vertex(fs->ctx, draw, prim->v[0]); - feedback_vertex(fs->ctx, draw, prim->v[1]); - feedback_vertex(fs->ctx, draw, prim->v[2]); -} - - -static void -feedback_line( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - struct draw_context *draw = stage->draw; - if (fs->reset_stipple_counter) { - _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); - fs->reset_stipple_counter = GL_FALSE; - } - else { - _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); - } - feedback_vertex(fs->ctx, draw, prim->v[0]); - feedback_vertex(fs->ctx, draw, prim->v[1]); -} - - -static void -feedback_point( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - struct draw_context *draw = stage->draw; - _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); - feedback_vertex(fs->ctx, draw, prim->v[0]); -} - - -static void -feedback_flush( struct draw_stage *stage, unsigned flags ) -{ - /* no-op */ -} - - -static void -feedback_reset_stipple_counter( struct draw_stage *stage ) -{ - struct feedback_stage *fs = feedback_stage(stage); - fs->reset_stipple_counter = GL_TRUE; -} - - -static void -feedback_destroy( struct draw_stage *stage ) -{ - /* no-op */ -} - -/** - * Create GL feedback drawing stage. - */ -static struct draw_stage * -draw_glfeedback_stage(struct gl_context *ctx, struct draw_context *draw) -{ - struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); - - fs->stage.draw = draw; - fs->stage.next = NULL; - fs->stage.point = feedback_point; - fs->stage.line = feedback_line; - fs->stage.tri = feedback_tri; - fs->stage.flush = feedback_flush; - fs->stage.reset_stipple_counter = feedback_reset_stipple_counter; - fs->stage.destroy = feedback_destroy; - fs->ctx = ctx; - - return &fs->stage; -} - - - -/********************************************************************** - * GL Selection functions - **********************************************************************/ - -static void -select_tri( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); - _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); - _mesa_update_hitflag( fs->ctx, prim->v[2]->data[0][2] ); -} - -static void -select_line( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); - _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); -} - - -static void -select_point( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); -} - - -static void -select_flush( struct draw_stage *stage, unsigned flags ) -{ - /* no-op */ -} - - -static void -select_reset_stipple_counter( struct draw_stage *stage ) -{ - /* no-op */ -} - -static void -select_destroy( struct draw_stage *stage ) -{ - /* no-op */ -} - - -/** - * Create GL selection mode drawing stage. - */ -static struct draw_stage * -draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw) -{ - struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); - - fs->stage.draw = draw; - fs->stage.next = NULL; - fs->stage.point = select_point; - fs->stage.line = select_line; - fs->stage.tri = select_tri; - fs->stage.flush = select_flush; - fs->stage.reset_stipple_counter = select_reset_stipple_counter; - fs->stage.destroy = select_destroy; - fs->ctx = ctx; - - return &fs->stage; -} - - -static void -st_RenderMode(struct gl_context *ctx, GLenum newMode ) -{ - struct st_context *st = st_context(ctx); - struct draw_context *draw = st->draw; - - if (newMode == GL_RENDER) { - /* restore normal VBO draw function */ - vbo_set_draw_func(ctx, st_draw_vbo); - } - else if (newMode == GL_SELECT) { - if (!st->selection_stage) - st->selection_stage = draw_glselect_stage(ctx, draw); - draw_set_rasterize_stage(draw, st->selection_stage); - /* Plug in new vbo draw function */ - vbo_set_draw_func(ctx, st_feedback_draw_vbo); - } - else { - if (!st->feedback_stage) - st->feedback_stage = draw_glfeedback_stage(ctx, draw); - draw_set_rasterize_stage(draw, st->feedback_stage); - /* Plug in new vbo draw function */ - vbo_set_draw_func(ctx, st_feedback_draw_vbo); - /* need to generate/use a vertex program that emits pos/color/tex */ - st->dirty.st |= ST_NEW_VERTEX_PROGRAM; - } -} - - - -void st_init_feedback_functions(struct dd_function_table *functions) -{ - functions->RenderMode = st_RenderMode; -} - -#endif /* FEATURE_feedback */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * GL_SELECT and GL_FEEDBACK render modes. + * Basically, we use a private instance of the 'draw' module for doing + * selection/feedback. It would be nice to use the transform_feedback + * hardware feature, but it's defined as happening pre-clip and we want + * post-clipped primitives. Also, there's concerns about the efficiency + * of using the hardware for this anyway. + * + * Authors: + * Brian Paul + */ + +#include "main/imports.h" +#include "main/context.h" +#include "main/feedback.h" +#include "main/mfeatures.h" + +#include "vbo/vbo.h" + +#include "st_context.h" +#include "st_draw.h" +#include "st_cb_feedback.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" + +#include "draw/draw_context.h" +#include "draw/draw_pipe.h" + + +#if FEATURE_feedback + +/** + * This is actually used for both feedback and selection. + */ +struct feedback_stage +{ + struct draw_stage stage; /**< Base class */ + struct gl_context *ctx; /**< Rendering context */ + GLboolean reset_stipple_counter; +}; + + +/********************************************************************** + * GL Feedback functions + **********************************************************************/ + +static INLINE struct feedback_stage * +feedback_stage( struct draw_stage *stage ) +{ + return (struct feedback_stage *)stage; +} + + +static void +feedback_vertex(struct gl_context *ctx, const struct draw_context *draw, + const struct vertex_header *v) +{ + const struct st_context *st = st_context(ctx); + GLfloat win[4]; + const GLfloat *color, *texcoord; + GLuint slot; + + /* Recall that Y=0=Top of window for Gallium wincoords */ + win[0] = v->data[0][0]; + win[1] = ctx->DrawBuffer->Height - v->data[0][1]; + win[2] = v->data[0][2]; + win[3] = 1.0F / v->data[0][3]; + + /* XXX + * When we compute vertex layout, save info about position of the + * color and texcoord attribs to use here. + */ + + slot = st->vertex_result_to_slot[VERT_RESULT_COL0]; + if (slot != ~0U) + color = v->data[slot]; + else + color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + + slot = st->vertex_result_to_slot[VERT_RESULT_TEX0]; + if (slot != ~0U) + texcoord = v->data[slot]; + else + texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + + _mesa_feedback_vertex(ctx, win, color, texcoord); +} + + +static void +feedback_tri( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + struct draw_context *draw = stage->draw; + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ + feedback_vertex(fs->ctx, draw, prim->v[0]); + feedback_vertex(fs->ctx, draw, prim->v[1]); + feedback_vertex(fs->ctx, draw, prim->v[2]); +} + + +static void +feedback_line( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + struct draw_context *draw = stage->draw; + if (fs->reset_stipple_counter) { + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); + fs->reset_stipple_counter = GL_FALSE; + } + else { + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); + } + feedback_vertex(fs->ctx, draw, prim->v[0]); + feedback_vertex(fs->ctx, draw, prim->v[1]); +} + + +static void +feedback_point( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + struct draw_context *draw = stage->draw; + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); + feedback_vertex(fs->ctx, draw, prim->v[0]); +} + + +static void +feedback_flush( struct draw_stage *stage, unsigned flags ) +{ + /* no-op */ +} + + +static void +feedback_reset_stipple_counter( struct draw_stage *stage ) +{ + struct feedback_stage *fs = feedback_stage(stage); + fs->reset_stipple_counter = GL_TRUE; +} + + +static void +feedback_destroy( struct draw_stage *stage ) +{ + /* no-op */ +} + +/** + * Create GL feedback drawing stage. + */ +static struct draw_stage * +draw_glfeedback_stage(struct gl_context *ctx, struct draw_context *draw) +{ + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); + + fs->stage.draw = draw; + fs->stage.next = NULL; + fs->stage.point = feedback_point; + fs->stage.line = feedback_line; + fs->stage.tri = feedback_tri; + fs->stage.flush = feedback_flush; + fs->stage.reset_stipple_counter = feedback_reset_stipple_counter; + fs->stage.destroy = feedback_destroy; + fs->ctx = ctx; + + return &fs->stage; +} + + + +/********************************************************************** + * GL Selection functions + **********************************************************************/ + +static void +select_tri( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); + _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); + _mesa_update_hitflag( fs->ctx, prim->v[2]->data[0][2] ); +} + +static void +select_line( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); + _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); +} + + +static void +select_point( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); +} + + +static void +select_flush( struct draw_stage *stage, unsigned flags ) +{ + /* no-op */ +} + + +static void +select_reset_stipple_counter( struct draw_stage *stage ) +{ + /* no-op */ +} + +static void +select_destroy( struct draw_stage *stage ) +{ + /* no-op */ +} + + +/** + * Create GL selection mode drawing stage. + */ +static struct draw_stage * +draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw) +{ + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); + + fs->stage.draw = draw; + fs->stage.next = NULL; + fs->stage.point = select_point; + fs->stage.line = select_line; + fs->stage.tri = select_tri; + fs->stage.flush = select_flush; + fs->stage.reset_stipple_counter = select_reset_stipple_counter; + fs->stage.destroy = select_destroy; + fs->ctx = ctx; + + return &fs->stage; +} + + +static void +st_RenderMode(struct gl_context *ctx, GLenum newMode ) +{ + struct st_context *st = st_context(ctx); + struct draw_context *draw = st->draw; + + if (newMode == GL_RENDER) { + /* restore normal VBO draw function */ + vbo_set_draw_func(ctx, st_draw_vbo); + } + else if (newMode == GL_SELECT) { + if (!st->selection_stage) + st->selection_stage = draw_glselect_stage(ctx, draw); + draw_set_rasterize_stage(draw, st->selection_stage); + /* Plug in new vbo draw function */ + vbo_set_draw_func(ctx, st_feedback_draw_vbo); + } + else { + if (!st->feedback_stage) + st->feedback_stage = draw_glfeedback_stage(ctx, draw); + draw_set_rasterize_stage(draw, st->feedback_stage); + /* Plug in new vbo draw function */ + vbo_set_draw_func(ctx, st_feedback_draw_vbo); + /* need to generate/use a vertex program that emits pos/color/tex */ + st->dirty.st |= ST_NEW_VERTEX_PROGRAM; + } +} + + + +void st_init_feedback_functions(struct dd_function_table *functions) +{ + functions->RenderMode = st_RenderMode; +} + +#endif /* FEATURE_feedback */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.h b/mesalib/src/mesa/state_tracker/st_cb_feedback.h index 3acb5b5b3..02e34e402 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.h +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.h @@ -1,52 +1,52 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_FEEDBACK_H -#define ST_CB_FEEDBACK_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; - -#if FEATURE_feedback - -extern void -st_init_feedback_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_feedback_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_feedback */ - -#endif /* ST_CB_FEEDBACK_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_CB_FEEDBACK_H +#define ST_CB_FEEDBACK_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; + +#if FEATURE_feedback + +extern void +st_init_feedback_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_feedback_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_feedback */ + +#endif /* ST_CB_FEEDBACK_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.h b/mesalib/src/mesa/state_tracker/st_cb_flush.h index 1fd0c56d7..598536ba0 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_flush.h +++ b/mesalib/src/mesa/state_tracker/st_cb_flush.h @@ -1,51 +1,51 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_FLUSH_H -#define ST_CB_FLUSH_H - - -#include "pipe/p_compiler.h" - -struct dd_function_table; -struct pipe_fence_handle; -struct st_context; - -extern void -st_init_flush_functions(struct dd_function_table *functions); - -extern void -st_flush(struct st_context *st, - struct pipe_fence_handle **fence); - -extern void -st_finish(struct st_context *st); - - -#endif /* ST_CB_FLUSH_H */ - +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_CB_FLUSH_H +#define ST_CB_FLUSH_H + + +#include "pipe/p_compiler.h" + +struct dd_function_table; +struct pipe_fence_handle; +struct st_context; + +extern void +st_init_flush_functions(struct dd_function_table *functions); + +extern void +st_flush(struct st_context *st, + struct pipe_fence_handle **fence); + +extern void +st_finish(struct st_context *st); + + +#endif /* ST_CB_FLUSH_H */ + diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.h b/mesalib/src/mesa/state_tracker/st_cb_program.h index 05d03e1e6..091a4439c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_program.h +++ b/mesalib/src/mesa/state_tracker/st_cb_program.h @@ -1,38 +1,38 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_PROGRAM_H -#define ST_CB_PROGRAM_H - - -struct dd_function_table; - -extern void -st_init_program_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_PROGRAM_H +#define ST_CB_PROGRAM_H + + +struct dd_function_table; + +extern void +st_init_program_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h index 638dba9ec..03f0be837 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h +++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h @@ -1,70 +1,70 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_QUERYOBJ_H -#define ST_CB_QUERYOBJ_H - - -#include "main/mfeatures.h" -#include "main/mtypes.h" - -/** - * Subclass of gl_query_object - */ -struct st_query_object -{ - struct gl_query_object base; - struct pipe_query *pq; - unsigned type; /**< PIPE_QUERY_x */ -}; - - -/** - * Cast wrapper - */ -static INLINE struct st_query_object * -st_query_object(struct gl_query_object *q) -{ - return (struct st_query_object *) q; -} - - -#if FEATURE_queryobj - -extern void -st_init_query_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_query_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_queryobj */ - -#endif +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_QUERYOBJ_H +#define ST_CB_QUERYOBJ_H + + +#include "main/mfeatures.h" +#include "main/mtypes.h" + +/** + * Subclass of gl_query_object + */ +struct st_query_object +{ + struct gl_query_object base; + struct pipe_query *pq; + unsigned type; /**< PIPE_QUERY_x */ +}; + + +/** + * Cast wrapper + */ +static INLINE struct st_query_object * +st_query_object(struct gl_query_object *q) +{ + return (struct st_query_object *) q; +} + + +#if FEATURE_queryobj + +extern void +st_init_query_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_query_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_queryobj */ + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h index c8fe9d135..b61411bd2 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h +++ b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h @@ -1,50 +1,50 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_RASTERPOS_H -#define ST_CB_RASTERPOS_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; - -#if FEATURE_rastpos - -extern void st_init_rasterpos_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_rasterpos_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_rastpos */ - -#endif /* ST_CB_RASTERPOS_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_RASTERPOS_H +#define ST_CB_RASTERPOS_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; + +#if FEATURE_rastpos + +extern void st_init_rasterpos_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_rasterpos_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_rastpos */ + +#endif /* ST_CB_RASTERPOS_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_strings.c b/mesalib/src/mesa/state_tracker/st_cb_strings.c index b382273ea..21323798f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_strings.c +++ b/mesalib/src/mesa/state_tracker/st_cb_strings.c @@ -1,73 +1,73 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - * Brian Paul - */ - -#include "main/glheader.h" -#include "main/macros.h" -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "util/u_string.h" -#include "st_context.h" -#include "st_cb_strings.h" - -#define ST_VERSION_STRING "0.4" - -static const GLubyte * -st_get_string(struct gl_context * ctx, GLenum name) -{ - struct st_context *st = st_context(ctx); - struct pipe_screen *screen = st->pipe->screen; - - switch (name) { - case GL_VENDOR: { - const char *vendor = screen->get_vendor( screen ); - util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor); - return (GLubyte *) st->vendor; - } - - case GL_RENDERER: - util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s on %s", - ST_VERSION_STRING, - screen->get_name( screen )); - - return (GLubyte *) st->renderer; - - default: - return NULL; - } -} - - -void st_init_string_functions(struct dd_function_table *functions) -{ - functions->GetString = st_get_string; -} +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + +#include "main/glheader.h" +#include "main/macros.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "util/u_string.h" +#include "st_context.h" +#include "st_cb_strings.h" + +#define ST_VERSION_STRING "0.4" + +static const GLubyte * +st_get_string(struct gl_context * ctx, GLenum name) +{ + struct st_context *st = st_context(ctx); + struct pipe_screen *screen = st->pipe->screen; + + switch (name) { + case GL_VENDOR: { + const char *vendor = screen->get_vendor( screen ); + util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor); + return (GLubyte *) st->vendor; + } + + case GL_RENDERER: + util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s on %s", + ST_VERSION_STRING, + screen->get_name( screen )); + + return (GLubyte *) st->renderer; + + default: + return NULL; + } +} + + +void st_init_string_functions(struct dd_function_table *functions) +{ + functions->GetString = st_get_string; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_strings.h b/mesalib/src/mesa/state_tracker/st_cb_strings.h index 5b4fc2a72..92d5d2d9b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_strings.h +++ b/mesalib/src/mesa/state_tracker/st_cb_strings.h @@ -1,40 +1,40 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_STRINGS_H -#define ST_CB_STRINGS_H - - -struct dd_function_table; - -extern void -st_init_string_functions(struct dd_function_table *functions); - - -#endif /* ST_CB_CLEAR_H */ - +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_CB_STRINGS_H +#define ST_CB_STRINGS_H + + +struct dd_function_table; + +extern void +st_init_string_functions(struct dd_function_table *functions); + + +#endif /* ST_CB_CLEAR_H */ + diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c index 7e243561a..d575a8497 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c +++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c @@ -1,122 +1,122 @@ -/************************************************************************** - * - * Copyright 2011 Marek Olšák - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Marek Olšák - */ - -#include "main/glheader.h" -#include "main/macros.h" -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "st_context.h" -#include "st_cb_syncobj.h" - -struct st_sync_object { - struct gl_sync_object b; - - struct pipe_fence_handle *fence; -}; - - -static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx, - GLenum type) -{ - if (type == GL_SYNC_FENCE) - return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object); - else - return NULL; -} - -static void st_delete_sync_object(struct gl_context *ctx, - struct gl_sync_object *obj) -{ - struct pipe_screen *screen = st_context(ctx)->pipe->screen; - struct st_sync_object *so = (struct st_sync_object*)obj; - - screen->fence_reference(screen, &so->fence, NULL); - FREE(so); -} - -static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, - GLenum condition, GLbitfield flags) -{ - struct pipe_context *pipe = st_context(ctx)->pipe; - struct st_sync_object *so = (struct st_sync_object*)obj; - - assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0); - assert(so->fence == NULL); - - pipe->flush(pipe, &so->fence); -} - -static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) -{ - struct pipe_screen *screen = st_context(ctx)->pipe->screen; - struct st_sync_object *so = (struct st_sync_object*)obj; - - if (so->fence && screen->fence_signalled(screen, so->fence)) { - screen->fence_reference(screen, &so->fence, NULL); - so->b.StatusFlag = GL_TRUE; - } -} - -static void st_client_wait_sync(struct gl_context *ctx, - struct gl_sync_object *obj, - GLbitfield flags, GLuint64 timeout) -{ - struct pipe_screen *screen = st_context(ctx)->pipe->screen; - struct st_sync_object *so = (struct st_sync_object*)obj; - - /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is - * already called when creating a fence. */ - - if (so->fence && - screen->fence_finish(screen, so->fence, timeout)) { - screen->fence_reference(screen, &so->fence, NULL); - so->b.StatusFlag = GL_TRUE; - } -} - -static void st_server_wait_sync(struct gl_context *ctx, - struct gl_sync_object *obj, - GLbitfield flags, GLuint64 timeout) -{ - /* NO-OP. - * Neither Gallium nor DRM interfaces support blocking on the GPU. */ -} - -void st_init_syncobj_functions(struct dd_function_table *functions) -{ - functions->NewSyncObject = st_new_sync_object; - functions->FenceSync = st_fence_sync; - functions->DeleteSyncObject = st_delete_sync_object; - functions->CheckSync = st_check_sync; - functions->ClientWaitSync = st_client_wait_sync; - functions->ServerWaitSync = st_server_wait_sync; -} +/************************************************************************** + * + * Copyright 2011 Marek Olšák + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Marek Olšák + */ + +#include "main/glheader.h" +#include "main/macros.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "st_context.h" +#include "st_cb_syncobj.h" + +struct st_sync_object { + struct gl_sync_object b; + + struct pipe_fence_handle *fence; +}; + + +static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx, + GLenum type) +{ + if (type == GL_SYNC_FENCE) + return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object); + else + return NULL; +} + +static void st_delete_sync_object(struct gl_context *ctx, + struct gl_sync_object *obj) +{ + struct pipe_screen *screen = st_context(ctx)->pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + + screen->fence_reference(screen, &so->fence, NULL); + FREE(so); +} + +static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, + GLenum condition, GLbitfield flags) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + struct st_sync_object *so = (struct st_sync_object*)obj; + + assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0); + assert(so->fence == NULL); + + pipe->flush(pipe, &so->fence); +} + +static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) +{ + struct pipe_screen *screen = st_context(ctx)->pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + + if (so->fence && screen->fence_signalled(screen, so->fence)) { + screen->fence_reference(screen, &so->fence, NULL); + so->b.StatusFlag = GL_TRUE; + } +} + +static void st_client_wait_sync(struct gl_context *ctx, + struct gl_sync_object *obj, + GLbitfield flags, GLuint64 timeout) +{ + struct pipe_screen *screen = st_context(ctx)->pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + + /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is + * already called when creating a fence. */ + + if (so->fence && + screen->fence_finish(screen, so->fence, timeout)) { + screen->fence_reference(screen, &so->fence, NULL); + so->b.StatusFlag = GL_TRUE; + } +} + +static void st_server_wait_sync(struct gl_context *ctx, + struct gl_sync_object *obj, + GLbitfield flags, GLuint64 timeout) +{ + /* NO-OP. + * Neither Gallium nor DRM interfaces support blocking on the GPU. */ +} + +void st_init_syncobj_functions(struct dd_function_table *functions) +{ + functions->NewSyncObject = st_new_sync_object; + functions->FenceSync = st_fence_sync; + functions->DeleteSyncObject = st_delete_sync_object; + functions->CheckSync = st_check_sync; + functions->ClientWaitSync = st_client_wait_sync; + functions->ServerWaitSync = st_server_wait_sync; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index b24f9a1ce..9d1b7f672 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -530,62 +530,31 @@ prep_teximage(struct gl_context *ctx, struct gl_texture_image *texImage, static void -st_TexImage3D(struct gl_context * ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *unpack) +st_TexImage(struct gl_context * ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *unpack) { prep_teximage(ctx, texImage, internalFormat, width, height, depth, border, format, type); - _mesa_store_teximage3d(ctx, texImage, internalFormat, width, height, depth, - border, format, type, pixels, unpack); -} - - -static void -st_TexImage2D(struct gl_context * ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *unpack) -{ - prep_teximage(ctx, texImage, internalFormat, width, height, 1, border, - format, type); - _mesa_store_teximage2d(ctx, texImage, internalFormat, width, height, - border, format, type, pixels, unpack); -} - - -static void -st_TexImage1D(struct gl_context * ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *unpack) -{ - prep_teximage(ctx, texImage, internalFormat, width, 1, 1, border, - format, type); - _mesa_store_teximage1d(ctx, texImage, internalFormat, width, - border, format, type, pixels, unpack); + _mesa_store_teximage(ctx, dims, texImage, internalFormat, width, height, depth, + border, format, type, pixels, unpack); } static void -st_CompressedTexImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data) +st_CompressedTexImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint border, GLint depth, + GLsizei imageSize, const GLvoid *data) { - prep_teximage(ctx, texImage, internalFormat, width, 1, 1, border, + prep_teximage(ctx, texImage, internalFormat, width, height, depth, border, GL_NONE, GL_NONE); - _mesa_store_compressed_teximage2d(ctx, texImage, internalFormat, width, - height, border, imageSize, data); + _mesa_store_compressed_teximage(ctx, dims, texImage, internalFormat, width, + height, depth, border, imageSize, data); } @@ -959,12 +928,11 @@ compatible_src_dst_formats(struct gl_context *ctx, * Note: srcY=0=Bottom of renderbuffer (GL convention) */ static void -st_copy_texsubimage(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint destX, GLint destY, GLint destZ, - struct gl_renderbuffer *rb, - GLint srcX, GLint srcY, - GLsizei width, GLsizei height) +st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint destX, GLint destY, GLint destZ, + struct gl_renderbuffer *rb, + GLint srcX, GLint srcY, GLsizei width, GLsizei height) { struct st_texture_image *stImage = st_texture_image(texImage); const GLenum texBaseFormat = texImage->_BaseFormat; @@ -1127,49 +1095,6 @@ fallback: } - -static void -st_CopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width) -{ - const GLint yoffset = 0, zoffset = 0; - const GLsizei height = 1; - st_copy_texsubimage(ctx, texImage, - xoffset, yoffset, zoffset, /* destX,Y,Z */ - rb, x, y, width, height); /* src X, Y, size */ -} - - -static void -st_CopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - const GLint zoffset = 0; - st_copy_texsubimage(ctx, texImage, - xoffset, yoffset, zoffset, /* destX,Y,Z */ - rb, x, y, width, height); /* src X, Y, size */ -} - - -static void -st_CopyTexSubImage3D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - st_copy_texsubimage(ctx, texImage, - xoffset, yoffset, zoffset, /* destX,Y,Z */ - rb, x, y, width, height); /* src X, Y, size */ -} - - /** * Copy image data from stImage into the texture object 'stObj' at level * 'dstLevel'. @@ -1427,24 +1352,16 @@ void st_init_texture_functions(struct dd_function_table *functions) { functions->ChooseTextureFormat = st_ChooseTextureFormat; - functions->TexImage1D = st_TexImage1D; - functions->TexImage2D = st_TexImage2D; - functions->TexImage3D = st_TexImage3D; - functions->TexSubImage1D = _mesa_store_texsubimage1d; - functions->TexSubImage2D = _mesa_store_texsubimage2d; - functions->TexSubImage3D = _mesa_store_texsubimage3d; - functions->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; - functions->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; - functions->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; - functions->CopyTexSubImage1D = st_CopyTexSubImage1D; - functions->CopyTexSubImage2D = st_CopyTexSubImage2D; - functions->CopyTexSubImage3D = st_CopyTexSubImage3D; + functions->TexImage = st_TexImage; + functions->TexSubImage = _mesa_store_texsubimage; + functions->CompressedTexSubImage = _mesa_store_compressed_texsubimage; + functions->CopyTexSubImage = st_CopyTexSubImage; functions->GenerateMipmap = st_generate_mipmap; functions->GetTexImage = st_GetTexImage; /* compressed texture functions */ - functions->CompressedTexImage2D = st_CompressedTexImage2D; + functions->CompressedTexImage = st_CompressedTexImage; functions->GetCompressedTexImage = _mesa_get_compressed_teximage; functions->NewTextureObject = st_NewTextureObject; diff --git a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c index 36668d343..2f1a22b58 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c @@ -1,60 +1,60 @@ -/************************************************************************** - * - * Copyright 2011 Marek Olšák - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -/** - * glTextureBarrierNV function - * - * \author Marek Olšák - */ - - -#include "main/imports.h" -#include "main/context.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "st_context.h" -#include "st_cb_texturebarrier.h" - - -/** - * Called via ctx->Driver.TextureBarrier() - */ -static void -st_TextureBarrier(struct gl_context *ctx) -{ - struct pipe_context *pipe = st_context(ctx)->pipe; - - pipe->texture_barrier(pipe); -} - - -void st_init_texture_barrier_functions(struct dd_function_table *functions) -{ - functions->TextureBarrier = st_TextureBarrier; -} +/************************************************************************** + * + * Copyright 2011 Marek Olšák + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +/** + * glTextureBarrierNV function + * + * \author Marek Olšák + */ + + +#include "main/imports.h" +#include "main/context.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "st_context.h" +#include "st_cb_texturebarrier.h" + + +/** + * Called via ctx->Driver.TextureBarrier() + */ +static void +st_TextureBarrier(struct gl_context *ctx) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + + pipe->texture_barrier(pipe); +} + + +void st_init_texture_barrier_functions(struct dd_function_table *functions) +{ + functions->TextureBarrier = st_TextureBarrier; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h index dc94cc443..3b7d3776f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h +++ b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h @@ -1,37 +1,37 @@ -/************************************************************************** - * - * Copyright 2011 Marek Olšák - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_TEXTUREBARRIER_H -#define ST_CB_TEXTUREBARRIER_H - - -struct dd_function_table; - -extern void st_init_texture_barrier_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2011 Marek Olšák + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_TEXTUREBARRIER_H +#define ST_CB_TEXTUREBARRIER_H + + +struct dd_function_table; + +extern void st_init_texture_barrier_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_viewport.h b/mesalib/src/mesa/state_tracker/st_cb_viewport.h index 7307aba1b..bcfd7cb68 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_viewport.h +++ b/mesalib/src/mesa/state_tracker/st_cb_viewport.h @@ -1,36 +1,36 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_VIEWPORT_H -#define ST_CB_VIEWPORT_H - -struct dd_function_table; - -extern void -st_init_viewport_functions(struct dd_function_table *functions); - -#endif /* ST_CB_VIEW_PORT_H */ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_CB_VIEWPORT_H +#define ST_CB_VIEWPORT_H + +struct dd_function_table; + +extern void +st_init_viewport_functions(struct dd_function_table *functions); + +#endif /* ST_CB_VIEW_PORT_H */ diff --git a/mesalib/src/mesa/state_tracker/st_debug.h b/mesalib/src/mesa/state_tracker/st_debug.h index 07864845f..4a060d775 100644 --- a/mesalib/src/mesa/state_tracker/st_debug.h +++ b/mesalib/src/mesa/state_tracker/st_debug.h @@ -1,72 +1,72 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_DEBUG_H -#define ST_DEBUG_H - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -extern void -st_print_current(void); - - -#define DEBUG_MESA 0x1 -#define DEBUG_TGSI 0x2 -#define DEBUG_CONSTANTS 0x4 -#define DEBUG_PIPE 0x8 -#define DEBUG_TEX 0x10 -#define DEBUG_FALLBACK 0x20 -#define DEBUG_QUERY 0x40 -#define DEBUG_SCREEN 0x80 - -#ifdef DEBUG -extern int ST_DEBUG; -#define DBSTR(x) x -#else -#define ST_DEBUG 0 -#define DBSTR(x) "" -#endif - -void st_debug_init( void ); - -static INLINE void -ST_DBG( unsigned flag, const char *fmt, ... ) -{ - if (ST_DEBUG & flag) - { - va_list args; - - va_start( args, fmt ); - debug_vprintf( fmt, args ); - va_end( args ); - } -} - - -#endif /* ST_DEBUG_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_DEBUG_H +#define ST_DEBUG_H + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +extern void +st_print_current(void); + + +#define DEBUG_MESA 0x1 +#define DEBUG_TGSI 0x2 +#define DEBUG_CONSTANTS 0x4 +#define DEBUG_PIPE 0x8 +#define DEBUG_TEX 0x10 +#define DEBUG_FALLBACK 0x20 +#define DEBUG_QUERY 0x40 +#define DEBUG_SCREEN 0x80 + +#ifdef DEBUG +extern int ST_DEBUG; +#define DBSTR(x) x +#else +#define ST_DEBUG 0 +#define DBSTR(x) "" +#endif + +void st_debug_init( void ); + +static INLINE void +ST_DBG( unsigned flag, const char *fmt, ... ) +{ + if (ST_DEBUG & flag) + { + va_list args; + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); + } +} + + +#endif /* ST_DEBUG_H */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 953155f36..a9071f58c 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -592,6 +592,10 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.S3_s3tc = GL_FALSE; } + if (ctx->Const.NativeIntegers) { + ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; + } + if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { #if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.h b/mesalib/src/mesa/state_tracker/st_extensions.h index f29f9e1cf..aa9b2b2b9 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.h +++ b/mesalib/src/mesa/state_tracker/st_extensions.h @@ -1,40 +1,40 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_EXTENSIONS_H -#define ST_EXTENSIONS_H - - -struct st_context; - -extern void st_init_limits(struct st_context *st); - -extern void st_init_extensions(struct st_context *st); - - -#endif /* ST_EXTENSIONS_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_EXTENSIONS_H +#define ST_EXTENSIONS_H + + +struct st_context; + +extern void st_init_limits(struct st_context *st); + +extern void st_init_extensions(struct st_context *st); + + +#endif /* ST_EXTENSIONS_H */ diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h index 8a361a1f6..815c6a516 100644 --- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h +++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h @@ -1,52 +1,52 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_GEN_MIPMAP_H -#define ST_GEN_MIPMAP_H - - -#include "main/glheader.h" - -struct gl_context; -struct gl_texture_object; -struct st_context; - -extern void -st_init_generate_mipmap(struct st_context *st); - - -extern void -st_destroy_generate_mipmap(struct st_context *st); - - -extern void -st_generate_mipmap(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj); - - -#endif /* ST_GEN_MIPMAP_H */ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_GEN_MIPMAP_H +#define ST_GEN_MIPMAP_H + + +#include "main/glheader.h" + +struct gl_context; +struct gl_texture_object; +struct st_context; + +extern void +st_init_generate_mipmap(struct st_context *st); + + +extern void +st_destroy_generate_mipmap(struct st_context *st); + + +extern void +st_generate_mipmap(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj); + + +#endif /* ST_GEN_MIPMAP_H */ diff --git a/mesalib/src/mesa/state_tracker/st_gl_api.h b/mesalib/src/mesa/state_tracker/st_gl_api.h index 59782d0d5..55ad778c9 100644 --- a/mesalib/src/mesa/state_tracker/st_gl_api.h +++ b/mesalib/src/mesa/state_tracker/st_gl_api.h @@ -1,7 +1,7 @@ - -#ifndef ST_GL_API_H -#define ST_GL_API_H - -struct st_api *st_gl_api_create(void); - -#endif + +#ifndef ST_GL_API_H +#define ST_GL_API_H + +struct st_api *st_gl_api_create(void); + +#endif 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 e8d60f80d..347a22f19 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1762,6 +1762,12 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) else emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]); break; + case ir_unop_bitcast_f2i: + case ir_unop_bitcast_f2u: + case ir_unop_bitcast_i2f: + case ir_unop_bitcast_u2f: + result_src = op[0]; + break; case ir_unop_f2b: emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0)); break; diff --git a/mesalib/src/mesa/state_tracker/st_manager.h b/mesalib/src/mesa/state_tracker/st_manager.h index ffe394cc4..6a9497839 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.h +++ b/mesalib/src/mesa/state_tracker/st_manager.h @@ -1,52 +1,52 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#ifndef ST_MANAGER_H -#define ST_MANAGER_H - -#include "main/mtypes.h" - -#include "pipe/p_compiler.h" - -struct st_context; - -struct pipe_surface * -st_manager_get_egl_image_surface(struct st_context *st, - void *eglimg, unsigned usage); - -void -st_manager_flush_frontbuffer(struct st_context *st); - -void -st_manager_validate_framebuffers(struct st_context *st); - -boolean -st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb, - gl_buffer_index idx); - -#endif /* ST_MANAGER_H */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#ifndef ST_MANAGER_H +#define ST_MANAGER_H + +#include "main/mtypes.h" + +#include "pipe/p_compiler.h" + +struct st_context; + +struct pipe_surface * +st_manager_get_egl_image_surface(struct st_context *st, + void *eglimg, unsigned usage); + +void +st_manager_flush_frontbuffer(struct st_context *st); + +void +st_manager_validate_framebuffers(struct st_context *st); + +boolean +st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb, + gl_buffer_index idx); + +#endif /* ST_MANAGER_H */ -- cgit v1.2.3