Except for nine_ff and nine_state.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
return hr;
This->format = format;
- This->pipe = pParams->device->pipe;
This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ?
D3DTEXF_LINEAR : D3DTEXF_NONE;
This->managed.lod = 0;
void NINE_WINAPI
NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
{
+ struct pipe_context *pipe;
struct pipe_resource *resource;
unsigned base_level = 0;
unsigned last_level = This->base.info.last_level - This->managed.lod;
resource = This->base.resource;
- util_gen_mipmap(This->pipe, resource,
+ pipe = NineDevice9_GetPipe(This->base.base.device);
+ util_gen_mipmap(pipe, resource,
resource->format, base_level, last_level,
first_layer, last_layer, filter);
NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This,
BOOL CopyData )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe;
struct pipe_screen *screen = This->base.info.screen;
struct pipe_resource templ;
unsigned l, m;
if (!res)
return D3DERR_OUTOFVIDEOMEMORY;
This->base.resource = res;
+ pipe = NineDevice9_GetPipe(This->base.base.device);
if (old && CopyData) { /* Don't return without releasing old ! */
struct pipe_box box;
const int sRGB )
{
const struct util_format_description *desc;
- struct pipe_context *pipe = This->pipe;
- struct pipe_screen *screen = pipe->screen;
+ struct pipe_context *pipe;
+ struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device);
struct pipe_resource *resource = This->base.resource;
struct pipe_sampler_view templ;
enum pipe_format srgb_format;
templ.swizzle_a = swizzle[3];
templ.target = resource->target;
+ pipe = NineDevice9_GetPipe(This->base.base.device);
This->view[sRGB] = pipe->create_sampler_view(pipe, resource, &templ);
DBG("sampler view = %p(resource = %p)\n", This->view[sRGB], resource);
struct list_head list2; /* for managed_textures */
/* g3d */
- struct pipe_context *pipe;
struct pipe_sampler_view *view[2]; /* linear and sRGB */
D3DFORMAT format;
This->maxmaps = 1;
This->size = Size;
- This->pipe = pParams->device->pipe;
-
info->screen = pParams->device->screen;
info->target = PIPE_BUFFER;
info->format = PIPE_FORMAT_R8_UNORM;
DWORD Flags )
{
struct pipe_box box;
+ struct pipe_context *pipe;
void *data;
unsigned usage;
This->maps = newmaps;
}
- data = This->pipe->transfer_map(This->pipe, This->base.resource, 0,
- usage, &box, &This->maps[This->nmaps]);
+ pipe = NineDevice9_GetPipe(This->base.base.device);
+ data = pipe->transfer_map(pipe, This->base.resource, 0,
+ usage, &box, &This->maps[This->nmaps]);
if (!data) {
DBG("pipe::transfer_map failed\n"
HRESULT NINE_WINAPI
NineBuffer9_Unlock( struct NineBuffer9 *This )
{
+ struct pipe_context *pipe;
DBG("This=%p\n", This);
user_assert(This->nmaps > 0, D3DERR_INVALIDCALL);
- if (This->base.pool != D3DPOOL_MANAGED)
- This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]);
- else {
+ if (This->base.pool != D3DPOOL_MANAGED) {
+ pipe = NineDevice9_GetPipe(This->base.base.device);
+ pipe->transfer_unmap(pipe, This->maps[--(This->nmaps)]);
+ } else {
This->nmaps--;
/* TODO: Fix this to upload at the first draw call needing the data,
* instead of at the next draw call */
#ifndef _NINE_BUFFER9_H_
#define _NINE_BUFFER9_H_
+#include "device9.h"
#include "resource9.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
struct NineResource9 base;
/* G3D */
- struct pipe_context *pipe;
struct pipe_transfer **maps;
int nmaps, maxmaps;
UINT size;
static inline void
NineBuffer9_Upload( struct NineBuffer9 *This )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This->base.base.device);
assert(This->base.pool == D3DPOOL_MANAGED && This->managed.dirty);
pipe->buffer_subdata(pipe, This->base.resource, 0,
IDirect3DSurface9 *pCursorBitmap )
{
struct NineSurface9 *surf = NineSurface9(pCursorBitmap);
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct pipe_box box;
struct pipe_transfer *transfer;
BOOL hw_cursor;
D3DTEXTUREFILTERTYPE Filter )
{
struct pipe_screen *screen = This->screen;
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct NineSurface9 *dst = NineSurface9(pDestSurface);
struct NineSurface9 *src = NineSurface9(pSourceSurface);
struct pipe_resource *dst_res = NineSurface9_GetResource(dst);
const RECT *pRect,
D3DCOLOR color )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct NineSurface9 *surf = NineSurface9(pSurface);
struct pipe_surface *psurf;
unsigned x, y, w, h;
void
nine_pipe_context_clear(struct NineDevice9 *This)
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct cso_context *cso = This->cso;
pipe->bind_vs_state(pipe, NULL);
pipe->bind_fs_state(pipe, NULL);
HRESULT hr = D3D_OK;
const unsigned processor = info->type;
struct pipe_screen *screen = info->process_vertices ? device->screen_sw : device->screen;
- struct pipe_context *pipe = info->process_vertices ? device->pipe_sw : device->pipe;
+ struct pipe_context *pipe = info->process_vertices ? device->pipe_sw : NineDevice9_GetPipe(device);
user_assert(processor != ~0, D3DERR_INVALIDCALL);
DBG("This=%p\n", This);
if (This->base.device) {
- struct pipe_context *pipe = This->base.device->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device);
struct nine_shader_variant *var = &This->variant;
do {
HRESULT hr;
union pipe_color_union rgba = {0};
struct pipe_surface *surf;
- struct pipe_context *pipe = pParams->device->pipe;
+ struct pipe_context *pipe;
bool allocate = !pContainer && pDesc->Format != D3DFMT_NULL;
D3DMULTISAMPLE_TYPE multisample_type;
if (FAILED(hr))
return hr;
- This->pipe = This->base.base.device->pipe;
This->transfer = NULL;
This->texture = TextureType;
/* TODO: investigate what else exactly needs to be cleared */
if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) {
surf = NineSurface9_GetSurface(This, 0);
+ pipe = NineDevice9_GetPipe(pParams->device);
pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height, false);
}
struct pipe_surface *
NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB )
{
- struct pipe_context *pipe = This->pipe;
- struct pipe_screen *screen = pipe->screen;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This->base.base.device);
+ struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device);
struct pipe_resource *resource = This->base.resource;
struct pipe_surface templ;
enum pipe_format srgb_format;
DWORD Flags )
{
struct pipe_resource *resource = This->base.resource;
+ struct pipe_context *pipe;
struct pipe_box box;
unsigned usage;
DBG("mapping pipe_resource %p (level=%u usage=%x)\n",
resource, This->level, usage);
- pLockedRect->pBits = This->pipe->transfer_map(This->pipe, resource,
- This->level, usage, &box,
- &This->transfer);
+ pipe = NineDevice9_GetPipe(This->base.base.device);
+ pLockedRect->pBits = pipe->transfer_map(pipe, resource,
+ This->level, usage, &box,
+ &This->transfer);
if (!This->transfer) {
DBG("transfer_map failed\n");
if (Flags & D3DLOCK_DONOTWAIT)
HRESULT NINE_WINAPI
NineSurface9_UnlockRect( struct NineSurface9 *This )
{
+ struct pipe_context *pipe;
DBG("This=%p lock_count=%u\n", This, This->lock_count);
user_assert(This->lock_count, D3DERR_INVALIDCALL);
if (This->transfer) {
- This->pipe->transfer_unmap(This->pipe, This->transfer);
+ pipe = NineDevice9_GetPipe(This->base.base.device);
+ pipe->transfer_unmap(pipe, This->transfer);
This->transfer = NULL;
}
--This->lock_count;
u_box_origin_2d(This->desc.Width, This->desc.Height, &box);
+ pipe = NineDevice9_GetPipe(This->base.base.device);
if (!dst) {
- dst = This->pipe->transfer_map(This->pipe,
- This->base.resource,
- This->level,
- PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
- &box, &transfer);
+ dst = pipe->transfer_map(pipe,
+ This->base.resource,
+ This->level,
+ PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
+ &box, &transfer);
if (!dst)
return D3D_OK;
}
This->desc.Width, This->desc.Height);
if (!This->data)
- pipe_transfer_unmap(This->pipe, transfer);
+ pipe_transfer_unmap(pipe, transfer);
}
return D3D_OK;
}
const POINT *pDestPoint,
const RECT *pSourceRect )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe;
struct pipe_transfer *transfer = NULL;
struct pipe_resource *r_dst = This->base.resource;
struct pipe_box dst_box;
u_box_2d_zslice(dst_x, dst_y, This->layer,
copy_width, copy_height, &dst_box);
+ pipe = NineDevice9_GetPipe(This->base.base.device);
map = pipe->transfer_map(pipe,
r_dst,
This->level,
NineSurface9_CopyDefaultToMem( struct NineSurface9 *This,
struct NineSurface9 *From )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe;
struct pipe_resource *r_src = From->base.resource;
struct pipe_transfer *transfer;
struct pipe_box src_box;
u_box_origin_2d(This->desc.Width, This->desc.Height, &src_box);
src_box.z = From->layer;
+ pipe = NineDevice9_GetPipe(This->base.base.device);
p_src = pipe->transfer_map(pipe, r_src, From->level,
PIPE_TRANSFER_READ,
&src_box, &transfer);
NineSurface9_UploadSelf( struct NineSurface9 *This,
const struct pipe_box *damaged )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe;
struct pipe_resource *res = This->base.resource;
uint8_t *ptr;
struct pipe_box box;
ptr = NineSurface9_GetSystemMemPointer(This, box.x, box.y);
+ pipe = NineDevice9_GetPipe(This->base.base.device);
pipe->texture_subdata(pipe, res, This->level, 0,
&box, ptr, This->stride, 0);
struct NineResource9 base;
/* G3D state */
- struct pipe_context *pipe;
struct pipe_transfer *transfer;
struct pipe_surface *surface[2]; /* created on-demand (linear, sRGB) */
int lock_count;
return hr;
This->screen = NineDevice9_GetScreen(This->base.device);
- This->pipe = NineDevice9_GetPipe(This->base.device);
This->implicit = implicit;
This->actx = pCTX;
This->present = pPresent;
int for_frontbuffer_reading)
{
D3DWindowBuffer *ret;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device);
struct winsys_handle whandle;
int stride, dmaBufFd;
HRESULT hr;
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_FD;
- This->screen->resource_get_handle(This->screen, This->pipe, resource,
+ This->screen->resource_get_handle(This->screen, pipe, resource,
&whandle,
for_frontbuffer_reading ?
PIPE_HANDLE_USAGE_WRITE :
{
struct NineDevice9 *device = This->base.device;
struct pipe_blit_info blit;
+ struct pipe_context *pipe;
if (device->cursor.software && device->cursor.visible && device->cursor.w) {
memset(&blit, 0, sizeof(blit));
blit.dst.box.x, blit.dst.box.y);
blit.alpha_blend = TRUE;
- This->pipe->blit(This->pipe, &blit);
+ pipe = NineDevice9_GetPipe(This->base.device);
+ pipe->blit(pipe, &blit);
}
if (device->hud && resource) {
const RGNDATA *pDirtyRegion,
DWORD dwFlags )
{
+ struct pipe_context *pipe;
struct pipe_resource *resource;
struct pipe_fence_handle *fence;
HRESULT hr;
if (This->params.SwapEffect == D3DSWAPEFFECT_DISCARD)
handle_draw_cursor_and_hud(This, resource);
+ pipe = NineDevice9_GetPipe(This->base.device);
+
if (This->present_buffers[0]) {
memset(&blit, 0, sizeof(blit));
blit.src.resource = resource;
blit.scissor_enable = FALSE;
blit.alpha_blend = FALSE;
- This->pipe->blit(This->pipe, &blit);
+ pipe->blit(pipe, &blit);
}
/* The resource we present has to resolve fast clears
* if needed (and other things) */
- This->pipe->flush_resource(This->pipe, resource);
+ pipe->flush_resource(pipe, resource);
if (This->params.SwapEffect != D3DSWAPEFFECT_DISCARD)
handle_draw_cursor_and_hud(This, resource);
fence = NULL;
- This->pipe->flush(This->pipe, &fence, PIPE_FLUSH_END_OF_FRAME);
+ pipe->flush(pipe, &fence, PIPE_FLUSH_END_OF_FRAME);
if (fence) {
swap_fences_push_back(This, fence);
This->screen->fence_reference(This->screen, &fence, NULL);
/* G3D stuff */
struct pipe_screen *screen;
- struct pipe_context *pipe;
/* presentation backend */
ID3DPresent *present;
DBG("This=%p\n", This);
if (This->base.device) {
- struct pipe_context *pipe = This->base.device->pipe;
+ struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device);
struct nine_shader_variant *var = &This->variant;
struct nine_shader_variant_so *var_so = &This->variant_so;
pipe_resource_reference(&This->resource, pResource);
- This->pipe = pParams->device->pipe;
This->transfer = NULL;
This->lock_count = 0;
const D3DBOX *pBox,
DWORD Flags )
{
+ struct pipe_context *pipe;
struct pipe_resource *resource = This->resource;
struct pipe_box box;
unsigned usage;
pLockedVolume->pBits =
NineVolume9_GetSystemMemPointer(This, box.x, box.y, box.z);
} else {
+ pipe = NineDevice9_GetPipe(This->base.device);
pLockedVolume->pBits =
- This->pipe->transfer_map(This->pipe, resource, This->level, usage,
- &box, &This->transfer);
+ pipe->transfer_map(pipe, resource, This->level, usage,
+ &box, &This->transfer);
if (!This->transfer) {
if (Flags & D3DLOCK_DONOTWAIT)
return D3DERR_WASSTILLDRAWING;
HRESULT NINE_WINAPI
NineVolume9_UnlockBox( struct NineVolume9 *This )
{
+ struct pipe_context *pipe;
+
DBG("This=%p lock_count=%u\n", This, This->lock_count);
user_assert(This->lock_count, D3DERR_INVALIDCALL);
if (This->transfer) {
- This->pipe->transfer_unmap(This->pipe, This->transfer);
+ pipe = NineDevice9_GetPipe(This->base.device);
+ pipe->transfer_unmap(pipe, This->transfer);
This->transfer = NULL;
}
--This->lock_count;
u_box_3d(0, 0, 0, This->desc.Width, This->desc.Height, This->desc.Depth,
&box);
+ pipe = NineDevice9_GetPipe(This->base.device);
if (!dst) {
- dst = This->pipe->transfer_map(This->pipe,
- This->resource,
- This->level,
- PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
- &box, &transfer);
+ dst = pipe->transfer_map(pipe,
+ This->resource,
+ This->level,
+ PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
+ &box, &transfer);
if (!dst)
return D3D_OK;
}
This->desc.Depth);
if (!This->data)
- pipe_transfer_unmap(This->pipe, transfer);
+ pipe_transfer_unmap(pipe, transfer);
}
return D3D_OK;
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_box *pSrcBox )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe;
struct pipe_transfer *transfer = NULL;
struct pipe_resource *r_dst = This->resource;
struct pipe_box src_box;
dst_box.height = src_box.height;
dst_box.depth = src_box.depth;
+ pipe = NineDevice9_GetPipe(This->base.device);
+
map = pipe->transfer_map(pipe,
r_dst,
This->level,
NineVolume9_UploadSelf( struct NineVolume9 *This,
const struct pipe_box *damaged )
{
- struct pipe_context *pipe = This->pipe;
+ struct pipe_context *pipe;
struct pipe_resource *res = This->resource;
struct pipe_box box;
uint8_t *ptr;
ptr = NineVolume9_GetSystemMemPointer(This, box.x, box.y, box.z);
+ pipe = NineDevice9_GetPipe(This->base.device);
pipe->texture_subdata(pipe, res, This->level, 0, &box,
ptr, This->stride, This->layer_stride);
struct pipe_transfer *transfer;
unsigned lock_count;
-
- struct pipe_context *pipe;
};
static inline struct NineVolume9 *
NineVolume9( void *data )