diff options
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_fs_exec.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_fs_exec.c | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_fs_exec.c b/src/gallium/drivers/llvmpipe/lp_fs_exec.c deleted file mode 100644 index ea85697fe2..0000000000 --- a/src/gallium/drivers/llvmpipe/lp_fs_exec.c +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -/** - * Execute fragment shader using the TGSI interpreter. - */ - -#include "lp_context.h" -#include "lp_state.h" -#include "lp_fs.h" -#include "lp_quad.h" - -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "util/u_memory.h" -#include "tgsi/tgsi_exec.h" -#include "tgsi/tgsi_parse.h" - - -/** - * Subclass of lp_fragment_shader - */ -struct lp_exec_fragment_shader -{ - struct lp_fragment_shader base; - /* No other members for now */ -}; - - -/** cast wrapper */ -static INLINE struct lp_exec_fragment_shader * -lp_exec_fragment_shader(const struct lp_fragment_shader *base) -{ - return (struct lp_exec_fragment_shader *) base; -} - - -/** - * Compute quad X,Y,Z,W for the four fragments in a quad. - * - * This should really be part of the compiled shader. - */ -void -lp_setup_pos_vector(const struct tgsi_interp_coef *coef, - float x, float y, - struct tgsi_exec_vector *quadpos) -{ - uint chan; - /* do X */ - quadpos->xyzw[0].f[0] = x; - quadpos->xyzw[0].f[1] = x + 1; - quadpos->xyzw[0].f[2] = x; - quadpos->xyzw[0].f[3] = x + 1; - - /* do Y */ - quadpos->xyzw[1].f[0] = y; - quadpos->xyzw[1].f[1] = y; - quadpos->xyzw[1].f[2] = y + 1; - quadpos->xyzw[1].f[3] = y + 1; - - /* do Z and W for all fragments in the quad */ - for (chan = 2; chan < 4; chan++) { - const float dadx = coef->dadx[chan]; - const float dady = coef->dady[chan]; - const float a0 = coef->a0[chan] + dadx * x + dady * y; - quadpos->xyzw[chan].f[0] = a0; - quadpos->xyzw[chan].f[1] = a0 + dadx; - quadpos->xyzw[chan].f[2] = a0 + dady; - quadpos->xyzw[chan].f[3] = a0 + dadx + dady; - } -} - - -static void -exec_prepare( const struct lp_fragment_shader *base, - struct tgsi_exec_machine *machine, - struct tgsi_sampler **samplers ) -{ - /* - * Bind tokens/shader to the interpreter's machine state. - * Avoid redundant binding. - */ - if (machine->Tokens != base->shader.tokens) { - tgsi_exec_machine_bind_shader( machine, - base->shader.tokens, - PIPE_MAX_SAMPLERS, - samplers ); - } -} - - -/* TODO: hide the machine struct in here somewhere, remove from this - * interface: - */ -static unsigned -exec_run( const struct lp_fragment_shader *base, - struct tgsi_exec_machine *machine, - struct quad_header *quad ) -{ - /* Compute X, Y, Z, W vals for this quad */ - lp_setup_pos_vector(quad->posCoef, - (float)quad->input.x0, (float)quad->input.y0, - &machine->QuadPos); - - return tgsi_exec_machine_run( machine ); -} - - -static void -exec_delete( struct lp_fragment_shader *base ) -{ - FREE((void *) base->shader.tokens); - FREE(base); -} - - -struct lp_fragment_shader * -llvmpipe_create_fs_exec(struct llvmpipe_context *llvmpipe, - const struct pipe_shader_state *templ) -{ - struct lp_exec_fragment_shader *shader; - - /* Decide whether we'll be codegenerating this shader and if so do - * that now. - */ - - shader = CALLOC_STRUCT(lp_exec_fragment_shader); - if (!shader) - return NULL; - - /* we need to keep a local copy of the tokens */ - shader->base.shader.tokens = tgsi_dup_tokens(templ->tokens); - shader->base.prepare = exec_prepare; - shader->base.run = exec_run; - shader->base.delete = exec_delete; - - return &shader->base; -} |