diff options
author | Samuel Iglesias Gonsalvez <[email protected]> | 2015-04-16 13:18:01 +0200 |
---|---|---|
committer | Samuel Iglesias Gonsalvez <[email protected]> | 2015-09-25 08:39:21 +0200 |
commit | eaa6f01c8d0c49d8ae637d8104163da9c45526ca (patch) | |
tree | 1bad82b730807784224ba4620c90df3c1eb93559 /src/mesa/drivers/dri/i965 | |
parent | f5dd2c182275a9de57e5186491012c402a6248e0 (diff) |
i965/wm: emit null buffer surfaces when null buffers are attached
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 <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 44 |
1 files 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 24ff2d6a443..61031d29db3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -939,28 +939,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); + } } } |