diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-08-22 12:24:51 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-08-22 12:26:46 -0600 |
commit | c0bb4ba9e665e40a325d82aa2ee48d7b8abd603b (patch) | |
tree | 48338074f07042599856e95b4529e0ffbca4be63 /src/mesa/pipe/softpipe/sp_state_fs.c | |
parent | d1fbf621dc48a488c0f860c5851332d269e6d637 (diff) |
Rework of shader constant buffers.
They're now totally independent of the actual shaders.
Also, implemented in terms of pipe_buffer_handles/objects.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_state_fs.c')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_fs.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c index bab407f047..9e3ff6d35c 100644 --- a/src/mesa/pipe/softpipe/sp_state_fs.c +++ b/src/mesa/pipe/softpipe/sp_state_fs.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -28,6 +28,8 @@ #include "sp_context.h" #include "sp_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_winsys.h" #include "pipe/draw/draw_context.h" @@ -53,3 +55,24 @@ void softpipe_set_vs_state( struct pipe_context *pipe, draw_set_vertex_shader(softpipe->draw, vs); } + + +void softpipe_set_constant_buffer(struct pipe_context *pipe, + uint shader, uint index, + const struct pipe_constant_buffer *buf) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct pipe_winsys *ws = pipe->winsys; + + assert(shader < PIPE_SHADER_TYPES); + assert(index == 0); + + /* note: reference counting */ + ws->buffer_unreference(ws, &softpipe->constants[shader].buffer); + softpipe->constants[shader].buffer = ws->buffer_reference(ws, buf->buffer); + softpipe->constants[shader].size = buf->size; + + softpipe->dirty |= SP_NEW_CONSTANTS; +} + + |