summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/svga/svga_shader.h')
-rw-r--r--src/gallium/drivers/svga/svga_shader.h21
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 */