#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_ureg.h"
#include "st_debug.h"
#include "st_context.h"
enum pipe_error error;
unsigned num_outputs;
+ _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT);
+ _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_VARYING);
+
ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
if (ureg == NULL) {
FREE(vpv);
ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint fs_num_outputs = 0;
+ _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT);
+
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/
input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
break;
- case FRAG_ATTRIB_PNTC:
- /* This is a hack. We really need a new semantic label for
- * point coord. The draw module needs to know which fragment
- * shader input is the point coord attribute so that it can set
- * up the right vertex attribute values.
- */
- input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
- break;
-
/* In most cases, there is nothing special about these
* inputs, so adopt a convention to use the generic
* semantic name and the mesa FRAG_ATTRIB_ number as the
* zero or be restricted to a particular range -- nobody
* should be building tables based on semantic index.
*/
+ case FRAG_ATTRIB_PNTC:
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
case FRAG_ATTRIB_TEX2:
assert(attr >= FRAG_ATTRIB_TEX0);
input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ if (attr == FRAG_ATTRIB_PNTC)
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ else
+ interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
}
}
outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
}
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
+ fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL;
+ fs_output_semantic_index[fs_num_outputs] = 0;
+ outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs;
+ fs_num_outputs++;
+ outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
+ }
+
/* handle remaning outputs (color) */
for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
if (outputsWritten & BITFIELD64_BIT(attr)) {
switch (attr) {
case FRAG_RESULT_DEPTH:
+ case FRAG_RESULT_STENCIL:
/* handled above */
assert(0);
break;
GLuint maxSlot = 0;
struct ureg_program *ureg;
+ _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT);
+ _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_VARYING);
+
ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY );
if (ureg == NULL) {
return;
}
/* which vertex output goes to the first geometry input */
- if (inputsRead & GEOM_BIT_VERTICES)
- vslot = 0;
- else
- vslot = 1;
+ vslot = 0;
+
+ memset(inputMapping, 0, sizeof(inputMapping));
+ memset(outputMapping, 0, sizeof(outputMapping));
/*
* Convert Mesa program inputs to TGSI input register semantics.
stgp->index_to_input[vslot] = attr;
++vslot;
- if (attr != GEOM_ATTRIB_VERTICES &&
- attr != GEOM_ATTRIB_PRIMITIVE_ID) {
+ if (attr != GEOM_ATTRIB_PRIMITIVE_ID) {
gs_array_offset += 2;
} else
++gs_builtin_inputs;
#endif
switch (attr) {
- case GEOM_ATTRIB_VERTICES:
- debug_assert(0);
- break;
case GEOM_ATTRIB_PRIMITIVE_ID:
stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID;
stgp->input_semantic_index[slot] = 0;
* Debug- print current shader text
*/
void
-st_print_shaders(GLcontext *ctx)
+st_print_shaders(struct gl_context *ctx)
{
struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
if (shProg) {