mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
nv30, nv40: unify identical nv[34]0_transfer.c
This commit is contained in:
parent
c5c7b69bda
commit
d084d189d0
9 changed files with 26 additions and 26 deletions
|
|
@ -21,7 +21,6 @@ C_SOURCES = \
|
|||
nv30_state_viewport.c \
|
||||
nv30_state_zsa.c \
|
||||
nv30_surface.c \
|
||||
nv30_transfer.c \
|
||||
nv30_vbo.c \
|
||||
nv30_vertprog.c
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ nv30_create(struct pipe_screen *pscreen, void *priv)
|
|||
nv30_init_query_functions(nvfx);
|
||||
nv30_init_surface_functions(nvfx);
|
||||
nv30_init_state_functions(nvfx);
|
||||
nv30_init_transfer_functions(nvfx);
|
||||
nvfx_init_transfer_functions(nvfx);
|
||||
|
||||
/* Create, configure, and install fallback swtnl path */
|
||||
nvfx->draw = draw_create();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
extern void nv30_init_state_functions(struct nvfx_context *nvfx);
|
||||
extern void nv30_init_surface_functions(struct nvfx_context *nvfx);
|
||||
extern void nv30_init_query_functions(struct nvfx_context *nvfx);
|
||||
extern void nv30_init_transfer_functions(struct nvfx_context *nvfx);
|
||||
|
||||
extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ C_SOURCES = \
|
|||
nv40_state_viewport.c \
|
||||
nv40_state_zsa.c \
|
||||
nv40_surface.c \
|
||||
nv40_transfer.c \
|
||||
nv40_vbo.c \
|
||||
nv40_vertprog.c
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ nv40_create(struct pipe_screen *pscreen, void *priv)
|
|||
nv40_init_query_functions(nvfx);
|
||||
nv40_init_surface_functions(nvfx);
|
||||
nv40_init_state_functions(nvfx);
|
||||
nv40_init_transfer_functions(nvfx);
|
||||
nvfx_init_transfer_functions(nvfx);
|
||||
|
||||
/* Create, configure, and install fallback swtnl path */
|
||||
nvfx->draw = draw_create();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
extern void nv40_init_state_functions(struct nvfx_context *nvfx);
|
||||
extern void nv40_init_surface_functions(struct nvfx_context *nvfx);
|
||||
extern void nv40_init_query_functions(struct nvfx_context *nvfx);
|
||||
extern void nv40_init_transfer_functions(struct nvfx_context *nvfx);
|
||||
|
||||
extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ include $(TOP)/configs/current
|
|||
LIBNAME = nvfx
|
||||
|
||||
C_SOURCES = \
|
||||
nvfx_clear.c
|
||||
nvfx_clear.c \
|
||||
nvfx_transfer.c
|
||||
|
||||
include ../../Makefile.template
|
||||
|
|
|
|||
|
|
@ -185,4 +185,7 @@ struct nvfx_state_entry {
|
|||
extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
const float *rgba, double depth, unsigned stencil);
|
||||
|
||||
/* nvfx_transfer.c */
|
||||
extern void nvfx_init_transfer_functions(struct nvfx_context *nvfx);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,18 +5,18 @@
|
|||
#include "util/u_memory.h"
|
||||
#include "util/u_math.h"
|
||||
#include "nouveau/nouveau_winsys.h"
|
||||
#include "nv30_context.h"
|
||||
#include "nvfx_context.h"
|
||||
#include "nvfx_screen.h"
|
||||
#include "nvfx_state.h"
|
||||
|
||||
struct nv30_transfer {
|
||||
struct nvfx_transfer {
|
||||
struct pipe_transfer base;
|
||||
struct pipe_surface *surface;
|
||||
boolean direct;
|
||||
};
|
||||
|
||||
static void
|
||||
nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height,
|
||||
nvfx_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height,
|
||||
struct pipe_texture *template)
|
||||
{
|
||||
memset(template, 0, sizeof(struct pipe_texture));
|
||||
|
|
@ -33,17 +33,17 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h
|
|||
}
|
||||
|
||||
static struct pipe_transfer *
|
||||
nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
|
||||
nvfx_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
|
||||
unsigned face, unsigned level, unsigned zslice,
|
||||
enum pipe_transfer_usage usage,
|
||||
unsigned x, unsigned y, unsigned w, unsigned h)
|
||||
{
|
||||
struct pipe_screen *pscreen = pcontext->screen;
|
||||
struct nvfx_miptree *mt = (struct nvfx_miptree *)pt;
|
||||
struct nv30_transfer *tx;
|
||||
struct nvfx_transfer *tx;
|
||||
struct pipe_texture tx_tex_template, *tx_tex;
|
||||
|
||||
tx = CALLOC_STRUCT(nv30_transfer);
|
||||
tx = CALLOC_STRUCT(nvfx_transfer);
|
||||
if (!tx)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
|
|||
|
||||
tx->direct = false;
|
||||
|
||||
nv30_compatible_transfer_tex(pt, w, h, &tx_tex_template);
|
||||
nvfx_compatible_transfer_tex(pt, w, h, &tx_tex_template);
|
||||
|
||||
tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
|
||||
if (!tx_tex)
|
||||
|
|
@ -118,10 +118,10 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
|
|||
}
|
||||
|
||||
static void
|
||||
nv30_transfer_del(struct pipe_context *pcontext,
|
||||
nvfx_transfer_del(struct pipe_context *pcontext,
|
||||
struct pipe_transfer *ptx)
|
||||
{
|
||||
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
|
||||
struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx;
|
||||
|
||||
if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) {
|
||||
struct pipe_screen *pscreen = pcontext->screen;
|
||||
|
|
@ -147,10 +147,10 @@ nv30_transfer_del(struct pipe_context *pcontext,
|
|||
}
|
||||
|
||||
static void *
|
||||
nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
|
||||
nvfx_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
|
||||
{
|
||||
struct pipe_screen *pscreen = pcontext->screen;
|
||||
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
|
||||
struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx;
|
||||
struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
|
||||
struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture;
|
||||
void *map = pipe_buffer_map(pscreen, mt->buffer,
|
||||
|
|
@ -163,20 +163,20 @@ nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
|
|||
}
|
||||
|
||||
static void
|
||||
nv30_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
|
||||
nvfx_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
|
||||
{
|
||||
struct pipe_screen *pscreen = pcontext->screen;
|
||||
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
|
||||
struct pipe_screen *pscreen = pcontext->screen;
|
||||
struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx;
|
||||
struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture;
|
||||
|
||||
pipe_buffer_unmap(pscreen, mt->buffer);
|
||||
}
|
||||
|
||||
void
|
||||
nv30_init_transfer_functions(struct nvfx_context *nvfx)
|
||||
nvfx_init_transfer_functions(struct nvfx_context *nvfx)
|
||||
{
|
||||
nvfx->pipe.get_tex_transfer = nv30_transfer_new;
|
||||
nvfx->pipe.tex_transfer_destroy = nv30_transfer_del;
|
||||
nvfx->pipe.transfer_map = nv30_transfer_map;
|
||||
nvfx->pipe.transfer_unmap = nv30_transfer_unmap;
|
||||
nvfx->pipe.get_tex_transfer = nvfx_transfer_new;
|
||||
nvfx->pipe.tex_transfer_destroy = nvfx_transfer_del;
|
||||
nvfx->pipe.transfer_map = nvfx_transfer_map;
|
||||
nvfx->pipe.transfer_unmap = nvfx_transfer_unmap;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue