/*
* Direct3D wine internal private include file
*
* Copyright 2002-2003 The wine-d3d team
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2002-2003, 2004 Jason Edmeades
* Copyright 2005 Oliver Stieber
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#ifndef __WINE_WINED3D_PRIVATE_H
#define __WINE_WINED3D_PRIVATE_H
#include <stdarg.h>
#include <math.h>
#include <limits.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#ifndef VBOX_WINE_WITHOUT_LIBWINE
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#else
#include <windows.h>
#endif
#ifndef VBOX_WINE_WITHOUT_LIBWINE
#include "objbase.h"
#endif
#include "wined3d_gl.h"
#include "vboxext.h"
#ifdef VBOX_WITH_VMSVGA
# ifndef LOG_GROUP
# endif
# include "winoverride.h"
# include "shaderlib.h"
#endif
#ifdef VBOX_WITH_WDDM
# include "vboxsharedrc.h"
#endif
#if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
# include <VBox/VBoxVideo3D.h>
#endif
/* Driver quirks */
/* Texture format fixups */
enum fixup_channel_source
{
CHANNEL_SOURCE_ZERO = 0,
};
enum complex_fixup
{
COMPLEX_FIXUP_NONE = 0,
};
#include <pshpack2.h>
struct color_fixup_desc
{
};
#include <poppack.h>
{
{
};
return fixup;
}
{
{
};
return fixup;
}
{
}
{
}
{
return complex_fixup;
}
/* Device caps */
struct min_lookup
{
};
static inline GLenum wined3d_gl_mag_filter(const GLenum mag_lookup[], WINED3DTEXTUREFILTERTYPE mag_filter)
{
return mag_lookup[mag_filter];
}
{
}
/* float_16_to_32() and float_32_to_16() (see implementation in
* surface_base.c) convert 16 bit floats in the FLOAT16 data type
* to standard C floats and vice versa. They do not depend on the encoding
* of the C float, so they are platform independent, but slow. On x86 and
* other IEEE 754 compliant platforms the conversion can be accelerated by
* bit shifting the exponent and mantissa. There are also some SSE-based
* assembly routines out there.
*
* See GL_NV_half_float for a reference of the FLOAT16 / GL_HALF format
*/
const unsigned short s = ((*in) & 0x8000);
const unsigned short m = (*in) & 0x3FF;
if(e == 0) {
} else if(e < 31) {
} else {
else return *(float*)(&fNaN); //0.0f / 0.0f; /* NAN */
}
}
{
const unsigned short m = in & 0x7ffff;
if (e == 0)
{
}
else if (e < 15)
{
}
else
{
else return *(float*)(&fNaN); //0.0f / 0.0f; /* NAN */
}
}
/**
* Settings
*/
#define VS_NONE 0
#define PS_NONE 0
#define VBO_NONE 0
#define ORM_BACKBUFFER 0
/* NOTE: When adding fields to this structure, make sure to update the default
* values in wined3d_main.c as well. */
typedef struct wined3d_settings_s {
/* vertex and pixel shader modes */
int vs_mode;
int ps_mode;
/* Ideally, we don't want the user to have to request GLSL. If the hardware supports GLSL,
we should use it. However, until it's fully implemented, we'll leave it as a registry
setting for developers. */
unsigned short pci_vendor_id;
unsigned short pci_device_id;
/* Memory tracking and object counting */
unsigned int emulated_textureram;
char *logo;
int allow_multisampling;
typedef enum _WINED3DSAMPLER_TEXTURE_TYPE
{
WINED3DSTT_UNKNOWN = 0,
typedef enum _WINED3DSHADER_PARAM_REGISTER_TYPE
{
WINED3DSPR_TEMP = 0,
{
};
typedef enum _WINED3DSHADER_PARAM_SRCMOD_TYPE
{
WINED3DSPSM_NONE = 0,
typedef enum _WINED3DSHADER_PARAM_DSTMOD_TYPE
{
WINED3DSPDM_NONE = 0,
/* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
typedef enum COMPARISON_TYPE
{
/* Shader version tokens, and shader end tokens */
/* Shader backends */
/* TODO: Make this dynamic, based on shader limits ? */
/* FIXME: This needs to go up to 2048 for
* Shader model 3 according to msdn (and for software shaders) */
struct wined3d_shader_buffer
{
char *buffer;
unsigned int bsize;
unsigned int lineNo;
};
{
};
enum wined3d_shader_type
{
};
struct wined3d_shader_version
{
};
typedef struct shader_reg_maps
{
/* Whether or not loops are used in this shader, and nesting depth */
unsigned loop_depth;
unsigned highest_render_target;
struct wined3d_shader_context
{
void *backend_data;
};
struct wined3d_shader_register
{
};
struct wined3d_shader_dst_param
{
};
struct wined3d_shader_src_param
{
};
struct wined3d_shader_instruction
{
};
struct wined3d_shader_semantic
{
};
struct wined3d_shader_attribute
{
};
struct wined3d_shader_loop_control
{
unsigned int count;
unsigned int start;
int step;
};
struct wined3d_shader_frontend
{
void (*shader_read_header)(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version);
void (*shader_read_opcode)(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins, UINT *param_size);
void (*shader_read_src_param)(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param,
struct wined3d_shader_src_param *src_rel_addr);
void (*shader_read_dst_param)(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param,
struct wined3d_shader_src_param *dst_rel_addr);
};
struct shader_caps {
float PixelShader1xMaxValue;
};
enum tex_types
{
tex_1d = 0,
};
enum vertexprocessing_mode {
};
#define WINED3D_CONST_NUM_UNUSED ~0U
enum fogmode {
};
struct wined3d_context;
/* Stateblock dependent parameters which have to be hardcoded
* into the shader code
*/
struct ps_compile_args {
/* Projected textures(ps 1.0-1.3) */
/* Texture types(2D, Cube, 3D) in ps 1.x */
/* Bitmap for NP2 texcoord fixups (16 samplers max currently).
D3D9 has a limit of 16 samplers and the fixup is superfluous
in D3D10 (unconditional NP2 support mandatory). */
};
enum fog_src_type {
VS_FOG_Z = 0,
};
struct vs_compile_args {
};
typedef struct {
/* X11 locking */
/* As GLX relies on X, this is needed */
extern int num_lock DECLSPEC_HIDDEN;
#if 0
#define ENTER_GL() ++num_lock; if (num_lock > 1) FIXME("Recursive use of GL lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
#define LEAVE_GL() if (num_lock != 1) FIXME("Recursive use of GL lock: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
#else
#endif
/*****************************************************************************
* Defines
*/
/* GL related defines */
/* ------------------ */
} while(0)
/* DirectX Device Limits */
/* --------------------- */
#define HIGHEST_TRANSFORMSTATE WINED3DTS_WORLDMATRIX(255) /* Highest value in WINED3DTRANSFORMSTATETYPE */
/* Checking of API calls */
/* --------------------- */
#ifndef WINE_NO_DEBUG_MSGS
# ifdef VBOX_WITH_VMSVGA
# define checkGLcall(A) \
do { \
err = glGetError(); \
if (err == GL_NO_ERROR) { \
\
} else { \
ERR(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n", \
} \
} while(0)
# else
# define checkGLcall(A) \
do { \
err = glGetError(); \
if (err == GL_NO_ERROR) { \
\
} else do { \
ERR(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n", \
err = glGetError(); \
} while (err != GL_NO_ERROR); \
} while(0)
# endif
#else
#define checkGLcall(A) do {} while(0)
#endif
/* Trace routines / diagnostics */
/* ---------------------------- */
/* Dump out a matrix and copy it */
do { \
} while (0)
/* Trace vector and strided data information */
/* Advance declaration of structures to satisfy compiler */
/* Global variables */
/*****************************************************************************
* Compilable extra diagnostics
*/
/* TODO: Confirm each of these works when wined3d move completed */
#if 0 /* NOTE: Must be 0 in cvs */
/* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
of each frame, a check is made for the existence of C:\D3DTRACE, and if it exists d3d trace
is enabled, and if it doesn't exist it is disabled. */
# define FRAME_DEBUGGING
/* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
the file is deleted */
# if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
# define SINGLE_FRAME_DEBUGGING
# endif
/* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
It can only be enabled when FRAME_DEBUGGING is also enabled
The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
array is drawn. */
# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
# define SHOW_FRAME_MAKEUP 1
# endif
/* The following, when enabled, lets you see the makeup of the all the textures used during each
of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
The contents of the textures assigned to each stage are written into
# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
# define SHOW_TEXTURE_MAKEUP 0
# endif
extern BOOL isDumpingFrames;
extern LONG primCounter;
#endif
enum wined3d_ffp_idx
{
WINED3D_FFP_POSITION = 0,
};
enum wined3d_ffp_emit_idx
{
};
struct wined3d_stream_info_element
{
};
struct wined3d_stream_info
{
};
/*****************************************************************************
* Prototypes
*/
/* Routine common to the draw primitive and draw indexed primitive routines */
/* Routines and structures related to state management */
#define STATE_RENDER(a) (a)
#define STATE_IS_RENDER(a) ((a) >= STATE_RENDER(1) && (a) <= STATE_RENDER(WINEHIGHEST_RENDER_STATE))
#define STATE_TEXTURESTAGE(stage, num) (STATE_RENDER(WINEHIGHEST_RENDER_STATE) + 1 + (stage) * (WINED3D_HIGHEST_TEXTURE_STATE + 1) + (num))
#define STATE_IS_TEXTURESTAGE(a) ((a) >= STATE_TEXTURESTAGE(0, 1) && (a) <= STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE))
/* + 1 because samplers start with 0 */
#define STATE_SAMPLER(num) (STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE) + 1 + (num))
#define STATE_IS_SAMPLER(num) ((num) >= STATE_SAMPLER(0) && (num) <= STATE_SAMPLER(MAX_COMBINED_SAMPLERS - 1))
#define STATE_IS_TRANSFORM(a) ((a) >= STATE_TRANSFORM(1) && (a) <= STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)))
#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS))
#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(MAX_CLIPPLANES - 1))
enum fogsource {
};
struct wined3d_occlusion_query
{
};
union wined3d_gl_query_object
{
};
struct wined3d_event_query
{
};
{
};
enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
void wined3d_event_query_issue(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
struct wined3d_context
{
/* State dirtification
* dirtyArray is an array that contains markers for dirty states. numDirtyEntries states are dirty, their numbers are in indices
* 0...numDirtyEntries - 1. isStateDirty is a redundant copy of the dirtyArray. Technically only one of them would be needed,
* but with the help of both it is easy to find out if a state is dirty(just check the array index), and for applying dirty states
* only numDirtyEntries array elements have to be checked, not STATE_HIGHEST states.
*/
DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
#ifdef VBOX_WITH_WDDM
#else
#endif
/* Stores some information about the context state for optimization */
#if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
#endif
/* The actual opengl context */
#ifndef VBOX_WITH_WDDM
#endif
#if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
#endif
#ifdef VBOX_WITH_VMSVGA
#endif
int pixel_format;
/* FBOs */
/* Queries */
/* Extension emulation */
};
typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *ctx);
struct StateEntry
{
};
struct StateEntryTemplate
{
};
struct fragment_caps
{
};
struct fragment_pipeline
{
};
/* "Base" state table */
enum blit_operation
{
};
/* Shaders for color conversions in blits */
struct blit_shader
{
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format_desc,
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format_desc);
HRESULT (*color_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect, DWORD fill_color);
};
/* Temporary blit_shader helper functions */
HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
typedef enum ContextUsage {
} ContextUsage;
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
const struct wined3d_format_desc *ds_format_desc
#ifdef VBOX_WITH_WDDM
, struct VBOXUHGSMI *pHgsmi
#endif
struct IWineD3DDeviceImpl *context_get_device(const struct wined3d_context *context); DECLSPEC_HIDDEN;
#ifdef VBOX_WITH_WDDM
struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate) DECLSPEC_HIDDEN;
#endif
void context_surface_update(struct wined3d_context *context, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
#if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
void context_clear_on_thread_detach();
#endif
/* Macros for doing basic GPU detection based on opengl capabilities */
#define WINE_D3D7_CAPABLE(gl_info) (gl_info->supported[ARB_TEXTURE_COMPRESSION] && gl_info->supported[ARB_TEXTURE_CUBE_MAP] && gl_info->supported[ARB_TEXTURE_ENV_DOT3])
#define WINE_D3D8_CAPABLE(gl_info) WINE_D3D7_CAPABLE(gl_info) && (gl_info->supported[ARB_MULTISAMPLE] && gl_info->supported[ARB_TEXTURE_BORDER_CLAMP])
#define WINE_D3D9_CAPABLE(gl_info) WINE_D3D8_CAPABLE(gl_info) && (gl_info->supported[ARB_FRAGMENT_PROGRAM] && gl_info->supported[ARB_VERTEX_SHADER])
#define WINE_D3D10_CAPABLE(gl_info) WINE_D3D9_CAPABLE(gl_info) && (gl_info->supported[EXT_GPU_SHADER4])
/*****************************************************************************
* Internal representation of a light
*/
struct wined3d_light_info
{
/* Converted parms to speed up swapping lights */
float exponent;
float cutoff;
};
/* The default light parameters */
typedef struct WineD3D_PixelFormat
{
int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
int auxBuffers;
int numSamples;
enum wined3d_gl_vendor
{
};
enum wined3d_pci_vendor
{
};
enum wined3d_pci_device
{
};
struct wined3d_fbo_ops
{
};
struct wined3d_gl_limits
{
float pointsize_max;
float pointsize_min;
float shininess;
};
struct wined3d_gl_info
{
/* GL function pointers */
/* WGL function pointers */
};
struct wined3d_driver_info
{
const char *name;
const char *description;
};
/* The adapter structure */
struct wined3d_adapter
{
int nCfgs;
#ifndef VBOX_WITH_WDDM
unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
unsigned int UsedTextureRam;
#endif
};
BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN;
#ifndef VBOX_WITH_WDDM
#endif
struct VBOXVMSVGASHADERIF;
extern BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter, struct VBOXVMSVGASHADERIF *pVBoxShaderIf);
/*****************************************************************************
* High order patch management
*/
struct WineD3DRectPatch
{
float *mem;
};
HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, struct WineD3DRectPatch *patch) DECLSPEC_HIDDEN;
enum projection_types
{
proj_none = 0,
};
enum dst_arg
{
resultreg = 0,
};
/*****************************************************************************
* Fixed function pipeline replacements
*/
struct texture_stage_op
{
};
struct ffp_frag_settings {
/* Use shorts instead of chars to get dword alignment */
unsigned short sRGB_write;
unsigned short emul_clipplanes;
};
struct ffp_frag_desc
{
};
/*****************************************************************************
* IWineD3D implementation structure
*/
typedef struct IWineD3DImpl
{
/* IUnknown fields */
/* WineD3D Information */
} IWineD3DImpl;
#ifndef VBOX_WITH_WDDM
#endif
/*****************************************************************************
* IWineD3DDevice implementation structure
*/
#define WINED3D_UNMAPPED_STAGE ~0U
/* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */
#ifdef VBOX_WINE_WITH_PROFILE
vboxWDbgPrintF _m ; \
} while (0)
typedef struct VBOXWINEPROFILE_ELEMENT
{
typedef struct VBOXWINEPROFILE_HASHMAP_ELEMENT
{
#define VBOXWINEPROFILE_HASHMAP_ELEMENT_FROMENTRY(_p) ((PVBOXWINEPROFILE_HASHMAP_ELEMENT)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXWINEPROFILE_HASHMAP_ELEMENT, MapEntry)))
PRLOG(("%s: t(%u);c(%u)\n", \
(_pn), \
)); \
} while (0)
} while (0)
} while (0)
#define VBOXWINEPROFILE_HASHMAP_ELEMENT_CREATE() ( (PVBOXWINEPROFILE_HASHMAP_ELEMENT)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (VBOXWINEPROFILE_HASHMAP_ELEMENT)) )
} while (0)
DECLINLINE(PVBOXWINEPROFILE_HASHMAP_ELEMENT) vboxWineProfileHashMapElementGet(PVBOXEXT_HASHMAP pMap, void *pvKey)
{
if (pEntry)
{
}
else
{
if (pElement)
return pElement;
}
}
} while (0)
static DECLCALLBACK(bool) vboxWineProfileElementResetCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor)
{
return true;
}
static DECLCALLBACK(bool) vboxWineProfileElementDumpCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor)
{
return true;
}
} while (0)
} while (0)
static DECLCALLBACK(bool) vboxWineProfileElementCleanupCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor)
{
return true;
}
} while (0)
typedef struct VBOXWINEPROFILE_DRAWPRIM
{
(_p)->u64LoadLocationTime = 0; \
(_p)->u64CtxAcquireTime = 0; \
(_p)->u64PostProcess = 0; \
} while (0)
{
}
{
}
VBoxExtHashInit(&(_p)->MapDrawPrimSlowVs, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \
VBoxExtHashInit(&(_p)->MapDrawPrimSlow, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \
VBoxExtHashInit(&(_p)->MapDrawPrimStrided, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \
VBoxExtHashInit(&(_p)->MapDrawPrimFast, vboxWineProfileDrawPrimHashMapHash, vboxWineProfileDrawPrimHashMapEqual); \
} while (0)
} while (0)
#else
#endif
struct IWineD3DDeviceImpl
{
/* IUnknown fields */
/* WineD3D Information */
/* Window styles to restore when switching fullscreen mode */
/* X and GL Information */
/* Selected capabilities */
int vs_selected_mode;
int ps_selected_mode;
void *shader_priv;
void *fragment_priv;
void *blit_priv;
/* Array of functions for states which are handled by more than one pipeline part */
unsigned int max_ffp_textures;
/* State block related */
/* Internal use fields */
#ifndef VBOX_WITH_WDDM
#endif
/* Render Target Support */
/* palettes texture management */
/* For rendering to a texture using glCopyTexImage */
/* Cursor management */
/* The Wine logo surface */
/* Textures for when no other textures are mapped */
/* DirectDraw stuff */
/* Final position fixup constant */
#ifdef VBOX_WITH_VMSVGA
#endif
/* With register combiners we can skip junk texture stages */
/* Stream source management */
unsigned int num_buffer_queries;
/* Context management */
#ifdef VBOX_WITH_WDDM
#endif
#ifdef VBOX_WINE_WITH_SHADER_CACHE
#endif
#ifdef VBOX_WINE_WITH_PROFILE
#endif
/* High level patch management */
};
BOOL device_context_add(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
#ifndef VBOX_WITH_WDDM
#else
#endif
void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resource) DECLSPEC_HIDDEN;
void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, DWORD Count,
const WINED3DRECT *pRects, DWORD Flags, WINED3DCOLOR Color, float Z, DWORD Stencil) DECLSPEC_HIDDEN;
{
}
/* Support for IWineD3DResource ::Set/Get/FreePrivateData. */
typedef struct PrivateData
{
union
{
} ptr;
} PrivateData;
/*****************************************************************************
* IWineD3DResource implementation structure
*/
typedef struct IWineD3DResourceClass
{
/* IUnknown fields */
/* WineD3DResource Information */
#ifdef VBOX_WITH_WDDM
#endif
typedef struct IWineD3DResourceImpl
{
/* IUnknown & WineD3DResource Information */
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
#ifdef VBOX_WITH_WDDM
HRESULT WINAPI IWineD3DResourceImpl_SetShRcState(IWineD3DResource *iface, VBOXWINEEX_SHRC_STATE enmState);
#endif
/* Tests show that the start address of resources is 32 byte aligned */
/*****************************************************************************
* IWineD3DBaseTexture D3D- > openGL state map lookups
*/
typedef enum winetexturestates {
enum WINED3DSRGB
{
};
struct gl_texture
{
};
/*****************************************************************************
* IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DBaseTextureClass
{
#ifdef VBOX_WITH_WDDM
#endif
typedef struct IWineD3DBaseTextureImpl
{
/* IUnknown & WineD3DResource Information */
HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
#ifdef VBOX_WITH_WDDM
} while (0)
#else
} while (0)
#endif
/*****************************************************************************
* IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
/* IWineD3DTexture */
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
/*****************************************************************************
* IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DCubeTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
/* IWineD3DCubeTexture */
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
typedef struct _WINED3DVOLUMET_DESC
{
/*****************************************************************************
* IWineD3DVolume implementation structure (extends IUnknown)
*/
typedef struct IWineD3DVolumeImpl
{
/* IUnknown & WineD3DResource fields */
/* WineD3DVolume Information */
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
/*****************************************************************************
* IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DVolumeTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
/* IWineD3DVolumeTexture */
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
typedef struct _WINED3DSURFACET_DESC
{
/*****************************************************************************
* Structure for DIB Surfaces (GetDC and GDI surfaces)
*/
typedef struct wineD3DSurface_DIB {
void* bitmap_data;
typedef struct {
struct fbo_entry
{
};
/*****************************************************************************
* IWineD3DClipp implementation structure
*/
typedef struct IWineD3DClipperImpl
{
/*****************************************************************************
* IWineD3DSurface implementation structure
*/
struct IWineD3DSurfaceImpl
{
/* IUnknown & IWineD3DResource Information */
/* IWineD3DSurface fields */
/* TODO: move this off into a management class(maybe!) */
/* A method to retrieve the drawable size. Not in the Vtable to make it changeable */
/* PBO */
int lockCount;
/* For GetDC */
/* Color keys for DDraw */
/* DirectDraw clippers */
/* DirectDraw Overlay handling */
#ifdef VBOX_WITH_WDDM
#endif
};
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
/* Predeclare the shared Surface functions */
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid) DECLSPEC_HIDDEN;
DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *pDesc) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD3DPalette **Pal) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface, IWineD3DPalette *Pal) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3DBase *container) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG X, LONG Y) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y) DECLSPEC_HIDDEN;
IWineD3DSurface *DstSurface, const RECT *DstRect, DWORD Flags, const WINEDDOVERLAYFX *FX) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetClipper(IWineD3DSurface *iface, IWineD3DClipper *clipper) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD3DClipper **clipper) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *SrcSurface,
const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT *pLockedRect,
void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
/* Surface flags: */
#define SFLAG_PBO 0x00080000 /* Has a PBO attached for speeding up data transfers for dynamically locked surfaces */
#define SFLAG_NORMCOORD 0x00100000 /* Set if the GL texture coords are normalized(non-texture rectangle) */
#ifdef VBOX_WITH_WDDM
#else
# define SFLAG_DONOTFREE_VBOXWDDM 0
#endif
/* In some conditions the surface memory must not be freed:
* SFLAG_CONVERTED: Converting the data back would take too long
* SFLAG_DIBSECTION: The dib code manages the memory
* SFLAG_LOCKED: The app requires access to the surface data
* SFLAG_DYNLOCK: Avoid freeing the data for performance
* SFLAG_PBO: PBOs don't use 'normal' memory. It is either allocated by the driver or must be NULL.
* SFLAG_CLIENT: OpenGL uses our memory as backup
*/
SFLAG_DIBSECTION | \
SFLAG_LOCKED | \
SFLAG_DYNLOCK | \
SFLAG_USERPTR | \
SFLAG_PBO | \
SFLAG_CLIENT | \
)
SFLAG_INTEXTURE | \
SFLAG_INDRAWABLE | \
typedef enum {
void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
/*****************************************************************************
* IWineD3DVertexDeclaration implementation structure
*/
{
};
typedef struct IWineD3DVertexDeclarationImpl {
/* IUnknown Information */
HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device,
/*****************************************************************************
* IWineD3DStateBlock implementation structure
*/
/* Note: Very long winded but gl Lists are not flexible enough */
/* to resolve everything we need, so doing it manually for now */
typedef struct SAVEDSTATES {
} SAVEDSTATES;
struct StageState {
};
struct IWineD3DStateBlockImpl
{
/* IUnknown fields */
/* IWineD3DStateBlock information */
/* Array indicating whether things have been set or changed */
/* Vertex Shader Declaration */
/* Vertex Shader Constants */
float *vertexShaderConstantF;
/* primitive type */
/* Stream Source */
UINT streamFlags[MAX_STREAMS + 1]; /*0 | WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA */
/* Indices */
/* Transform */
/* Light hashmap . Collisions are handled using standard wine double linked lists */
const struct wined3d_light_info *activeLights[MAX_ACTIVE_LIGHTS]; /* Map of opengl lights to d3d lights */
/* Clipping */
/* ViewPort */
/* Material */
/* Pixel Shader */
/* Pixel Shader Constants */
float *pixelShaderConstantF;
/* RenderState */
/* Texture */
/* Texture State Stage */
/* Sampler States */
/* Scissor test rectangle */
/* Contained state management */
unsigned int num_contained_render_states;
unsigned int num_contained_transform_states;
unsigned int num_contained_vs_consts_i;
unsigned int num_contained_vs_consts_b;
unsigned int num_contained_vs_consts_f;
unsigned int num_contained_ps_consts_i;
unsigned int num_contained_ps_consts_b;
unsigned int num_contained_ps_consts_f;
unsigned int num_contained_tss_states;
unsigned int num_contained_sampler_states;
};
struct wined3d_context *context)
{
}
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
* allows GetData on a created issue, but opengl doesn't
*/
enum query_state {
};
/*****************************************************************************
* IWineD3DQueryImpl implementation structure (extends IUnknown)
*/
typedef struct IWineD3DQueryImpl
{
/* IWineD3DQuery fields */
/* TODO: Think about using a IUnknown instead of a void* */
void *extendedData;
/* IWineD3DBuffer */
/* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
* fixed function semantics as D3DCOLOR or FLOAT16 */
{
};
struct wined3d_map_range
{
};
struct wined3d_buffer
{
/* conversion stuff */
/* Extra load offsets, for FLOAT16 conversion */
};
/* IWineD3DRendertargetView */
struct wined3d_rendertarget_view
{
};
/*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
*/
struct IWineD3DSwapChainImpl
{
/*IUnknown part*/
/* IWineD3DSwapChain fields */
unsigned int vSyncCounter;
#ifndef VBOX_WITH_WDDM
unsigned int num_contexts;
#else
#endif
};
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown **ppParent) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent) DECLSPEC_HIDDEN;
void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) DECLSPEC_HIDDEN;
#define DEFAULT_REFRESH_RATE 0
/*****************************************************************************
* Utility function prototypes
*/
/* Trace routines */
/* Color conversion routines */
/* Routines for GL <-> D3D values */
void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize) DECLSPEC_HIDDEN;
/* Math utils */
void multiply_matrix(WINED3DMATRIX *dest, const WINED3DMATRIX *src1, const WINED3DMATRIX *src2) DECLSPEC_HIDDEN;
void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected) DECLSPEC_HIDDEN;
typedef struct local_constant {
unsigned int idx;
typedef struct SHADER_LIMITS {
unsigned int temporary;
unsigned int texcoord;
unsigned int sampler;
unsigned int constant_int;
unsigned int constant_float;
unsigned int constant_bool;
unsigned int address;
unsigned int packed_output;
unsigned int packed_input;
unsigned int attributes;
unsigned int label;
/* Keeps track of details for TEX_M#x# shader opcodes which need to
* maintain state information between multiple codes */
typedef struct SHADER_PARSE_STATE {
unsigned int current_row;
#ifdef __GNUC__
#else
#endif
/* Base Shader utility functions. */
int shader_addline(struct wined3d_shader_buffer *buffer, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN;
int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *fmt, va_list args) DECLSPEC_HIDDEN;
/* Vertex shader utility functions */
/*****************************************************************************
* IDirect3DBaseShader implementation structure
*/
typedef struct IWineD3DBaseShaderClass
{
void *frontend_data;
void *backend_data;
/* Programs this shader is linked with */
/* Immediate constants (override global ones) */
/* Pointer to the parent device */
#ifdef VBOX_WINE_WITH_SHADER_CACHE
#endif
typedef struct IWineD3DBaseShaderImpl {
/* IUnknown */
/* IWineD3DBaseShader */
unsigned int shader_find_free_input_register(const struct shader_reg_maps *reg_maps, unsigned int max) DECLSPEC_HIDDEN;
{
return type == WINED3D_SHADER_TYPE_PIXEL;
}
{
return type == WINED3D_SHADER_TYPE_VERTEX;
}
{
{
case WINED3DSPR_RASTOUT:
/* oFog & oPts */
/* oPos */
return FALSE;
case WINED3DSPR_DEPTHOUT: /* oDepth */
case WINED3DSPR_CONSTBOOL: /* b# */
case WINED3DSPR_LOOP: /* aL */
#ifndef VBOX_WITH_VMSVGA
case WINED3DSPR_PREDICATE: /* p0 */
return TRUE;
#else
return TRUE;
case WINED3DSPR_PREDICATE: /* p0 */
return FALSE;
#endif
case WINED3DSPR_MISCTYPE:
{
case 0: /* vPos */
return FALSE;
case 1: /* vFace */
return TRUE;
default:
return FALSE;
}
case WINED3DSPR_IMMCONST:
switch(reg->immconst_type)
{
case WINED3D_IMMCONST_FLOAT:
return TRUE;
default:
return FALSE;
}
default:
return FALSE;
}
}
}
return FALSE;
}
/*****************************************************************************
* IDirect3DVertexShader implementation structures
*/
typedef struct IWineD3DVertexShaderImpl {
/* IUnknown parts */
/* IWineD3DBaseShader */
/* Vertex shader attributes. */
struct wined3d_geometryshader
{
};
/*****************************************************************************
* IDirect3DPixelShader implementation structure
*/
/* Using additional shader constants (uniforms in GLSL / program environment
* or local parameters in ARB) is costly:
* ARB only knows float4 parameters and GLSL compiler are not really smart
* when it comes to efficiently pack float2 uniforms, so no space is wasted
* (in fact most compilers map a float2 to a full float4 uniform).
*
* For NP2 texcoord fixup we only need 2 floats (width and height) for each
* 2D texture used in the shader. We therefore pack fixup info for 2 textures
* into a single shader constant (uniform / program parameter).
*
* This structure is shared between the GLSL and the ARB backend.*/
struct ps_np2fixup_info {
};
typedef struct IWineD3DPixelShaderImpl {
/* IUnknown parts */
/* IWineD3DBaseShader */
/* Pixel shader input semantics */
unsigned int declared_in_count;
/* Some information about the shader behavior */
char vpos_uniform;
#ifdef VBOX_WINE_WITH_SHADER_CACHE
IWineD3DVertexShaderImpl * vertexshader_check_cached(IWineD3DDeviceImpl *device, IWineD3DVertexShaderImpl *object) DECLSPEC_HIDDEN;
IWineD3DPixelShaderImpl * pixelshader_check_cached(IWineD3DDeviceImpl *device, IWineD3DPixelShaderImpl *object) DECLSPEC_HIDDEN;
#endif
/* sRGB correction constants */
/*****************************************************************************
* IWineD3DPalette implementation structure
*/
struct IWineD3DPaletteImpl {
/* IUnknown parts */
/* IWineD3DPalette */
/* This is to store the palette in 'screen format' */
};
/* DirectDraw utility functions */
/*****************************************************************************
* Pixel format management
*/
/* WineD3D pixel format flags */
struct wined3d_format_desc
{
unsigned int component_size;
unsigned int Flags;
float heightscale;
};
{
/* Check stateblock->vertexDecl to allow this to be used from
* IWineD3DDeviceImpl_FindTexUnitMap(). This is safe because
* stateblock->vertexShader implies a vertex declaration instead of ddraw
* style strided data. */
return (stateblock->vertexShader
}
{
}
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#ifdef RT_OS_DARWIN
void *MyNSGLGetProcAddress(const char *name);
#endif
/** @def VBOX_CHECK_GL_CALL
* Performs OpenGL call @a a_Expr and check glGetError.
* Errors will be asserted in strict builds and hit the release log in
* non-strict builds.
* @param a_Expr The OpenGL call expression. Always executed!
*/
#ifdef VBOX_WITH_VMSVGA
do { \
GLint rcCheckCall; \
a_Expr; \
rcCheckCall = glGetError(); \
} while (0)
#else
#endif
#endif