summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-06-29 02:16:23 -0400
committerIlia Mirkin <[email protected]>2015-06-29 23:03:27 -0400
commitb875198f1f0b7c90bcb22511c0050b06d8a33ac4 (patch)
tree9979ba0bf9d889f1a28a56f637de4a1fc3179078 /src/gallium/drivers/nouveau
parent54afb10f0e0a3b72a977c239c0aee04ea5dec967 (diff)
nv30: modernize fp upload logic
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_fragprog.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c b/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c
index 7f227868f73..dbf36fd53b5 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c
@@ -37,22 +37,26 @@ nv30_fragprog_upload(struct nv30_context *nv30)
struct nouveau_context *nv = &nv30->base;
struct nv30_fragprog *fp = nv30->fragprog.program;
struct pipe_context *pipe = &nv30->base.pipe;
- struct pipe_transfer *transfer;
- uint32_t *map;
- int i; (void)i;
- if (unlikely(!fp->buffer)) {
+ if (unlikely(!fp->buffer))
fp->buffer = pipe_buffer_create(pipe->screen, 0, 0, fp->insn_len * 4);
- }
- map = pipe_buffer_map(pipe, fp->buffer, PIPE_TRANSFER_WRITE, &transfer);
#ifndef PIPE_ARCH_BIG_ENDIAN
- memcpy(map, fp->insn, fp->insn_len * 4);
+ pipe_buffer_write(pipe, fp->buffer, 0, fp->insn_len * 4, fp->insn);
#else
- for (i = 0; i < fp->insn_len; i++)
- *map++ = (fp->insn[i] >> 16) | (fp->insn[i] << 16);
+ {
+ struct pipe_transfer *transfer;
+ uint32_t *map;
+ int i;
+
+ map = pipe_buffer_map(pipe, fp->buffer,
+ PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
+ &transfer);
+ for (i = 0; i < fp->insn_len; i++)
+ *map++ = (fp->insn[i] >> 16) | (fp->insn[i] << 16);
+ pipe_buffer_unmap(pipe, transfer);
+ }
#endif
- pipe_buffer_unmap(pipe, transfer);
if (nv04_resource(fp->buffer)->domain != NOUVEAU_BO_VRAM)
nouveau_buffer_migrate(nv, nv04_resource(fp->buffer), NOUVEAU_BO_VRAM);