return ret;
memcpy(svga->state.hw_draw.cb[shader][i], value, 4 * sizeof(float));
+
+ svga->hud.num_const_updates++;
}
return ret;
(j - i) * 4 * sizeof(float));
i = j + 1;
+
+ svga->hud.num_const_updates++;
+
} else {
++i;
}
data = (const float (*)[4])
pipe_buffer_map(&svga->pipe, svga->curr.constbufs[shader][0].buffer,
PIPE_TRANSFER_READ, &transfer);
- if (data == NULL) {
+ if (!data) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
*/
new_buf_size = align(new_buf_size, 16);
- u_upload_alloc(svga->const0_upload, 0, new_buf_size, &offset,
+ u_upload_alloc(svga->const0_upload, 0, new_buf_size,
+ CONST0_UPLOAD_ALIGNMENT, &offset,
&dst_buffer, &dst_map);
if (!dst_map) {
if (src_map)
pipe_resource_reference(&dst_buffer, NULL);
+ svga->hud.num_const_buf_updates++;
+
return ret;
}
assert(size == 0);
}
+ if (size % 16 != 0) {
+ /* GL's buffer range sizes can be any number of bytes but the
+ * SVGA3D device requires a multiple of 16 bytes.
+ */
+ const unsigned total_size = buffer->b.b.width0;
+
+ if (offset + align(size, 16) <= total_size) {
+ /* round up size to multiple of 16 */
+ size = align(size, 16);
+ }
+ else {
+ /* round down to mulitple of 16 (this may cause rendering problems
+ * but should avoid a device error).
+ */
+ size &= ~15;
+ }
+ }
+
assert(size % 16 == 0);
ret = SVGA3D_vgpu10_SetSingleConstantBuffer(svga->swc,
index,
size);
if (ret != PIPE_OK)
return ret;
+
+ svga->hud.num_const_buf_updates++;
}
svga->state.hw_draw.enabled_constbufs[shader] = enabled_constbufs;
/* SVGA_NEW_FS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_FS_CONST_BUFFER
/* SVGA_NEW_VS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_VS_CONST_BUFFER
/* SVGA_NEW_GS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_GS_CONST_BUFFER