Keith Whitwell | f069e5e | 2005-04-21 13:13:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Keith Whitwell | f069e5e | 2005-04-21 13:13:49 +0000 | [diff] [blame] | 3 | * |
José Fonseca | 8771285 | 2014-01-17 16:27:50 +0000 | [diff] [blame] | 4 | * Copyright (C) 2007 VMware, Inc. All Rights Reserved. |
Keith Whitwell | f069e5e | 2005-04-21 13:13:49 +0000 | [diff] [blame] | 5 | * |
| 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é Fonseca | 8771285 | 2014-01-17 16:27:50 +0000 | [diff] [blame] | 19 | * VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
Keith Whitwell | 5f534aa | 2005-04-29 17:32:27 +0000 | [diff] [blame] | 20 | * WHETHER IN |
Keith Whitwell | f069e5e | 2005-04-21 13:13:49 +0000 | [diff] [blame] | 21 | * 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 Paul | bbd2871 | 2008-09-18 12:26:54 -0600 | [diff] [blame] | 32 | #include "main/glheader.h" |
Keith Whitwell | 32ef6e7 | 2008-09-20 08:26:11 -0700 | [diff] [blame] | 33 | #include "main/ffvertex_prog.h" |
Vinson Lee | 176a835 | 2010-12-30 00:50:56 -0800 | [diff] [blame] | 34 | #include "main/mtypes.h" |
Keith Whitwell | f069e5e | 2005-04-21 13:13:49 +0000 | [diff] [blame] | 35 | #include "t_vp_build.h" |
| 36 | |
Keith Whitwell | f069e5e | 2005-04-21 13:13:49 +0000 | [diff] [blame] | 37 | |
Brian | 6dd98e9 | 2007-08-31 16:42:05 -0600 | [diff] [blame] | 38 | /** |
Keith Whitwell | 32ef6e7 | 2008-09-20 08:26:11 -0700 | [diff] [blame] | 39 | * XXX This should go away someday, but still referenced by some drivers... |
Brian | 6dd98e9 | 2007-08-31 16:42:05 -0600 | [diff] [blame] | 40 | */ |
Kristian Høgsberg | f9995b3 | 2010-10-12 12:26:10 -0400 | [diff] [blame] | 41 | void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ) |
Keith Whitwell | a853488 | 2005-06-09 14:52:08 +0000 | [diff] [blame] | 42 | { |
Timothy Arceri | 81faead | 2016-10-19 12:30:09 +1100 | [diff] [blame] | 43 | const struct gl_program *prev = ctx->VertexProgram._Current; |
Keith Whitwell | a853488 | 2005-06-09 14:52:08 +0000 | [diff] [blame] | 44 | |
Nicolai Haehnle | dba21ed | 2007-04-02 20:59:51 +0200 | [diff] [blame] | 45 | if (!ctx->VertexProgram._Current || |
| 46 | ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) { |
Keith Whitwell | 32ef6e7 | 2008-09-20 08:26:11 -0700 | [diff] [blame] | 47 | ctx->VertexProgram._Current |
| 48 | = ctx->VertexProgram._TnlProgram |
| 49 | = _mesa_get_fixed_func_vertex_program(ctx); |
Keith Whitwell | a853488 | 2005-06-09 14:52:08 +0000 | [diff] [blame] | 50 | } |
| 51 | |
Keith Whitwell | c3626a9 | 2005-11-01 17:25:49 +0000 | [diff] [blame] | 52 | /* Tell the driver about the change. Could define a new target for |
| 53 | * this? |
Keith Whitwell | a853488 | 2005-06-09 14:52:08 +0000 | [diff] [blame] | 54 | */ |
Brian | a328e46 | 2006-12-13 14:58:13 -0700 | [diff] [blame] | 55 | if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) { |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 56 | ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, |
Timothy Arceri | 81faead | 2016-10-19 12:30:09 +1100 | [diff] [blame] | 57 | ctx->VertexProgram._Current); |
Brian | a328e46 | 2006-12-13 14:58:13 -0700 | [diff] [blame] | 58 | } |
Keith Whitwell | a853488 | 2005-06-09 14:52:08 +0000 | [diff] [blame] | 59 | } |