blob: 18d105f5fd02ef75a856a40dd2dcdb6ba90cb87c [file] [log] [blame]
Keith Whitwellf069e5e2005-04-21 13:13:49 +00001/*
2 * Mesa 3-D graphics library
Keith Whitwellf069e5e2005-04-21 13:13:49 +00003 *
José Fonseca87712852014-01-17 16:27:50 +00004 * Copyright (C) 2007 VMware, Inc. All Rights Reserved.
Keith Whitwellf069e5e2005-04-21 13:13:49 +00005 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
José Fonseca87712852014-01-17 16:27:50 +000019 * VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
Keith Whitwell5f534aa2005-04-29 17:32:27 +000020 * WHETHER IN
Keith Whitwellf069e5e2005-04-21 13:13:49 +000021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25/**
26 * \file t_vp_build.c
27 * Create a vertex program to execute the current fixed function T&L pipeline.
28 * \author Keith Whitwell
29 */
30
31
Brian Paulbbd28712008-09-18 12:26:54 -060032#include "main/glheader.h"
Keith Whitwell32ef6e72008-09-20 08:26:11 -070033#include "main/ffvertex_prog.h"
Vinson Lee176a8352010-12-30 00:50:56 -080034#include "main/mtypes.h"
Keith Whitwellf069e5e2005-04-21 13:13:49 +000035#include "t_vp_build.h"
36
Keith Whitwellf069e5e2005-04-21 13:13:49 +000037
Brian6dd98e92007-08-31 16:42:05 -060038/**
Keith Whitwell32ef6e72008-09-20 08:26:11 -070039 * XXX This should go away someday, but still referenced by some drivers...
Brian6dd98e92007-08-31 16:42:05 -060040 */
Kristian Høgsbergf9995b32010-10-12 12:26:10 -040041void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
Keith Whitwella8534882005-06-09 14:52:08 +000042{
Timothy Arceri81faead2016-10-19 12:30:09 +110043 const struct gl_program *prev = ctx->VertexProgram._Current;
Keith Whitwella8534882005-06-09 14:52:08 +000044
Nicolai Haehnledba21ed2007-04-02 20:59:51 +020045 if (!ctx->VertexProgram._Current ||
46 ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
Keith Whitwell32ef6e72008-09-20 08:26:11 -070047 ctx->VertexProgram._Current
48 = ctx->VertexProgram._TnlProgram
49 = _mesa_get_fixed_func_vertex_program(ctx);
Keith Whitwella8534882005-06-09 14:52:08 +000050 }
51
Keith Whitwellc3626a92005-11-01 17:25:49 +000052 /* Tell the driver about the change. Could define a new target for
53 * this?
Keith Whitwella8534882005-06-09 14:52:08 +000054 */
Briana328e462006-12-13 14:58:13 -070055 if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) {
Brian Paul122629f2006-07-20 16:49:57 +000056 ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
Timothy Arceri81faead2016-10-19 12:30:09 +110057 ctx->VertexProgram._Current);
Briana328e462006-12-13 14:58:13 -070058 }
Keith Whitwella8534882005-06-09 14:52:08 +000059}