mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-16 19:30:39 +01:00
tgsi: Pass pipe_context as a parameter to ureg_create_shader.
Simplifies migration to tgsi_ureg. (cherry picked from commit f574398c07c41cb8d31249a7186fc178ef7d552a)
This commit is contained in:
parent
b570a7e6b6
commit
acc7da9035
2 changed files with 30 additions and 14 deletions
|
|
@ -788,9 +788,9 @@ emit_header( struct ureg_program *ureg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *ureg_create_shader( struct ureg_program *ureg )
|
const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
|
||||||
{
|
{
|
||||||
struct pipe_shader_state state;
|
const struct tgsi_token *tokens;
|
||||||
|
|
||||||
emit_header( ureg );
|
emit_header( ureg );
|
||||||
emit_decls( ureg );
|
emit_decls( ureg );
|
||||||
|
|
@ -804,31 +804,42 @@ void *ureg_create_shader( struct ureg_program *ureg )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.tokens = (const struct tgsi_token *)ureg->domain[DOMAIN_DECL].tokens;
|
tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
|
debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
|
||||||
ureg->domain[DOMAIN_DECL].count);
|
ureg->domain[DOMAIN_DECL].count);
|
||||||
tgsi_dump( state.tokens, 0 );
|
tgsi_dump( tokens, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *ureg_create_shader( struct ureg_program *ureg,
|
||||||
|
struct pipe_context *pipe )
|
||||||
|
{
|
||||||
|
struct pipe_shader_state state;
|
||||||
|
|
||||||
|
state.tokens = ureg_finalize(ureg);
|
||||||
|
if(!state.tokens)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (ureg->processor == TGSI_PROCESSOR_VERTEX)
|
if (ureg->processor == TGSI_PROCESSOR_VERTEX)
|
||||||
return ureg->pipe->create_vs_state( ureg->pipe, &state );
|
return pipe->create_vs_state( pipe, &state );
|
||||||
else
|
else
|
||||||
return ureg->pipe->create_fs_state( ureg->pipe, &state );
|
return pipe->create_fs_state( pipe, &state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ureg_program *ureg_create( struct pipe_context *pipe,
|
struct ureg_program *ureg_create( unsigned processor )
|
||||||
unsigned processor )
|
|
||||||
{
|
{
|
||||||
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
|
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
|
||||||
if (ureg == NULL)
|
if (ureg == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ureg->pipe = pipe;
|
|
||||||
ureg->processor = processor;
|
ureg->processor = processor;
|
||||||
return ureg;
|
return ureg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,14 @@ struct ureg_dst
|
||||||
struct pipe_context;
|
struct pipe_context;
|
||||||
|
|
||||||
struct ureg_program *
|
struct ureg_program *
|
||||||
ureg_create( struct pipe_context *pipe,
|
ureg_create( unsigned processor );
|
||||||
unsigned processor );
|
|
||||||
|
const struct tgsi_token *
|
||||||
|
ureg_finalize( struct ureg_program * );
|
||||||
|
|
||||||
void *
|
void *
|
||||||
ureg_create_shader( struct ureg_program * );
|
ureg_create_shader( struct ureg_program *,
|
||||||
|
struct pipe_context *pipe );
|
||||||
|
|
||||||
void
|
void
|
||||||
ureg_destroy( struct ureg_program * );
|
ureg_destroy( struct ureg_program * );
|
||||||
|
|
@ -82,9 +85,11 @@ ureg_destroy( struct ureg_program * );
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Convenience routine:
|
* Convenience routine:
|
||||||
*/
|
*/
|
||||||
static INLINE void *ureg_create_shader_and_destroy( struct ureg_program *p )
|
static INLINE void *
|
||||||
|
ureg_create_shader_and_destroy( struct ureg_program *p,
|
||||||
|
struct pipe_context *pipe )
|
||||||
{
|
{
|
||||||
void *result = ureg_create_shader( p );
|
void *result = ureg_create_shader( p, pipe );
|
||||||
ureg_destroy( p );
|
ureg_destroy( p );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue