tgsi_from_mesa: add tgsi_get_gl_frag_result_semantic
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
@@ -148,3 +148,38 @@ tgsi_get_gl_varying_semantic(gl_varying_slot attr,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the semantic name and index used for the given fragment shader
|
||||||
|
* result.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tgsi_get_gl_frag_result_semantic(gl_frag_result frag_result,
|
||||||
|
unsigned *semantic_name,
|
||||||
|
unsigned *semantic_index)
|
||||||
|
{
|
||||||
|
if (frag_result >= FRAG_RESULT_DATA0) {
|
||||||
|
*semantic_name = TGSI_SEMANTIC_COLOR;
|
||||||
|
*semantic_index = frag_result - FRAG_RESULT_DATA0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*semantic_index = 0;
|
||||||
|
|
||||||
|
switch (frag_result) {
|
||||||
|
case FRAG_RESULT_DEPTH:
|
||||||
|
*semantic_name = TGSI_SEMANTIC_POSITION;
|
||||||
|
break;
|
||||||
|
case FRAG_RESULT_STENCIL:
|
||||||
|
*semantic_name = TGSI_SEMANTIC_STENCIL;
|
||||||
|
break;
|
||||||
|
case FRAG_RESULT_COLOR:
|
||||||
|
*semantic_name = TGSI_SEMANTIC_COLOR;
|
||||||
|
break;
|
||||||
|
case FRAG_RESULT_SAMPLE_MASK:
|
||||||
|
*semantic_name = TGSI_SEMANTIC_SAMPLEMASK;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -42,6 +42,11 @@ unsigned
|
|||||||
tgsi_get_generic_gl_varying_index(gl_varying_slot attr,
|
tgsi_get_generic_gl_varying_index(gl_varying_slot attr,
|
||||||
bool needs_texcoord_semantic);
|
bool needs_texcoord_semantic);
|
||||||
|
|
||||||
|
void
|
||||||
|
tgsi_get_gl_frag_result_semantic(gl_frag_result frag_result,
|
||||||
|
unsigned *semantic_name,
|
||||||
|
unsigned *semantic_index);
|
||||||
|
|
||||||
static inline enum pipe_shader_type
|
static inline enum pipe_shader_type
|
||||||
pipe_shader_type_from_mesa(gl_shader_stage stage)
|
pipe_shader_type_from_mesa(gl_shader_stage stage)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user