2007-09-25 14:21:18 -06:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* State validation for vertex/fragment shaders.
|
|
|
|
* Note that we have to delay most vertex/fragment shader translation
|
|
|
|
* until rendering time since the linkage between the vertex outputs and
|
|
|
|
* fragment inputs can vary depending on the pairing of shaders.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Brian Paul
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "main/imports.h"
|
|
|
|
#include "main/mtypes.h"
|
2008-08-18 16:10:01 -06:00
|
|
|
#include "main/macros.h"
|
2008-05-07 08:55:33 -06:00
|
|
|
#include "shader/program.h"
|
2007-09-25 14:21:18 -06:00
|
|
|
|
|
|
|
#include "pipe/p_context.h"
|
2007-11-23 13:28:16 +00:00
|
|
|
#include "pipe/p_shader_tokens.h"
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2008-05-07 16:44:33 -06:00
|
|
|
#include "util/u_simple_shaders.h"
|
|
|
|
|
2008-03-11 18:54:31 -06:00
|
|
|
#include "cso_cache/cso_context.h"
|
2008-01-14 19:12:46 -07:00
|
|
|
|
2007-09-25 14:21:18 -06:00
|
|
|
#include "st_context.h"
|
|
|
|
#include "st_atom.h"
|
|
|
|
#include "st_program.h"
|
|
|
|
#include "st_atom_shader.h"
|
2007-10-27 09:03:15 -06:00
|
|
|
#include "st_mesa_to_tgsi.h"
|
2007-09-25 14:21:18 -06:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2007-09-28 15:39:09 -06:00
|
|
|
* This represents a vertex program, especially translated to match
|
|
|
|
* the inputs of a particular fragment shader.
|
2007-09-25 14:21:18 -06:00
|
|
|
*/
|
2007-09-28 15:39:09 -06:00
|
|
|
struct translated_vertex_program
|
2007-09-25 14:21:18 -06:00
|
|
|
{
|
2007-10-01 13:45:53 -06:00
|
|
|
struct st_vertex_program *master;
|
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/** The fragment shader "signature" this vertex shader is meant for: */
|
|
|
|
GLbitfield frag_inputs;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/** Compared against master vertex program's serialNo: */
|
|
|
|
GLuint serialNo;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/** Maps VERT_RESULT_x to slot */
|
|
|
|
GLuint output_to_slot[VERT_RESULT_MAX];
|
2008-08-18 16:10:01 -06:00
|
|
|
ubyte output_to_semantic_name[VERT_RESULT_MAX];
|
|
|
|
ubyte output_to_semantic_index[VERT_RESULT_MAX];
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2008-01-14 19:12:46 -07:00
|
|
|
/** Pointer to the translated vertex program */
|
|
|
|
struct st_vertex_program *vp;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
struct translated_vertex_program *next; /**< next in linked list */
|
2007-09-25 14:21:18 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Given a vertex program output attribute, return the corresponding
|
|
|
|
* fragment program input attribute.
|
|
|
|
* \return -1 for vertex outputs that have no corresponding fragment input
|
|
|
|
*/
|
|
|
|
static GLint
|
|
|
|
vp_out_to_fp_in(GLuint vertResult)
|
|
|
|
{
|
|
|
|
if (vertResult >= VERT_RESULT_TEX0 &&
|
|
|
|
vertResult < VERT_RESULT_TEX0 + MAX_TEXTURE_COORD_UNITS)
|
|
|
|
return FRAG_ATTRIB_TEX0 + (vertResult - VERT_RESULT_TEX0);
|
|
|
|
|
|
|
|
if (vertResult >= VERT_RESULT_VAR0 &&
|
|
|
|
vertResult < VERT_RESULT_VAR0 + MAX_VARYING)
|
|
|
|
return FRAG_ATTRIB_VAR0 + (vertResult - VERT_RESULT_VAR0);
|
|
|
|
|
|
|
|
switch (vertResult) {
|
|
|
|
case VERT_RESULT_HPOS:
|
|
|
|
return FRAG_ATTRIB_WPOS;
|
|
|
|
case VERT_RESULT_COL0:
|
|
|
|
return FRAG_ATTRIB_COL0;
|
|
|
|
case VERT_RESULT_COL1:
|
|
|
|
return FRAG_ATTRIB_COL1;
|
|
|
|
case VERT_RESULT_FOGC:
|
|
|
|
return FRAG_ATTRIB_FOGC;
|
|
|
|
default:
|
|
|
|
/* Back-face colors, edge flags, etc */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2007-09-28 15:39:09 -06:00
|
|
|
* Find a translated vertex program that corresponds to stvp and
|
|
|
|
* has outputs matched to stfp's inputs.
|
|
|
|
* This performs vertex and fragment translation (to TGSI) when needed.
|
2007-09-25 14:21:18 -06:00
|
|
|
*/
|
2007-09-28 15:39:09 -06:00
|
|
|
static struct translated_vertex_program *
|
|
|
|
find_translated_vp(struct st_context *st,
|
|
|
|
struct st_vertex_program *stvp,
|
|
|
|
struct st_fragment_program *stfp)
|
2007-09-25 14:21:18 -06:00
|
|
|
{
|
|
|
|
static const GLuint UNUSED = ~0;
|
2007-09-28 15:39:09 -06:00
|
|
|
struct translated_vertex_program *xvp;
|
2007-12-14 11:00:46 -07:00
|
|
|
const GLbitfield fragInputsRead = stfp->Base.Base.InputsRead;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/*
|
|
|
|
* Translate fragment program if needed.
|
|
|
|
*/
|
2008-03-11 18:54:31 -06:00
|
|
|
if (!stfp->state.tokens) {
|
2007-09-28 15:39:09 -06:00
|
|
|
GLuint inAttr, numIn = 0;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
|
|
|
|
if (fragInputsRead & (1 << inAttr)) {
|
|
|
|
stfp->input_to_slot[inAttr] = numIn;
|
|
|
|
numIn++;
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
else {
|
2007-09-28 15:39:09 -06:00
|
|
|
stfp->input_to_slot[inAttr] = UNUSED;
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
stfp->num_input_slots = numIn;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-10-02 16:57:19 -06:00
|
|
|
assert(stfp->Base.Base.NumInstructions > 1);
|
|
|
|
|
2008-03-11 18:54:31 -06:00
|
|
|
st_translate_fragment_program(st, stfp, stfp->input_to_slot);
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/* See if we've got a translated vertex program whose outputs match
|
|
|
|
* the fragment program's inputs.
|
|
|
|
* XXX This could be a hash lookup, using InputsRead as the key.
|
|
|
|
*/
|
|
|
|
for (xvp = stfp->vertex_programs; xvp; xvp = xvp->next) {
|
2007-10-01 13:45:53 -06:00
|
|
|
if (xvp->master == stvp && xvp->frag_inputs == fragInputsRead) {
|
2007-09-28 15:39:09 -06:00
|
|
|
break;
|
|
|
|
}
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/* No? Allocate translated vp object now */
|
|
|
|
if (!xvp) {
|
2009-02-12 10:14:36 -07:00
|
|
|
xvp = ST_CALLOC_STRUCT(translated_vertex_program);
|
2007-09-28 15:39:09 -06:00
|
|
|
xvp->frag_inputs = fragInputsRead;
|
2007-10-01 13:45:53 -06:00
|
|
|
xvp->master = stvp;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
xvp->next = stfp->vertex_programs;
|
|
|
|
stfp->vertex_programs = xvp;
|
|
|
|
}
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/* See if we need to translate vertex program to TGSI form */
|
|
|
|
if (xvp->serialNo != stvp->serialNo) {
|
|
|
|
GLuint outAttr, dummySlot;
|
|
|
|
const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten;
|
2007-12-14 11:00:46 -07:00
|
|
|
GLuint numVpOuts = 0;
|
2008-07-02 19:07:11 -06:00
|
|
|
GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE;
|
2008-08-18 16:10:01 -06:00
|
|
|
GLint maxGeneric;
|
2007-09-28 15:39:09 -06:00
|
|
|
|
|
|
|
/* Compute mapping of vertex program outputs to slots, which depends
|
|
|
|
* on the fragment program's input->slot mapping.
|
|
|
|
*/
|
|
|
|
for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {
|
2008-08-18 16:10:01 -06:00
|
|
|
/* set defaults: */
|
2007-09-28 15:39:09 -06:00
|
|
|
xvp->output_to_slot[outAttr] = UNUSED;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_COUNT;
|
|
|
|
xvp->output_to_semantic_index[outAttr] = 99;
|
2007-09-28 15:39:09 -06:00
|
|
|
|
2007-12-14 11:00:46 -07:00
|
|
|
if (outAttr == VERT_RESULT_HPOS) {
|
|
|
|
/* always put xformed position into slot zero */
|
|
|
|
xvp->output_to_slot[VERT_RESULT_HPOS] = 0;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_POSITION;
|
|
|
|
xvp->output_to_semantic_index[outAttr] = 0;
|
2007-12-14 11:00:46 -07:00
|
|
|
numVpOuts++;
|
|
|
|
}
|
|
|
|
else if (outputsWritten & (1 << outAttr)) {
|
2007-09-28 15:39:09 -06:00
|
|
|
/* see if the frag prog wants this vert output */
|
2007-12-14 11:00:46 -07:00
|
|
|
GLint fpInAttrib = vp_out_to_fp_in(outAttr);
|
|
|
|
if (fpInAttrib >= 0) {
|
|
|
|
GLuint fpInSlot = stfp->input_to_slot[fpInAttrib];
|
2008-01-31 14:05:04 -07:00
|
|
|
if (fpInSlot != ~0) {
|
2008-08-18 16:10:01 -06:00
|
|
|
/* match this vp output to the fp input */
|
2008-02-26 08:43:07 -07:00
|
|
|
GLuint vpOutSlot = stfp->input_map[fpInSlot];
|
2008-01-31 14:05:04 -07:00
|
|
|
xvp->output_to_slot[outAttr] = vpOutSlot;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[outAttr] = stfp->input_semantic_name[fpInSlot];
|
|
|
|
xvp->output_to_semantic_index[outAttr] = stfp->input_semantic_index[fpInSlot];
|
2008-01-31 14:05:04 -07:00
|
|
|
numVpOuts++;
|
|
|
|
}
|
2007-12-14 11:00:46 -07:00
|
|
|
}
|
2008-07-02 19:07:11 -06:00
|
|
|
else if (outAttr == VERT_RESULT_PSIZ)
|
|
|
|
emitPntSize = GL_TRUE;
|
|
|
|
else if (outAttr == VERT_RESULT_BFC0)
|
|
|
|
emitBFC0 = GL_TRUE;
|
|
|
|
else if (outAttr == VERT_RESULT_BFC1)
|
|
|
|
emitBFC1 = GL_TRUE;
|
2007-09-28 15:39:09 -06:00
|
|
|
}
|
2008-07-02 19:07:11 -06:00
|
|
|
#if 0 /*debug*/
|
2008-08-18 16:10:01 -06:00
|
|
|
printf("assign vp output_to_slot[%d] = %d\n", outAttr,
|
2007-12-19 08:50:52 -07:00
|
|
|
xvp->output_to_slot[outAttr]);
|
2008-07-02 19:07:11 -06:00
|
|
|
#endif
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
|
2008-07-02 19:07:11 -06:00
|
|
|
/* must do these last */
|
2008-08-18 16:10:01 -06:00
|
|
|
if (emitPntSize) {
|
2008-07-02 19:07:11 -06:00
|
|
|
xvp->output_to_slot[VERT_RESULT_PSIZ] = numVpOuts++;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[VERT_RESULT_PSIZ] = TGSI_SEMANTIC_PSIZE;
|
|
|
|
xvp->output_to_semantic_index[VERT_RESULT_PSIZ] = 0;
|
|
|
|
}
|
|
|
|
if (emitBFC0) {
|
2008-07-02 19:07:11 -06:00
|
|
|
xvp->output_to_slot[VERT_RESULT_BFC0] = numVpOuts++;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR;
|
|
|
|
xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 0;
|
|
|
|
}
|
|
|
|
if (emitBFC1) {
|
2008-07-02 19:07:11 -06:00
|
|
|
xvp->output_to_slot[VERT_RESULT_BFC1] = numVpOuts++;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR;
|
|
|
|
xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 1;
|
|
|
|
}
|
2008-07-02 19:07:11 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/* Unneeded vertex program outputs will go to this slot.
|
|
|
|
* We could use this info to do dead code elimination in the
|
|
|
|
* vertex program.
|
|
|
|
*/
|
2008-01-31 14:05:04 -07:00
|
|
|
dummySlot = numVpOuts;
|
2007-09-28 15:39:09 -06:00
|
|
|
|
2008-08-18 16:10:01 -06:00
|
|
|
/* find max GENERIC slot index */
|
|
|
|
maxGeneric = -1;
|
|
|
|
for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {
|
|
|
|
if (xvp->output_to_semantic_name[outAttr] == TGSI_SEMANTIC_GENERIC) {
|
|
|
|
maxGeneric = MAX2(maxGeneric,
|
|
|
|
xvp->output_to_semantic_index[outAttr]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Map vert program outputs that aren't used to the dummy slot
|
|
|
|
* (and an unused generic attribute slot).
|
|
|
|
*/
|
2007-09-28 15:39:09 -06:00
|
|
|
for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {
|
|
|
|
if (outputsWritten & (1 << outAttr)) {
|
2008-08-18 16:10:01 -06:00
|
|
|
if (xvp->output_to_slot[outAttr] == UNUSED) {
|
2007-09-28 15:39:09 -06:00
|
|
|
xvp->output_to_slot[outAttr] = dummySlot;
|
2008-08-18 16:10:01 -06:00
|
|
|
xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_GENERIC;
|
|
|
|
xvp->output_to_semantic_index[outAttr] = maxGeneric + 1;
|
|
|
|
}
|
2007-09-28 15:39:09 -06:00
|
|
|
}
|
2008-08-18 16:10:01 -06:00
|
|
|
|
2008-07-02 19:07:11 -06:00
|
|
|
#if 0 /*debug*/
|
2008-08-18 16:10:01 -06:00
|
|
|
printf("vp output_to_slot[%d] = %d\n", outAttr,
|
2008-07-02 19:07:11 -06:00
|
|
|
xvp->output_to_slot[outAttr]);
|
|
|
|
#endif
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
|
2007-10-02 16:57:19 -06:00
|
|
|
assert(stvp->Base.Base.NumInstructions > 1);
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2008-08-18 16:10:01 -06:00
|
|
|
st_translate_vertex_program(st, stvp, xvp->output_to_slot,
|
|
|
|
xvp->output_to_semantic_name,
|
|
|
|
xvp->output_to_semantic_index);
|
2008-01-14 19:12:46 -07:00
|
|
|
|
|
|
|
xvp->vp = stvp;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
/* translated VP is up to date now */
|
|
|
|
xvp->serialNo = stvp->serialNo;
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
2007-09-28 15:39:09 -06:00
|
|
|
|
|
|
|
return xvp;
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-22 10:29:30 -06:00
|
|
|
void
|
|
|
|
st_free_translated_vertex_programs(struct st_context *st,
|
|
|
|
struct translated_vertex_program *xvp)
|
|
|
|
{
|
|
|
|
struct translated_vertex_program *next;
|
|
|
|
|
|
|
|
while (xvp) {
|
|
|
|
next = xvp->next;
|
2009-02-12 10:08:25 -07:00
|
|
|
_mesa_free(xvp);
|
2008-03-22 10:29:30 -06:00
|
|
|
xvp = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-07 16:44:33 -06:00
|
|
|
static void *
|
|
|
|
get_passthrough_fs(struct st_context *st)
|
|
|
|
{
|
|
|
|
struct pipe_shader_state shader;
|
|
|
|
|
|
|
|
if (!st->passthrough_fs) {
|
|
|
|
st->passthrough_fs =
|
|
|
|
util_make_fragment_passthrough_shader(st->pipe, &shader);
|
2008-05-08 19:32:49 -06:00
|
|
|
#if 0 /* We actually need to keep the tokens around at this time */
|
2009-02-19 13:02:47 +00:00
|
|
|
util_free_shader(&shader);
|
2008-05-08 19:32:49 -06:00
|
|
|
#endif
|
2008-05-07 16:44:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return st->passthrough_fs;
|
|
|
|
}
|
|
|
|
|
2008-03-22 10:29:30 -06:00
|
|
|
|
2007-09-25 14:21:18 -06:00
|
|
|
static void
|
|
|
|
update_linkage( struct st_context *st )
|
|
|
|
{
|
|
|
|
struct st_vertex_program *stvp;
|
|
|
|
struct st_fragment_program *stfp;
|
2007-09-28 15:39:09 -06:00
|
|
|
struct translated_vertex_program *xvp;
|
2007-09-25 14:21:18 -06:00
|
|
|
|
|
|
|
/* find active shader and params -- Should be covered by
|
|
|
|
* ST_NEW_VERTEX_PROGRAM
|
|
|
|
*/
|
2007-10-29 09:24:29 -06:00
|
|
|
assert(st->ctx->VertexProgram._Current);
|
|
|
|
stvp = st_vertex_program(st->ctx->VertexProgram._Current);
|
2008-05-07 08:55:33 -06:00
|
|
|
assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-10-29 09:24:29 -06:00
|
|
|
assert(st->ctx->FragmentProgram._Current);
|
|
|
|
stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
|
2008-05-07 08:55:33 -06:00
|
|
|
assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
xvp = find_translated_vp(st, stvp, stfp);
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2008-05-07 08:55:33 -06:00
|
|
|
st_reference_vertprog(st, &st->vp, stvp);
|
|
|
|
st_reference_fragprog(st, &st->fp, stfp);
|
2008-03-11 18:54:31 -06:00
|
|
|
|
2008-04-21 20:26:19 +01:00
|
|
|
cso_set_vertex_shader_handle(st->cso_context, stvp->driver_shader);
|
2008-05-07 16:44:33 -06:00
|
|
|
|
|
|
|
if (st->missing_textures) {
|
|
|
|
/* use a pass-through frag shader that uses no textures */
|
|
|
|
void *fs = get_passthrough_fs(st);
|
|
|
|
cso_set_fragment_shader_handle(st->cso_context, fs);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader);
|
|
|
|
}
|
2007-09-25 14:21:18 -06:00
|
|
|
|
2007-09-28 15:39:09 -06:00
|
|
|
st->vertex_result_to_slot = xvp->output_to_slot;
|
2007-09-25 14:21:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const struct st_tracked_state st_update_shader = {
|
2008-05-02 10:08:03 +00:00
|
|
|
"st_update_shader", /* name */
|
|
|
|
{ /* dirty */
|
|
|
|
0, /* mesa */
|
|
|
|
ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM /* st */
|
2007-09-25 14:21:18 -06:00
|
|
|
},
|
2008-05-02 10:08:03 +00:00
|
|
|
update_linkage /* update */
|
2007-09-25 14:21:18 -06:00
|
|
|
};
|