To check if a shader bytcode exceeds the device limit. There's no
limit when using GBS.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
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 */