VBoxDispD3D.h revision 2d4065ef19226c8187c1e987aca2ef523135a749
/* $Id$ */
/** @file
* VBoxVideo Display D3D User mode dll
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VBoxDispD3D_h___
#define ___VBoxDispD3D_h___
#include "VBoxDispD3DIf.h"
#include "common/wddm/VBoxMPIf.h"
#ifdef VBOX_WITH_CRHGSMI
#include "VBoxUhgsmiDisp.h"
#endif
#define VBOXWDDMDISP_MAX_VERTEX_STREAMS 16
#define VBOXWDDMDISP_MAX_SWAPCHAIN_SIZE 16
#define VBOXWDDMDISP_MAX_TEX_SAMPLERS 16
#define VBOXWDDMDISP_SAMPLER_IDX_IS_SPECIAL(_i) ((_i) >= D3DDMAPSAMPLER && (_i) <= D3DVERTEXTEXTURESAMPLER3)
#define VBOXWDDMDISP_SAMPLER_IDX_SPECIAL(_i) (VBOXWDDMDISP_SAMPLER_IDX_IS_SPECIAL(_i) ? (int)((_i) - D3DDMAPSAMPLER + VBOXWDDMDISP_MAX_TEX_SAMPLERS) : (int)-1)
#define VBOXWDDMDISP_SAMPLER_IDX(_i) (((_i) < VBOXWDDMDISP_MAX_TEX_SAMPLERS) ? (int)(_i) : VBOXWDDMDISP_SAMPLER_IDX_SPECIAL(_i))
/* maximum number of direct render targets to be used before
* switching to offscreen rendering */
#ifdef VBOXWDDMDISP_DEBUG
#else
# define VBOXWDDMDISP_MAX_DIRECT_RTS 3
#endif
#ifdef VBOX_WITH_VIDEOHWACCEL
typedef struct VBOXDISPVHWA_INFO
{
/* represents settings secific to
* display device (head) on the multiple-head graphics card
* currently used for 2D (overlay) only since in theory its settings
* can differ per each frontend's framebuffer. */
typedef struct VBOXWDDMDISP_HEAD
{
#endif
typedef struct VBOXWDDMDISP_ADAPTER
{
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
typedef struct VBOXWDDMDISP_CONTEXT
{
struct VBOXWDDMDISP_DEVICE *pDevice;
typedef struct VBOXWDDMDISP_STREAMSOURCEUM
{
typedef struct VBOXWDDMDISP_INDICIESUM
{
struct VBOXWDDMDISP_ALLOCATION;
typedef struct VBOXWDDMDISP_STREAM_SOURCE_INFO
{
typedef struct VBOXWDDMDISP_INDICES_INFO
{
typedef struct VBOXWDDMDISP_RENDERTGT_FLAGS
{
union
{
struct
{
};
};
typedef struct VBOXWDDMDISP_RENDERTGT
{
struct VBOXWDDMDISP_ALLOCATION *pAlloc;
#define VBOXWDDMDISP_INDEX_UNDEFINED (~0)
typedef struct VBOXWDDMDISP_SWAPCHAIN_FLAGS
{
union
{
struct
{
UINT bSwitchReportingPresent : 1; /* switch to use VBox extension method for performing present on next present */
};
};
typedef struct VBOXWDDMDISP_SWAPCHAIN
{
#ifndef VBOXWDDM_WITH_VISIBLE_FB
#endif
/* a read-only hWnd we receive from wine
* we use it for visible region notifications only,
* it MUST NOT be destroyed on swapchain destruction,
* wine will handle that for us */
typedef struct VBOXWDDMDISP_DEVICE
{
/* number of StreamSources set */
struct VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;
/* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
* is split into two calls : SetViewport & SetZRange */
#ifdef VBOX_WITH_CRHGSMI
#endif
/* no lock is needed for this since we're guaranteed the per-device calls are not reentrant */
typedef struct VBOXWDDMDISP_LOCKINFO
{
union {
};
#ifdef VBOXWDDMDISP_DEBUG
#endif
typedef enum
{
typedef struct VBOXWDDMDISP_ALLOCATION
{
struct VBOXWDDMDISP_RESOURCE *pRc;
void* pvMem;
/* object type is defined by enmD3DIfType enum */
/* list entry used to add allocation to the dirty alloc list */
typedef struct VBOXWDDMDISP_RESOURCE
{
typedef struct VBOXWDDMDISP_QUERY
{
union
{
} data ;
typedef struct VBOXWDDMDISP_TSS_LOOKUP
{
typedef struct VBOXWDDMDISP_OVERLAY
{
#define VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, idx) ((D3DCUBEMAP_FACES)(D3DCUBEMAP_FACE_POSITIVE_X+(idx)%VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc)))
#ifdef VBOX_WITH_CRHGSMI
#endif
{
return pAlloc->pSwapchain;
}
{
}
/* if swapchain contains only one surface returns this surface */
{
if (pSwapchain->cRTs)
{
}
return NULL;
}
{
if (pSwapchain->cRTs)
{
}
return NULL;
}
/* on success increments the surface ref counter,
* i.e. one must call pSurf->Release() once the surface is not needed*/
DECLINLINE(HRESULT) vboxWddmSurfGet(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, IDirect3DSurface9 **ppSurf)
{
{
{
pD3DIfSurf->AddRef();
*ppSurf = pD3DIfSurf;
break;
}
{
Assert(pRc->cAllocations == 1); /* <- vboxWddmSurfGet is typically used in Blt & ColorFill functions
* in this case, if texture is used as a destination,
* we should update sub-layers as well which is not done currently
* so for now check vboxWddmSurfGet is used for one-level textures */
{
*ppSurf = pSurfaceLevel;
}
break;
}
{
Assert(0);
{
*ppSurf = pSurfaceLevel;
}
break;
}
default:
Assert(0);
break;
}
return hr;
}
#ifdef VBOXDISP_EARLYCREATEDEVICE
#else
#endif
#endif /* #ifndef ___VBoxDispD3D_h___ */