diff options
author | Brian Paul <[email protected]> | 2014-05-29 13:55:46 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2014-05-31 06:25:35 -0600 |
commit | 7b2ff544176c34cd3b0f5f10caa44e497ecab0ad (patch) | |
tree | 353f0a566c885a16bd5470284aa4517c7c02ff88 /src/gallium | |
parent | b4f34241ec850fbeffcb3278fea85f06d1666c43 (diff) |
svga: added svga_shader_too_large() helper
To check if a shader bytcode exceeds the device limit. There's no
limit when using GBS.
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/svga/svga_shader.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_shader.h b/src/gallium/drivers/svga/svga_shader.h index 348dc0c59e2..fd500ae4401 100644 --- a/src/gallium/drivers/svga/svga_shader.h +++ b/src/gallium/drivers/svga/svga_shader.h @@ -41,4 +41,25 @@ svga_destroy_shader_variant(struct svga_context *svga, struct svga_shader_variant *variant); +/** + * Check if a shader's bytecode exceeds the device limits. + */ +static INLINE boolean +svga_shader_too_large(const struct svga_context *svga, + const struct svga_shader_variant *variant) +{ + if (svga_have_gb_objects(svga)) { + return FALSE; + } + + if (variant->nr_tokens * sizeof(variant->tokens[0]) + + sizeof(SVGA3dCmdDefineShader) + sizeof(SVGA3dCmdHeader) + < SVGA_CB_MAX_COMMAND_SIZE) { + return FALSE; + } + + return TRUE; +} + + #endif /* SVGA_SHADER_H */ |