wined3d_private.h revision 30438b06a7a54cb1e30907e480fc66561bd7ea4b
/*
* 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_WDDM
# include "vboxsharedrc.h"
#endif
#if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
# define VBoxTlsRefAssertImpl Assert
# include <VBox/VBoxVideo3D.h>
#endif
/* Driver quirks */
#define WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT 0x00000001
#define WINED3D_QUIRK_SET_TEXCOORD_W 0x00000002
#define WINED3D_QUIRK_GLSL_CLIP_VARYING 0x00000004
#define WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA 0x00000008
#define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010
#define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
#define WINED3D_QUIRK_FULLSIZE_BLIT 0x00000040
/* Texture format fixups */
enum fixup_channel_source
{
CHANNEL_SOURCE_ZERO = 0,
CHANNEL_SOURCE_ONE = 1,
CHANNEL_SOURCE_X = 2,
CHANNEL_SOURCE_Y = 3,
CHANNEL_SOURCE_Z = 4,
CHANNEL_SOURCE_W = 5,
};
enum complex_fixup
{
COMPLEX_FIXUP_NONE = 0,
COMPLEX_FIXUP_YUY2 = 1,
COMPLEX_FIXUP_UYVY = 2,
COMPLEX_FIXUP_YV12 = 3,
COMPLEX_FIXUP_P8 = 4,
};
#include <pshpack2.h>
struct color_fixup_desc
{
unsigned x_sign_fixup : 1;
unsigned x_source : 3;
unsigned y_sign_fixup : 1;
unsigned y_source : 3;
unsigned z_sign_fixup : 1;
unsigned z_source : 3;
unsigned w_sign_fixup : 1;
unsigned w_source : 3;
};
#include <poppack.h>
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY =
static inline struct color_fixup_desc create_color_fixup_desc(
{
struct color_fixup_desc fixup =
{
};
return fixup;
}
{
struct color_fixup_desc fixup =
{
};
return fixup;
}
{
}
{
}
{
enum complex_fixup complex_fixup = 0;
return complex_fixup;
}
/* Device caps */
#define MAX_PALETTES 65536
#define MAX_STREAMS 16
#define MAX_TEXTURES 8
#define MAX_FRAGMENT_SAMPLERS 16
#define MAX_VERTEX_SAMPLERS 4
#define MAX_ACTIVE_LIGHTS 8
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
*/
static inline float float_16_to_32(const unsigned short *in) {
unsigned long fNaN = 0x7fc00000;
unsigned long fNegInf = 0xff800000;
unsigned long fInf = 0x7f800000;
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;
unsigned long fNaN = 0x7fc00000;
unsigned long fNegInf = 0xff800000;
unsigned long fInf = 0x7f800000;
if (e == 0)
{
}
else if (e < 15)
{
}
else
{
else return *(float*)(&fNaN); //0.0f / 0.0f; /* NAN */
}
}
/**
* Settings
*/
#define VS_NONE 0
#define VS_HW 1
#define PS_NONE 0
#define PS_HW 1
#define VBO_NONE 0
#define VBO_HW 1
#define ORM_BACKBUFFER 0
#define ORM_FBO 1
#define SHADER_ARB 1
#define SHADER_GLSL 2
#define SHADER_ATI 3
#define SHADER_NONE 4
#define RTL_DISABLE -1
#define RTL_READDRAW 1
#define RTL_READTEX 2
/* 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,
WINED3DSTT_1D = 1,
WINED3DSTT_2D = 2,
WINED3DSTT_CUBE = 3,
WINED3DSTT_VOLUME = 4,
typedef enum _WINED3DSHADER_PARAM_REGISTER_TYPE
{
WINED3DSPR_TEMP = 0,
WINED3DSPR_INPUT = 1,
WINED3DSPR_CONST = 2,
WINED3DSPR_ADDR = 3,
WINED3DSPR_TEXTURE = 3,
WINED3DSPR_RASTOUT = 4,
WINED3DSPR_ATTROUT = 5,
WINED3DSPR_TEXCRDOUT = 6,
WINED3DSPR_OUTPUT = 6,
WINED3DSPR_CONSTINT = 7,
WINED3DSPR_COLOROUT = 8,
WINED3DSPR_DEPTHOUT = 9,
WINED3DSPR_SAMPLER = 10,
WINED3DSPR_CONST2 = 11,
WINED3DSPR_CONST3 = 12,
WINED3DSPR_CONST4 = 13,
WINED3DSPR_CONSTBOOL = 14,
WINED3DSPR_LOOP = 15,
WINED3DSPR_TEMPFLOAT16 = 16,
WINED3DSPR_MISCTYPE = 17,
WINED3DSPR_LABEL = 18,
WINED3DSPR_PREDICATE = 19,
{
};
typedef enum _WINED3DSHADER_PARAM_SRCMOD_TYPE
{
WINED3DSPSM_NONE = 0,
WINED3DSPSM_NEG = 1,
WINED3DSPSM_BIAS = 2,
WINED3DSPSM_BIASNEG = 3,
WINED3DSPSM_SIGN = 4,
WINED3DSPSM_SIGNNEG = 5,
WINED3DSPSM_COMP = 6,
WINED3DSPSM_X2 = 7,
WINED3DSPSM_X2NEG = 8,
WINED3DSPSM_DZ = 9,
WINED3DSPSM_DW = 10,
WINED3DSPSM_ABS = 11,
WINED3DSPSM_ABSNEG = 12,
WINED3DSPSM_NOT = 13,
typedef enum _WINED3DSHADER_PARAM_DSTMOD_TYPE
{
WINED3DSPDM_NONE = 0,
WINED3DSPDM_SATURATE = 1,
/* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
#define WINED3DSI_TEXLD_PROJECT 1
#define WINED3DSI_TEXLD_BIAS 2
typedef enum COMPARISON_TYPE
{
COMPARISON_GT = 1,
COMPARISON_EQ = 2,
COMPARISON_GE = 3,
COMPARISON_LT = 4,
COMPARISON_NE = 5,
COMPARISON_LE = 6,
#define WINED3D_SM1_VS 0xfffe
#define WINED3D_SM1_PS 0xffff
#define WINED3D_SM4_PS 0x0000
#define WINED3D_SM4_VS 0x0001
#define WINED3D_SM4_GS 0x0002
/* Shader version tokens, and shader end tokens */
/* Shader backends */
/* TODO: Make this dynamic, based on shader limits ? */
#define MAX_ATTRIBS 16
#define MAX_REG_ADDR 1
#define MAX_REG_TEMP 32
#define MAX_REG_TEXCRD 8
#define MAX_REG_INPUT 12
#define MAX_REG_OUTPUT 12
#define MAX_CONST_I 16
#define MAX_CONST_B 16
/* FIXME: This needs to go up to 2048 for
* Shader model 3 according to msdn (and for software shaders) */
#define MAX_LABELS 16
#define SHADER_PGMSIZE 65535
struct wined3d_shader_buffer
{
char *buffer;
unsigned int bsize;
unsigned int lineNo;
};
{
};
enum wined3d_shader_type
{
};
struct wined3d_shader_version
{
enum wined3d_shader_type type;
};
typedef struct shader_reg_maps
{
struct wined3d_shader_version shader_version;
/* Whether or not loops are used in this shader, and nesting depth */
unsigned loop_depth;
unsigned highest_render_target;
struct wined3d_shader_context
{
const struct wined3d_gl_info *gl_info;
const struct shader_reg_maps *reg_maps;
struct wined3d_shader_buffer *buffer;
void *backend_data;
};
struct wined3d_shader_register
{
const struct wined3d_shader_src_param *rel_addr;
};
struct wined3d_shader_dst_param
{
struct wined3d_shader_register reg;
};
struct wined3d_shader_src_param
{
struct wined3d_shader_register reg;
};
struct wined3d_shader_instruction
{
const struct wined3d_shader_context *ctx;
const struct wined3d_shader_dst_param *dst;
const struct wined3d_shader_src_param *src;
};
struct wined3d_shader_semantic
{
struct wined3d_shader_dst_param reg;
};
struct wined3d_shader_attribute
{
};
struct wined3d_shader_loop_control
{
unsigned int count;
unsigned int start;
int step;
};
struct wined3d_shader_frontend
{
void (*shader_free)(void *data);
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);
};
typedef void (*SHADER_HANDLER)(const struct wined3d_shader_instruction *);
struct shader_caps {
float PixelShader1xMaxValue;
};
enum tex_types
{
tex_1d = 0,
tex_2d = 1,
tex_3d = 2,
tex_cube = 3,
tex_rect = 4,
tex_type_count = 5,
};
enum vertexprocessing_mode {
};
#define WINED3D_CONST_NUM_UNUSED ~0U
enum fogmode {
};
struct wined3d_context;
#define WINED3D_PSARGS_TEXTRANSFORM_SHIFT 4
#define WINED3D_PSARGS_TEXTRANSFORM_MASK 0xF
/* Stateblock dependent parameters which have to be hardcoded
* into the shader code
*/
struct ps_compile_args {
enum vertexprocessing_mode vp_mode;
/* 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,
VS_FOG_COORD = 1
};
struct vs_compile_args {
};
typedef struct {
void (*shader_handle_instruction)(const struct wined3d_shader_instruction *);
/* 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
#define ENTER_GL() wine_tsx11_lock_ptr()
#define LEAVE_GL() wine_tsx11_unlock_ptr()
#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
#define checkGLcall(A) \
do { \
err = glGetError(); \
if (!pwglGetCurrentContext()) \
{ \
ERR(">>>>>>>>>>>>>>>>> NULL ctx issuing %s @ %s / %d\n", \
break; \
} \
if (err == GL_NO_ERROR) { \
\
} else do { \
ERR(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n", \
err = glGetError(); \
} while (err != GL_NO_ERROR); \
} while(0)
#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 */
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DPaletteImpl IWineD3DPaletteImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl;
/* 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,
WINED3D_FFP_NORMAL = 3,
WINED3D_FFP_PSIZE = 4,
WINED3D_FFP_DIFFUSE = 5,
WINED3D_FFP_SPECULAR = 6,
WINED3D_FFP_TEXCOORD3 = 10,
WINED3D_FFP_TEXCOORD4 = 11,
WINED3D_FFP_TEXCOORD5 = 12,
WINED3D_FFP_TEXCOORD6 = 13,
WINED3D_FFP_TEXCOORD7 = 14,
};
enum wined3d_ffp_emit_idx
{
WINED3D_FFP_EMIT_SHORT4N = 10,
WINED3D_FFP_EMIT_UDEC3 = 13,
WINED3D_FFP_EMIT_DEC3N = 14,
};
struct wined3d_stream_info_element
{
const struct wined3d_format_desc *format_desc;
};
struct wined3d_stream_info
{
};
/*****************************************************************************
* Prototypes
*/
/* Routine common to the draw primitive and draw indexed primitive routines */
#define eps 1e-8
/* 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_PIXELSHADER(a) ((a) == STATE_PIXELSHADER)
#define STATE_TRANSFORM(a) (STATE_PIXELSHADER + (a))
#define STATE_IS_TRANSFORM(a) ((a) >= STATE_TRANSFORM(1) && (a) <= STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)))
#define STATE_IS_STREAMSRC(a) ((a) == STATE_STREAMSRC)
#define STATE_IS_INDEXBUFFER(a) ((a) == STATE_INDEXBUFFER)
#define STATE_IS_VDECL(a) ((a) == STATE_VDECL)
#define STATE_IS_VSHADER(a) ((a) == STATE_VSHADER)
#define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT)
#define STATE_IS_VERTEXSHADERCONSTANT(a) ((a) == STATE_VERTEXSHADERCONSTANT)
#define STATE_IS_PIXELSHADERCONSTANT(a) ((a) == STATE_PIXELSHADERCONSTANT)
#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS))
#define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(MAX_CLIPPLANES - 1))
#define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL)
#define STATE_IS_FRONTFACE(a) ((a) == STATE_FRONTFACE)
#define STATE_HIGHEST (STATE_FRONTFACE)
enum fogsource {
};
#define WINED3D_MAX_FBO_ENTRIES 64
struct wined3d_occlusion_query
{
struct wined3d_context *context;
};
union wined3d_gl_query_object
{
};
struct wined3d_event_query
{
union wined3d_gl_query_object object;
struct wined3d_context *context;
};
{
};
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
{
const struct wined3d_gl_info *gl_info;
/* 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
enum fogsource fog_source;
char *vshader_const_dirty, *pshader_const_dirty;
/* The actual opengl context */
#ifndef VBOX_WITH_WDDM
#endif
#if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
#endif
int pixel_format;
/* FBOs */
struct list fbo_destroy_list;
struct fbo_entry *current_fbo;
/* Queries */
struct list occlusion_queries;
struct list event_queries;
/* Extension emulation */
};
typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *ctx);
struct StateEntry
{
};
struct StateEntryTemplate
{
struct StateEntry content;
};
struct fragment_caps
{
};
struct fragment_pipeline
{
const struct StateEntryTemplate *states;
};
/* "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,
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 lightPosn[4];
float lightDirn[4];
float exponent;
float cutoff;
};
/* The default light parameters */
typedef struct WineD3D_PixelFormat
{
int iPixelFormat; /* WGL pixel format */
int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
int depthSize, stencilSize;
int auxBuffers;
int numSamples;
enum wined3d_gl_vendor
{
};
enum wined3d_pci_vendor
{
HW_VENDOR_SOFTWARE = 0x0000,
HW_VENDOR_ATI = 0x1002,
HW_VENDOR_NVIDIA = 0x10de,
HW_VENDOR_INTEL = 0x8086,
};
enum wined3d_pci_device
{
CARD_WINE = 0x0000,
CARD_ATI_RAGE_128PRO = 0x5246,
CARD_ATI_RADEON_7200 = 0x5144,
CARD_ATI_RADEON_8500 = 0x514c,
CARD_ATI_RADEON_9500 = 0x4144,
CARD_ATI_RADEON_XPRESS_200M = 0x5955,
CARD_ATI_RADEON_X700 = 0x5e4c,
CARD_ATI_RADEON_X1600 = 0x71c2,
CARD_ATI_RADEON_HD2350 = 0x94c7,
CARD_ATI_RADEON_HD2600 = 0x9581,
CARD_ATI_RADEON_HD2900 = 0x9400,
CARD_ATI_RADEON_HD3200 = 0x9620,
CARD_ATI_RADEON_HD4350 = 0x954f,
CARD_ATI_RADEON_HD4550 = 0x9540,
CARD_ATI_RADEON_HD4600 = 0x9495,
CARD_ATI_RADEON_HD4650 = 0x9498,
CARD_ATI_RADEON_HD4670 = 0x9490,
CARD_ATI_RADEON_HD4700 = 0x944e,
CARD_ATI_RADEON_HD4770 = 0x94b3,
CARD_ATI_RADEON_HD4830 = 0x944c,
CARD_ATI_RADEON_HD4850 = 0x9442,
CARD_ATI_RADEON_HD4870 = 0x9440,
CARD_ATI_RADEON_HD4890 = 0x9460,
CARD_ATI_RADEON_HD5750 = 0x68BE,
CARD_ATI_RADEON_HD5770 = 0x68B8,
CARD_ATI_RADEON_HD5850 = 0x6898,
CARD_ATI_RADEON_HD5870 = 0x6899,
CARD_NVIDIA_RIVA_128 = 0x0018,
CARD_NVIDIA_RIVA_TNT = 0x0020,
CARD_NVIDIA_RIVA_TNT2 = 0x0028,
CARD_NVIDIA_GEFORCE = 0x0100,
CARD_NVIDIA_GEFORCE2_MX = 0x0110,
CARD_NVIDIA_GEFORCE2 = 0x0150,
CARD_NVIDIA_GEFORCE3 = 0x0200,
CARD_NVIDIA_GEFORCE4_MX = 0x0170,
CARD_NVIDIA_GEFORCE4_TI4200 = 0x0253,
CARD_NVIDIA_GEFORCEFX_5200 = 0x0320,
CARD_NVIDIA_GEFORCEFX_5600 = 0x0312,
CARD_NVIDIA_GEFORCEFX_5800 = 0x0302,
CARD_NVIDIA_GEFORCE_6200 = 0x014f,
CARD_NVIDIA_GEFORCE_6600GT = 0x0140,
CARD_NVIDIA_GEFORCE_6800 = 0x0041,
CARD_NVIDIA_GEFORCE_7400 = 0x01d8,
CARD_NVIDIA_GEFORCE_7600 = 0x0391,
CARD_NVIDIA_GEFORCE_7800GT = 0x0092,
CARD_NVIDIA_GEFORCE_8100 = 0x084F,
CARD_NVIDIA_GEFORCE_8300GS = 0x0423,
CARD_NVIDIA_GEFORCE_8400GS = 0x0404,
CARD_NVIDIA_GEFORCE_8500GT = 0x0421,
CARD_NVIDIA_GEFORCE_8600GT = 0x0402,
CARD_NVIDIA_GEFORCE_8600MGT = 0x0407,
CARD_NVIDIA_GEFORCE_8800GTS = 0x0193,
CARD_NVIDIA_GEFORCE_9200 = 0x086d,
CARD_NVIDIA_GEFORCE_9400GT = 0x042c,
CARD_NVIDIA_GEFORCE_9500GT = 0x0640,
CARD_NVIDIA_GEFORCE_9600GT = 0x0622,
CARD_NVIDIA_GEFORCE_9800GT = 0x0614,
CARD_NVIDIA_GEFORCE_GTX260 = 0x05e2,
CARD_NVIDIA_GEFORCE_GTX275 = 0x05e6,
CARD_NVIDIA_GEFORCE_GTX280 = 0x05e1,
CARD_NVIDIA_GEFORCE_GT240 = 0x0ca3,
CARD_INTEL_845G = 0x2562,
CARD_INTEL_I830G = 0x3577,
CARD_INTEL_I855G = 0x3582,
CARD_INTEL_I865G = 0x2572,
CARD_INTEL_I915G = 0x2582,
CARD_INTEL_I915GM = 0x2592,
};
struct wined3d_fbo_ops
{
};
struct wined3d_gl_limits
{
float pointsize_max;
float pointsize_min;
float shininess;
};
struct wined3d_gl_info
{
struct wined3d_gl_limits limits;
struct wined3d_fbo_ops fbo_ops;
/* GL function pointers */
/* WGL function pointers */
struct wined3d_format_desc *gl_formats;
};
struct wined3d_driver_info
{
enum wined3d_pci_vendor vendor;
enum wined3d_pci_device device;
const char *name;
const char *description;
};
/* The adapter structure */
struct wined3d_adapter
{
struct wined3d_gl_info gl_info;
struct wined3d_driver_info driver_info;
int nCfgs;
unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
unsigned int UsedTextureRam;
const struct fragment_pipeline *fragment_pipe;
const shader_backend_t *shader_backend;
const struct blit_shader *blitter;
};
BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN;
/*****************************************************************************
* High order patch management
*/
struct WineD3DRectPatch
{
float *mem;
float numSegs[4];
char has_normals, has_texcoords;
};
HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, struct WineD3DRectPatch *patch) DECLSPEC_HIDDEN;
enum projection_types
{
proj_none = 0,
proj_count3 = 1,
proj_count4 = 2
};
enum dst_arg
{
resultreg = 0,
tempreg = 1
};
/*****************************************************************************
* Fixed function pipeline replacements
*/
#define ARG_UNUSED 0xff
struct texture_stage_op
{
unsigned cop : 8;
unsigned carg1 : 8;
unsigned carg2 : 8;
unsigned carg0 : 8;
unsigned aop : 8;
unsigned aarg1 : 8;
unsigned aarg2 : 8;
unsigned aarg0 : 8;
struct color_fixup_desc color_fixup;
unsigned tex_type : 3;
unsigned dst : 1;
unsigned projected : 2;
unsigned padding : 10;
};
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
{
struct wine_rb_entry entry;
struct ffp_frag_settings settings;
};
/*****************************************************************************
* IWineD3D implementation structure
*/
typedef struct IWineD3DImpl
{
/* IUnknown fields */
const IWineD3DVtbl *lpVtbl;
/* 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 */
#define WINED3DCREATE_MULTITHREADED 0x00000004
struct IWineD3DDeviceImpl
{
/* IUnknown fields */
const IWineD3DDeviceVtbl *lpVtbl;
/* WineD3D Information */
struct wined3d_adapter *adapter;
/* Window styles to restore when switching fullscreen mode */
/* X and GL Information */
/* Selected capabilities */
int vs_selected_mode;
int ps_selected_mode;
const shader_backend_t *shader_backend;
void *shader_priv;
void *fragment_priv;
void *blit_priv;
/* Array of functions for states which are handled by more than one pipeline part */
const struct fragment_pipeline *frag_pipe;
const struct blit_shader *blitter;
unsigned int max_ffp_textures;
#define DDRAW_PITCH_ALIGNMENT 8
#define D3D8_PITCH_ALIGNMENT 4
unsigned char surface_alignment; /* Line Alignment of surfaces */
/* State block related */
/* Internal use fields */
#ifndef VBOX_WITH_WDDM
#endif
unsigned int highest_dirty_ps_const, highest_dirty_vs_const;
/* 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 */
float posFixup[4];
/* With register combiners we can skip junk texture stages */
/* Stream source management */
struct wined3d_stream_info strided_streams;
unsigned int num_buffer_queries;
/* Context management */
struct wined3d_context **contexts;
/* High level patch management */
#define PATCHMAP_SIZE 43
struct WineD3DRectPatch *currentPatch;
};
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
#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 */
const struct wined3d_format_desc *format_desc;
#ifdef VBOX_WITH_WDDM
#endif
struct list privateData;
struct list resource_list_entry;
const struct wined3d_parent_ops *parent_ops;
typedef struct IWineD3DResourceImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DResourceVtbl *lpVtbl;
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
#ifdef VBOX_WITH_WDDM
#endif
/* Tests show that the start address of resources is 32 byte aligned */
#define RESOURCE_ALIGNMENT 16
/*****************************************************************************
* IWineD3DBaseTexture D3D- > openGL state map lookups
*/
typedef enum winetexturestates {
WINED3DTEXSTA_DMAPOFFSET = 11,
MAX_WINETEXTURESTATES = 13,
enum WINED3DSRGB
{
SRGB_ANY = 0, /* Uses the cached value(e.g. external calls) */
};
struct gl_texture
{
};
/*****************************************************************************
* IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DBaseTextureClass
{
float pow2Matrix[16];
const struct min_lookup *minMipLookup;
#ifdef VBOX_WITH_WDDM
#endif
typedef struct IWineD3DBaseTextureImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DBaseTextureVtbl *lpVtbl;
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
/*****************************************************************************
* IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
const IWineD3DTextureVtbl *lpVtbl;
/* IWineD3DTexture */
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
/*****************************************************************************
* IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DCubeTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
const IWineD3DCubeTextureVtbl *lpVtbl;
/* IWineD3DCubeTexture */
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
typedef struct _WINED3DVOLUMET_DESC
{
/*****************************************************************************
* IWineD3DVolume implementation structure (extends IUnknown)
*/
typedef struct IWineD3DVolumeImpl
{
/* IUnknown & WineD3DResource fields */
const IWineD3DVolumeVtbl *lpVtbl;
/* WineD3DVolume Information */
/*****************************************************************************
* IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DVolumeTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
const IWineD3DVolumeTextureVtbl *lpVtbl;
/* IWineD3DVolumeTexture */
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
{
const IWineD3DClipperVtbl *lpVtbl;
/*****************************************************************************
* IWineD3DSurface implementation structure
*/
struct IWineD3DSurfaceImpl
{
/* IUnknown & IWineD3DResource Information */
const IWineD3DSurfaceVtbl *lpVtbl;
/* 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 */
struct list renderbuffers;
/* DirectDraw clippers */
/* DirectDraw Overlay handling */
struct list overlay_entry;
#ifdef VBOX_WITH_WDDM
struct IWineD3DSwapChain *presentSwapchain;
#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
# define SFLAG_DONOTFREE_VBOXWDDM SFLAG_CLIENTMEM
#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
*/
#define SFLAG_DONOTFREE (SFLAG_CONVERTED | \
SFLAG_DIBSECTION | \
SFLAG_LOCKED | \
SFLAG_DYNLOCK | \
SFLAG_USERPTR | \
SFLAG_PBO | \
SFLAG_CLIENT | \
)
#define SFLAG_LOCATIONS (SFLAG_INSYSMEM | \
SFLAG_INTEXTURE | \
SFLAG_INDRAWABLE | \
#define SFLAG_DS_LOCATIONS (SFLAG_DS_ONSCREEN | \
#define SFLAG_DS_DISCARDED SFLAG_DS_LOCATIONS
typedef enum {
void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
/*****************************************************************************
* IWineD3DVertexDeclaration implementation structure
*/
{
const struct wined3d_format_desc *format_desc;
};
typedef struct IWineD3DVertexDeclarationImpl {
/* IUnknown Information */
const IWineD3DVertexDeclarationVtbl *lpVtbl;
const struct wined3d_parent_ops *parent_ops;
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 */
const IWineD3DStateBlockVtbl *lpVtbl;
/* 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
{
const IWineD3DQueryVtbl *lpVtbl;
/* IWineD3DQuery fields */
enum query_state state;
/* 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 */
{
CONV_FLOAT16_2, /* Also handles FLOAT16_4 */
};
struct wined3d_map_range
{
};
struct wined3d_buffer
{
const struct IWineD3DBufferVtbl *vtbl;
struct wined3d_buffer_desc desc;
struct wined3d_map_range *maps;
struct wined3d_event_query *query;
/* conversion stuff */
/* Extra load offsets, for FLOAT16 conversion */
};
/* IWineD3DRendertargetView */
struct wined3d_rendertarget_view
{
const struct IWineD3DRendertargetViewVtbl *vtbl;
};
/*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
*/
struct IWineD3DSwapChainImpl
{
/*IUnknown part*/
const IWineD3DSwapChainVtbl *lpVtbl;
/* IWineD3DSwapChain fields */
const struct wined3d_format_desc *ds_format;
unsigned int vSyncCounter;
#ifndef VBOX_WITH_WDDM
struct wined3d_context **context;
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
{
const struct wined3d_shader_frontend *frontend;
void *frontend_data;
void *backend_data;
const struct wined3d_parent_ops *parent_ops;
/* Programs this shader is linked with */
struct list linked_programs;
/* Immediate constants (override global ones) */
struct list constantsB;
struct list constantsF;
struct list constantsI;
/* Pointer to the parent device */
struct list shader_list_entry;
typedef struct IWineD3DBaseShaderImpl {
/* IUnknown */
const IWineD3DBaseShaderVtbl *lpVtbl;
/* 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 */
case WINED3DSPR_PREDICATE: /* p0 */
return TRUE;
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 */
const IWineD3DVertexShaderVtbl *lpVtbl;
/* IWineD3DBaseShader */
/* Vertex shader attributes. */
struct wined3d_geometryshader
{
const struct IWineD3DGeometryShaderVtbl *vtbl;
};
/*****************************************************************************
* 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 */
const IWineD3DPixelShaderVtbl *lpVtbl;
/* IWineD3DBaseShader */
/* Pixel shader input semantics */
unsigned int declared_in_count;
/* Some information about the shader behavior */
char vpos_uniform;
/* sRGB correction constants */
static const float srgb_cmp = 0.0031308f;
static const float srgb_mul_low = 12.92f;
static const float srgb_pow = 0.41666f;
static const float srgb_mul_high = 1.055f;
static const float srgb_sub_high = 0.055f;
/*****************************************************************************
* IWineD3DPalette implementation structure
*/
struct IWineD3DPaletteImpl {
/* IUnknown parts */
const IWineD3DPaletteVtbl *lpVtbl;
/* IWineD3DPalette */
/* This is to store the palette in 'screen format' */
int screen_palents[256];
};
/* DirectDraw utility functions */
/*****************************************************************************
* Pixel format management
*/
/* WineD3D pixel format flags */
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x1
#define WINED3DFMT_FLAG_FILTERING 0x2
#define WINED3DFMT_FLAG_DEPTH 0x4
#define WINED3DFMT_FLAG_STENCIL 0x8
#define WINED3DFMT_FLAG_RENDERTARGET 0x10
#define WINED3DFMT_FLAG_FOURCC 0x20
#define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x40
#define WINED3DFMT_FLAG_COMPRESSED 0x80
#define WINED3DFMT_FLAG_GETDC 0x100
#define WINED3DFMT_FLAG_FLOAT 0x200
struct wined3d_format_desc
{
enum wined3d_ffp_emit_idx emit_idx;
unsigned int component_size;
unsigned int Flags;
float heightscale;
struct color_fixup_desc color_fixup;
};
{
/* 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 */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
#endif