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 <jfonseca@vmware.com>
This commit is contained in:
Brian Paul
2014-05-29 13:55:46 -06:00
parent b4f34241ec
commit 7b2ff54417
+21
View File
@@ -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 */