this adds the capability + a stencil semantic id, + tgsi scan support. Signed-off-by: Dave Airlie <airlied@redhat.com>tags/snb-magic
@@ -126,7 +126,8 @@ static const char *semantic_names[] = | |||
"FACE", | |||
"EDGEFLAG", | |||
"PRIM_ID", | |||
"INSTANCEID" | |||
"INSTANCEID", | |||
"STENCIL" | |||
}; | |||
static const char *immediate_type_names[] = |
@@ -157,9 +157,11 @@ tgsi_scan_shader(const struct tgsi_token *tokens, | |||
/* extra info for special outputs */ | |||
if (procType == TGSI_PROCESSOR_FRAGMENT && | |||
fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) { | |||
info->writes_z = TRUE; | |||
} | |||
fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) | |||
info->writes_z = TRUE; | |||
if (procType == TGSI_PROCESSOR_FRAGMENT && | |||
fulldecl->Semantic.Name == TGSI_SEMANTIC_STENCIL) | |||
info->writes_stencil = TRUE; | |||
if (procType == TGSI_PROCESSOR_VERTEX && | |||
fulldecl->Semantic.Name == TGSI_SEMANTIC_EDGEFLAG) { | |||
info->writes_edgeflag = TRUE; |
@@ -60,6 +60,7 @@ struct tgsi_shader_info | |||
uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */ | |||
boolean writes_z; /**< does fragment shader write Z value? */ | |||
boolean writes_stencil; /**< does fragment shader write stencil value? */ | |||
boolean writes_edgeflag; /**< vertex shader outputs edgeflag */ | |||
boolean uses_kill; /**< KIL or KILP instruction used? */ | |||
@@ -1415,6 +1415,12 @@ Edge flags are used to control which lines or points are actually | |||
drawn when the polygon mode converts triangles/quads/polygons into | |||
points or lines. | |||
TGSI_SEMANTIC_STENCIL | |||
"""""""""""""""""""""" | |||
For fragment shaders, this semantic label indicates than an output | |||
is a writable stencil reference value. Only the Y component is writable. | |||
This allows the fragment shader to change the fragments stencilref value. | |||
Properties |
@@ -158,9 +158,17 @@ exec_run( const struct sp_fragment_shader *base, | |||
case TGSI_SEMANTIC_POSITION: | |||
{ | |||
uint j; | |||
for (j = 0; j < 4; j++) { | |||
for (j = 0; j < 4; j++) | |||
quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j]; | |||
} | |||
} | |||
break; | |||
case TGSI_SEMANTIC_STENCIL: | |||
{ | |||
uint j; | |||
for (j = 0; j < 4; j++) | |||
quad->output.stencil[j] = (unsigned)machine->Outputs[i].xyzw[1].f[j]; | |||
} | |||
break; | |||
} |
@@ -464,7 +464,8 @@ enum pipe_cap { | |||
PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT, | |||
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER, | |||
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER, | |||
PIPE_CAP_DEPTH_CLAMP | |||
PIPE_CAP_DEPTH_CLAMP, | |||
PIPE_CAP_SHADER_STENCIL_EXPORT, | |||
}; | |||
/* Shader caps not specific to any single stage */ |
@@ -143,7 +143,8 @@ struct tgsi_declaration_dimension | |||
#define TGSI_SEMANTIC_EDGEFLAG 8 | |||
#define TGSI_SEMANTIC_PRIMID 9 | |||
#define TGSI_SEMANTIC_INSTANCEID 10 | |||
#define TGSI_SEMANTIC_COUNT 11 /**< number of semantic values */ | |||
#define TGSI_SEMANTIC_STENCIL 11 | |||
#define TGSI_SEMANTIC_COUNT 12 /**< number of semantic values */ | |||
struct tgsi_declaration_semantic | |||
{ |