gallium: Use CSO cache for shaders.
This commit is contained in:
@@ -273,8 +273,8 @@ update_linkage( struct st_context *st )
|
|||||||
st->vp = stvp;
|
st->vp = stvp;
|
||||||
st->fp = stfp;
|
st->fp = stfp;
|
||||||
|
|
||||||
st->pipe->bind_vs_state(st->pipe, stvp->driver_shader);
|
cso_set_vertex_shader(st->cso_context, stvp->driver_shader);
|
||||||
st->pipe->bind_fs_state(st->pipe, stfp->driver_shader);
|
cso_set_fragment_shader(st->cso_context, stfp->driver_shader);
|
||||||
|
|
||||||
st->vertex_result_to_slot = xvp->output_to_slot;
|
st->vertex_result_to_slot = xvp->output_to_slot;
|
||||||
}
|
}
|
||||||
|
@@ -438,16 +438,18 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
cso_save_samplers(cso);
|
cso_save_samplers(cso);
|
||||||
cso_save_sampler_textures(cso);
|
cso_save_sampler_textures(cso);
|
||||||
cso_save_viewport(cso);
|
cso_save_viewport(cso);
|
||||||
|
cso_save_fragment_shader(cso);
|
||||||
|
cso_save_vertex_shader(cso);
|
||||||
|
|
||||||
/* rasterizer state: just scissor */
|
/* rasterizer state: just scissor */
|
||||||
st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled;
|
st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled;
|
||||||
cso_set_rasterizer(cso, &st->bitmap.rasterizer);
|
cso_set_rasterizer(cso, &st->bitmap.rasterizer);
|
||||||
|
|
||||||
/* fragment shader state: TEX lookup program */
|
/* fragment shader state: TEX lookup program */
|
||||||
pipe->bind_fs_state(pipe, stfp->driver_shader);
|
cso_set_fragment_shader(cso, stfp->driver_shader);
|
||||||
|
|
||||||
/* vertex shader state: position + texcoord pass-through */
|
/* vertex shader state: position + texcoord pass-through */
|
||||||
pipe->bind_vs_state(pipe, st->bitmap.vs);
|
cso_set_vertex_shader(cso, st->bitmap.vs);
|
||||||
|
|
||||||
/* sampler / texture state */
|
/* sampler / texture state */
|
||||||
cso_single_sampler(cso, 0, &st->bitmap.sampler);
|
cso_single_sampler(cso, 0, &st->bitmap.sampler);
|
||||||
@@ -488,9 +490,8 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
cso_restore_samplers(cso);
|
cso_restore_samplers(cso);
|
||||||
cso_restore_sampler_textures(cso);
|
cso_restore_sampler_textures(cso);
|
||||||
cso_restore_viewport(cso);
|
cso_restore_viewport(cso);
|
||||||
/* shaders don't go through cso yet */
|
cso_save_fragment_shader(cso);
|
||||||
pipe->bind_fs_state(pipe, st->fp->driver_shader);
|
cso_save_vertex_shader(cso);
|
||||||
pipe->bind_vs_state(pipe, st->vp->driver_shader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -71,7 +71,6 @@ st_BlitFramebuffer(GLcontext *ctx,
|
|||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
{
|
{
|
||||||
struct st_context *st = ctx->st;
|
struct st_context *st = ctx->st;
|
||||||
struct pipe_context *pipe = st->pipe;
|
|
||||||
|
|
||||||
const uint pFilter = ((filter == GL_NEAREST)
|
const uint pFilter = ((filter == GL_NEAREST)
|
||||||
? PIPE_TEX_MIPFILTER_NEAREST
|
? PIPE_TEX_MIPFILTER_NEAREST
|
||||||
@@ -100,10 +99,6 @@ st_BlitFramebuffer(GLcontext *ctx,
|
|||||||
0.0, pFilter);
|
0.0, pFilter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shaders don't go through CSO yet */
|
|
||||||
pipe->bind_fs_state(pipe, st->fp->driver_shader);
|
|
||||||
pipe->bind_vs_state(pipe, st->vp->driver_shader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -195,7 +195,6 @@ clear_with_quad(GLcontext *ctx,
|
|||||||
GLboolean color, GLboolean depth, GLboolean stencil)
|
GLboolean color, GLboolean depth, GLboolean stencil)
|
||||||
{
|
{
|
||||||
struct st_context *st = ctx->st;
|
struct st_context *st = ctx->st;
|
||||||
struct pipe_context *pipe = st->pipe;
|
|
||||||
const GLfloat x0 = ctx->DrawBuffer->_Xmin;
|
const GLfloat x0 = ctx->DrawBuffer->_Xmin;
|
||||||
const GLfloat x1 = ctx->DrawBuffer->_Xmax;
|
const GLfloat x1 = ctx->DrawBuffer->_Xmax;
|
||||||
GLfloat y0, y1;
|
GLfloat y0, y1;
|
||||||
@@ -222,6 +221,8 @@ clear_with_quad(GLcontext *ctx,
|
|||||||
cso_save_depth_stencil_alpha(st->cso_context);
|
cso_save_depth_stencil_alpha(st->cso_context);
|
||||||
cso_save_rasterizer(st->cso_context);
|
cso_save_rasterizer(st->cso_context);
|
||||||
cso_save_viewport(st->cso_context);
|
cso_save_viewport(st->cso_context);
|
||||||
|
cso_save_fragment_shader(st->cso_context);
|
||||||
|
cso_save_vertex_shader(st->cso_context);
|
||||||
|
|
||||||
/* blend state: RGBA masking */
|
/* blend state: RGBA masking */
|
||||||
{
|
{
|
||||||
@@ -273,8 +274,8 @@ clear_with_quad(GLcontext *ctx,
|
|||||||
cso_set_rasterizer(st->cso_context, &st->clear.raster);
|
cso_set_rasterizer(st->cso_context, &st->clear.raster);
|
||||||
cso_set_viewport(st->cso_context, &st->clear.viewport);
|
cso_set_viewport(st->cso_context, &st->clear.viewport);
|
||||||
|
|
||||||
pipe->bind_fs_state(pipe, st->clear.fs);
|
cso_set_fragment_shader(st->cso_context, st->clear.fs);
|
||||||
pipe->bind_vs_state(pipe, st->clear.vs);
|
cso_set_vertex_shader(st->cso_context, st->clear.vs);
|
||||||
|
|
||||||
/* draw quad matching scissor rect (XXX verify coord round-off) */
|
/* draw quad matching scissor rect (XXX verify coord round-off) */
|
||||||
draw_quad(ctx, x0, y0, x1, y1, ctx->Depth.Clear, ctx->Color.ClearColor);
|
draw_quad(ctx, x0, y0, x1, y1, ctx->Depth.Clear, ctx->Color.ClearColor);
|
||||||
@@ -284,9 +285,8 @@ clear_with_quad(GLcontext *ctx,
|
|||||||
cso_restore_depth_stencil_alpha(st->cso_context);
|
cso_restore_depth_stencil_alpha(st->cso_context);
|
||||||
cso_restore_rasterizer(st->cso_context);
|
cso_restore_rasterizer(st->cso_context);
|
||||||
cso_restore_viewport(st->cso_context);
|
cso_restore_viewport(st->cso_context);
|
||||||
/* these don't go through cso yet */
|
cso_restore_fragment_shader(st->cso_context);
|
||||||
pipe->bind_fs_state(pipe, st->fp->driver_shader);
|
cso_restore_vertex_shader(st->cso_context);
|
||||||
pipe->bind_vs_state(pipe, st->vp->driver_shader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -532,6 +532,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
cso_save_viewport(cso);
|
cso_save_viewport(cso);
|
||||||
cso_save_samplers(cso);
|
cso_save_samplers(cso);
|
||||||
cso_save_sampler_textures(cso);
|
cso_save_sampler_textures(cso);
|
||||||
|
cso_save_fragment_shader(cso);
|
||||||
|
cso_save_vertex_shader(cso);
|
||||||
|
|
||||||
/* rasterizer state: just scissor */
|
/* rasterizer state: just scissor */
|
||||||
{
|
{
|
||||||
@@ -543,10 +545,10 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fragment shader state: TEX lookup program */
|
/* fragment shader state: TEX lookup program */
|
||||||
pipe->bind_fs_state(pipe, stfp->driver_shader);
|
cso_set_fragment_shader(cso, stfp->driver_shader);
|
||||||
|
|
||||||
/* vertex shader state: position + texcoord pass-through */
|
/* vertex shader state: position + texcoord pass-through */
|
||||||
pipe->bind_vs_state(pipe, stvp->driver_shader);
|
cso_set_vertex_shader(cso, stvp->driver_shader);
|
||||||
|
|
||||||
|
|
||||||
/* texture sampling state: */
|
/* texture sampling state: */
|
||||||
@@ -615,10 +617,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
cso_restore_viewport(cso);
|
cso_restore_viewport(cso);
|
||||||
cso_restore_samplers(cso);
|
cso_restore_samplers(cso);
|
||||||
cso_restore_sampler_textures(cso);
|
cso_restore_sampler_textures(cso);
|
||||||
|
cso_restore_fragment_shader(cso);
|
||||||
/* shaders don't go through cso yet */
|
cso_restore_vertex_shader(cso);
|
||||||
pipe->bind_fs_state(pipe, st->fp->driver_shader);
|
|
||||||
pipe->bind_vs_state(pipe, st->vp->driver_shader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -95,12 +95,6 @@ st_render_mipmap(struct st_context *st,
|
|||||||
util_gen_mipmap(st->gen_mipmap, pt, face, baseLevel, lastLevel,
|
util_gen_mipmap(st->gen_mipmap, pt, face, baseLevel, lastLevel,
|
||||||
PIPE_TEX_FILTER_LINEAR);
|
PIPE_TEX_FILTER_LINEAR);
|
||||||
|
|
||||||
/* shaders don't go through CSO yet */
|
|
||||||
if (st->fp)
|
|
||||||
pipe->bind_fs_state(pipe, st->fp->driver_shader);
|
|
||||||
if (st->vp)
|
|
||||||
pipe->bind_vs_state(pipe, st->vp->driver_shader);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user