summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/v3d
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-03-19 11:39:58 -0700
committerEric Anholt <[email protected]>2019-03-21 14:20:50 -0700
commit320e96baced8093c6af11d86a216d83cee1eeb30 (patch)
treeccd26e9344f16640e17212171a4d4d558139da46 /src/gallium/drivers/v3d
parentc36d2793ec79a8cee75953acbc87b621fbd25e49 (diff)
v3d: Move constant offsets to UBO addresses into the main uniform stream.
We'd end up with the constant offset in the uniform stream anyway, since they're bigger than small immediates. Avoids the extra uniforms and adds in the shader in favor of just adding once on the CPU. shader-db: total instructions in shared programs: 6496865 -> 6494851 (-0.03%) total uniforms in shared programs: 2119511 -> 2117243 (-0.11%)
Diffstat (limited to 'src/gallium/drivers/v3d')
-rw-r--r--src/gallium/drivers/v3d/v3d_screen.c3
-rw-r--r--src/gallium/drivers/v3d/v3d_uniforms.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c
index c810fbc98b4..073bdf51449 100644
--- a/src/gallium/drivers/v3d/v3d_screen.c
+++ b/src/gallium/drivers/v3d/v3d_screen.c
@@ -279,6 +279,9 @@ v3d_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
case PIPE_SHADER_CAP_MAX_TEMPS:
return 256; /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+ /* Note: Limited by the offset size in
+ * v3d_unit_data_create().
+ */
return 16 * 1024 * sizeof(float);
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
return 16;
diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c
index 371568b31e6..b48f6526d61 100644
--- a/src/gallium/drivers/v3d/v3d_uniforms.c
+++ b/src/gallium/drivers/v3d/v3d_uniforms.c
@@ -334,13 +334,14 @@ v3d_write_uniforms(struct v3d_context *v3d, struct v3d_compiled_shader *shader,
cl_aligned_reloc(&job->indirect, &uniforms,
ubo, 0);
} else {
- int ubo_index = data;
+ int ubo_index = v3d_unit_data_get_unit(data);
struct v3d_resource *rsc =
v3d_resource(cb->cb[ubo_index].buffer);
cl_aligned_reloc(&job->indirect, &uniforms,
rsc->bo,
- cb->cb[ubo_index].buffer_offset);
+ cb->cb[ubo_index].buffer_offset +
+ v3d_unit_data_get_offset(data));
}
break;