i965/wm: use proper API buffer size for the surfaces.

Commit 5bb5eeea fixes a bug indicating that the surfaces should have the
API buffer size. Hovewer it picked the wrong value.

This patch adds a new variable, which takes into account
glBindBufferRange() values. This patch fixes the following CTS
regressions:

ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeOffset
ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeSize
Signed-off-by: Samuel Iglesias Gonsálvez's avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Marta Löfstedt's avatarMarta Lofstedt <marta.lofstedt@intel.com>
parent 86fa4842
......@@ -946,12 +946,14 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
} else {
struct intel_buffer_object *intel_bo =
intel_buffer_object(binding->BufferObject);
GLsizeiptrARB size = MIN2(binding->BufferObject->BufferRangeSize,
binding->BufferObject->Size - binding->Offset);
drm_intel_bo *bo =
intel_bufferobj_buffer(brw, intel_bo,
binding->Offset,
binding->BufferObject->Size - binding->Offset);
size);
brw_create_constant_surface(brw, bo, binding->Offset,
binding->BufferObject->Size - binding->Offset,
size,
&ubo_surf_offsets[i]);
}
}
......@@ -968,12 +970,14 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
} else {
struct intel_buffer_object *intel_bo =
intel_buffer_object(binding->BufferObject);
GLsizeiptrARB size = MIN2(binding->BufferObject->BufferRangeSize,
binding->BufferObject->Size - binding->Offset);
drm_intel_bo *bo =
intel_bufferobj_buffer(brw, intel_bo,
binding->Offset,
binding->BufferObject->Size - binding->Offset);
size);
brw_create_buffer_surface(brw, bo, binding->Offset,
binding->BufferObject->Size - binding->Offset,
size,
&ssbo_surf_offsets[i]);
}
}
......
......@@ -198,6 +198,7 @@ brw_buffer_data(struct gl_context *ctx,
(void) target;
intel_obj->Base.Size = size;
intel_obj->Base.BufferRangeSize = size;
intel_obj->Base.Usage = usage;
intel_obj->Base.StorageFlags = storageFlags;
......
......@@ -43,7 +43,7 @@
#include "glformats.h"
#include "texstore.h"
#include "transformfeedback.h"
#include "macros.h"
/* Debug flags */
/*#define VBO_DEBUG*/
......@@ -2840,6 +2840,7 @@ bind_buffer_range_uniform_buffer(struct gl_context *ctx,
_mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);
bind_uniform_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
}
/**
......@@ -2875,6 +2876,7 @@ bind_buffer_range_shader_storage_buffer(struct gl_context *ctx,
_mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj);
bind_shader_storage_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
}
/**
......
......@@ -1268,6 +1268,7 @@ struct gl_buffer_object
GLenum Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */
GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */
GLsizeiptrARB Size; /**< Size of buffer storage in bytes */
GLsizeiptrARB BufferRangeSize; /**< Amount of data that can be read from or written to, in bytes */
GLubyte *Data; /**< Location of storage either in RAM or VRAM. */
GLboolean DeletePending; /**< true if buffer object is removed from the hash */
GLboolean Written; /**< Ever written to? (for debugging) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment