summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_program.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-08-07 10:44:15 -0700
committerEric Anholt <[email protected]>2011-08-16 13:04:42 -0700
commit2b224d66a01f3ce867fb05558b25749705bbfe7a (patch)
tree5e9c44f37cd76ba35660732c698bf87847be1e00 /src/mesa/drivers/dri/i965/brw_program.c
parente355b179b2bd42a585464f17759764083fa3ef26 (diff)
i965: Set up allocation of a VS scratch space if required.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_program.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 6674f1640c8..09b5be4c96e 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -226,6 +226,34 @@ static GLboolean brwProgramStringNotify( struct gl_context *ctx,
return GL_TRUE;
}
+/* Per-thread scratch space is a power-of-two multiple of 1KB. */
+int
+brw_get_scratch_size(int size)
+{
+ int i;
+
+ for (i = 1024; i < size; i *= 2)
+ ;
+
+ return i;
+}
+
+void
+brw_get_scratch_bo(struct intel_context *intel,
+ drm_intel_bo **scratch_bo, int size)
+{
+ drm_intel_bo *old_bo = *scratch_bo;
+
+ if (old_bo && old_bo->size < size) {
+ drm_intel_bo_unreference(old_bo);
+ old_bo = NULL;
+ }
+
+ if (!old_bo) {
+ *scratch_bo = drm_intel_bo_alloc(intel->bufmgr, "scratch bo", size, 4096);
+ }
+}
+
void brwInitFragProgFuncs( struct dd_function_table *functions )
{
assert(functions->ProgramStringNotify == _tnl_program_string);