mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 12:28:07 +02:00
gallium: avoid redundant tgsi_exec_machine_bind_shader() calls on draw exec path
tgsi_exec_machine_bind_shader() isn't cheap so avoiding unecessary calls is a big win. A similar change should be done for softpipe's fragment exec path but extra care needs to be taken with the texture sampler state/params.
This commit is contained in:
parent
bd34b8a4fe
commit
9defef29c5
1 changed files with 11 additions and 6 deletions
|
|
@ -46,6 +46,7 @@
|
|||
struct exec_vertex_shader {
|
||||
struct draw_vertex_shader base;
|
||||
struct tgsi_exec_machine *machine;
|
||||
struct tgsi_token *machine_tokens;
|
||||
};
|
||||
|
||||
static struct exec_vertex_shader *exec_vertex_shader( struct draw_vertex_shader *vs )
|
||||
|
|
@ -62,12 +63,16 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
|
|||
{
|
||||
struct exec_vertex_shader *evs = exec_vertex_shader(shader);
|
||||
|
||||
/* specify the vertex program to interpret/execute */
|
||||
tgsi_exec_machine_bind_shader(evs->machine,
|
||||
shader->state.tokens,
|
||||
PIPE_MAX_SAMPLERS,
|
||||
NULL /*samplers*/ );
|
||||
|
||||
/* Specify the vertex program to interpret/execute.
|
||||
* Avoid rebinding when possible.
|
||||
*/
|
||||
if (evs->machine_tokens != shader->state.tokens) {
|
||||
tgsi_exec_machine_bind_shader(evs->machine,
|
||||
shader->state.tokens,
|
||||
PIPE_MAX_SAMPLERS,
|
||||
NULL /*samplers*/ );
|
||||
evs->machine_tokens = shader->state.tokens;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue