[Mesa-dev] [PATCH v4 (part2) 18/59] i965/wm: emit null buffer surfaces when null buffers are attached
Jordan Justen
jordan.l.justen at intel.com
Fri Aug 28 15:25:33 PDT 2015
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
On 2015-08-05 01:30:15, Iago Toral Quiroga wrote:
> From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>
> Otherwise we can expect odd things to happen if, for example, we ask
> for the size of the attached buffer from shader code, since that
> might query this value from the surface we uploaded and get random
> results.
>
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 44 ++++++++++++++----------
> 1 file changed, 26 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 2fdf716..08ad8e8 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -932,28 +932,36 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
> struct gl_uniform_buffer_binding *binding;
> binding =
> &ctx->UniformBufferBindings[shader->UniformBlocks[i].Binding];
> - intel_bo = intel_buffer_object(binding->BufferObject);
> - drm_intel_bo *bo =
> - intel_bufferobj_buffer(brw, intel_bo,
> - binding->Offset,
> - binding->BufferObject->Size - binding->Offset);
> - brw_create_constant_surface(brw, bo, binding->Offset,
> - bo->size - binding->Offset,
> - &surf_offsets[i],
> - dword_pitch);
> + if (binding->BufferObject == ctx->Shared->NullBufferObj) {
> + brw->vtbl.emit_null_surface_state(brw, 1, 1, 1, &surf_offsets[i]);
> + } else {
> + intel_bo = intel_buffer_object(binding->BufferObject);
> + drm_intel_bo *bo =
> + intel_bufferobj_buffer(brw, intel_bo,
> + binding->Offset,
> + binding->BufferObject->Size - binding->Offset);
> + brw_create_constant_surface(brw, bo, binding->Offset,
> + bo->size - binding->Offset,
> + &surf_offsets[i],
> + dword_pitch);
> + }
> } else {
> struct gl_shader_storage_buffer_binding *binding;
> binding =
> &ctx->ShaderStorageBufferBindings[shader->UniformBlocks[i].Binding];
> - intel_bo = intel_buffer_object(binding->BufferObject);
> - drm_intel_bo *bo =
> - intel_bufferobj_buffer(brw, intel_bo,
> - binding->Offset,
> - binding->BufferObject->Size - binding->Offset);
> - brw_create_buffer_surface(brw, bo, binding->Offset,
> - bo->size - binding->Offset,
> - &surf_offsets[i],
> - dword_pitch);
> + if (binding->BufferObject == ctx->Shared->NullBufferObj) {
> + brw->vtbl.emit_null_surface_state(brw, 1, 1, 1, &surf_offsets[i]);
> + } else {
> + intel_bo = intel_buffer_object(binding->BufferObject);
> + drm_intel_bo *bo =
> + intel_bufferobj_buffer(brw, intel_bo,
> + binding->Offset,
> + binding->BufferObject->Size - binding->Offset);
> + brw_create_buffer_surface(brw, bo, binding->Offset,
> + bo->size - binding->Offset,
> + &surf_offsets[i],
> + dword_pitch);
> + }
> }
> }
>
> --
> 1.9.1
>
More information about the mesa-dev
mailing list