diff options
author | José Fonseca <[email protected]> | 2011-02-23 18:45:04 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-09-23 07:58:44 -0600 |
commit | fd69fc87444af8ead30b4af64598a98df7969397 (patch) | |
tree | 0458afbb167bcf780613e6da134fc5ecdb341117 /src/gallium/drivers/svga/svga_cmd.c | |
parent | 157309348e3d9cc5c6bb81e68f13500e702d3a1e (diff) |
svga: Coalesce multiple shader constants in a single command.
HWv8 feature.
Tested with GoogleEarth, Mesa demos.
Diffstat (limited to 'src/gallium/drivers/svga/svga_cmd.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_cmd.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c index ebcd4bcaf10..d7611d4d042 100644 --- a/src/gallium/drivers/svga/svga_cmd.c +++ b/src/gallium/drivers/svga/svga_cmd.c @@ -758,6 +758,59 @@ SVGA3D_SetShaderConst(struct svga_winsys_context *swc, } +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetShaderConsts -- + * + * Set the value of successive shader constants. + * + * Shader constants are analogous to uniform variables in GLSL, + * except that they belong to the render context rather than to + * an individual shader. + * + * Constants may have one of three types: A 4-vector of floats, + * a 4-vector of integers, or a single boolean flag. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetShaderConsts(struct svga_winsys_context *swc, + uint32 reg, // IN + uint32 numRegs, // IN + SVGA3dShaderType type, // IN + SVGA3dShaderConstType ctype, // IN + const void *values) // IN +{ + SVGA3dCmdSetShaderConst *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SET_SHADER_CONST, + sizeof *cmd + (numRegs - 1) * sizeof cmd->values, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->reg = reg; + cmd->type = type; + cmd->ctype = ctype; + + memcpy(&cmd->values, values, numRegs * sizeof cmd->values); + + swc->commit(swc); + + return PIPE_OK; +} + + |