wined3d_private.h revision 040b4a09341f574825386333398110f4db3e1e51
/*
* 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
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun 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>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "wined3d_gl.h"
/* 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
/* 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,
CHANNEL_SOURCE_YUV0 = 6,
CHANNEL_SOURCE_YUV1 = 7,
};
enum yuv_fixup
{
YUV_FIXUP_YUY2 = 0,
YUV_FIXUP_UYVY = 1,
YUV_FIXUP_YV12 = 2,
};
#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;
}
{
}
{
}
{
return yuv_fixup;
}
void wined3d_rb_free(void *ptr);
/* 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
/* Used for CreateStateBlock */
#define NUM_SAVEDPIXELSTATES_R 35
#define NUM_SAVEDPIXELSTATES_T 18
#define NUM_SAVEDPIXELSTATES_S 12
#define NUM_SAVEDVERTEXSTATES_R 34
#define NUM_SAVEDVERTEXSTATES_T 2
#define NUM_SAVEDVERTEXSTATES_S 1
typedef enum _WINELOOKUP {
WINELOOKUP_WARPPARAM = 0,
MAX_LOOKUPS = 1
} WINELOOKUP;
extern const int minLookup[MAX_LOOKUPS];
extern const int maxLookup[MAX_LOOKUPS];
struct min_lookup
{
};
extern const struct filter_lookup filter_lookup_nofilter;
extern struct filter_lookup filter_lookup;
/* 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) {
const unsigned short s = ((*in) & 0x8000);
const unsigned short m = (*in) & 0x3FF;
unsigned long fNaN = 0x7fc00000;
unsigned long fNegInf = 0xff800000;
unsigned long fInf = 0x7f800000;
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 NP2_NONE 0
#define NP2_REPACK 1
#define NP2_NATIVE 2
#define ORM_BACKBUFFER 0
#define ORM_PBUFFER 1
#define ORM_FBO 2
#define SHADER_ARB 1
#define SHADER_GLSL 2
#define SHADER_ATI 3
#define SHADER_NONE 4
#define RTL_DISABLE -1
#define RTL_AUTO 0
#define RTL_READDRAW 1
#define RTL_READTEX 2
#define RTL_TEXDRAW 3
#define RTL_TEXTEX 4
/* 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;
int vbo_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;
extern wined3d_settings_t wined3d_settings;
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 _WINED3DVS_RASTOUT_OFFSETS
{
WINED3DSRO_POSITION = 0,
WINED3DSRO_FOG = 1,
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,
typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE
{
WINED3DSIO_NOP = 0,
WINED3DSIO_MOV = 1,
WINED3DSIO_ADD = 2,
WINED3DSIO_SUB = 3,
WINED3DSIO_MAD = 4,
WINED3DSIO_MUL = 5,
WINED3DSIO_RCP = 6,
WINED3DSIO_RSQ = 7,
WINED3DSIO_DP3 = 8,
WINED3DSIO_DP4 = 9,
WINED3DSIO_MIN = 10,
WINED3DSIO_MAX = 11,
WINED3DSIO_SLT = 12,
WINED3DSIO_SGE = 13,
WINED3DSIO_EXP = 14,
WINED3DSIO_LOG = 15,
WINED3DSIO_LIT = 16,
WINED3DSIO_DST = 17,
WINED3DSIO_LRP = 18,
WINED3DSIO_FRC = 19,
WINED3DSIO_M4x4 = 20,
WINED3DSIO_M4x3 = 21,
WINED3DSIO_M3x4 = 22,
WINED3DSIO_M3x3 = 23,
WINED3DSIO_M3x2 = 24,
WINED3DSIO_CALL = 25,
WINED3DSIO_CALLNZ = 26,
WINED3DSIO_LOOP = 27,
WINED3DSIO_RET = 28,
WINED3DSIO_ENDLOOP = 29,
WINED3DSIO_LABEL = 30,
WINED3DSIO_DCL = 31,
WINED3DSIO_POW = 32,
WINED3DSIO_CRS = 33,
WINED3DSIO_SGN = 34,
WINED3DSIO_ABS = 35,
WINED3DSIO_NRM = 36,
WINED3DSIO_SINCOS = 37,
WINED3DSIO_REP = 38,
WINED3DSIO_ENDREP = 39,
WINED3DSIO_IF = 40,
WINED3DSIO_IFC = 41,
WINED3DSIO_ELSE = 42,
WINED3DSIO_ENDIF = 43,
WINED3DSIO_BREAK = 44,
WINED3DSIO_BREAKC = 45,
WINED3DSIO_MOVA = 46,
WINED3DSIO_DEFB = 47,
WINED3DSIO_DEFI = 48,
WINED3DSIO_TEXCOORD = 64,
WINED3DSIO_TEXKILL = 65,
WINED3DSIO_TEX = 66,
WINED3DSIO_TEXBEM = 67,
WINED3DSIO_TEXBEML = 68,
WINED3DSIO_TEXREG2AR = 69,
WINED3DSIO_TEXREG2GB = 70,
WINED3DSIO_TEXM3x2PAD = 71,
WINED3DSIO_TEXM3x2TEX = 72,
WINED3DSIO_TEXM3x3PAD = 73,
WINED3DSIO_TEXM3x3TEX = 74,
WINED3DSIO_TEXM3x3DIFF = 75,
WINED3DSIO_TEXM3x3SPEC = 76,
WINED3DSIO_TEXM3x3VSPEC = 77,
WINED3DSIO_EXPP = 78,
WINED3DSIO_LOGP = 79,
WINED3DSIO_CND = 80,
WINED3DSIO_DEF = 81,
WINED3DSIO_TEXREG2RGB = 82,
WINED3DSIO_TEXDP3TEX = 83,
WINED3DSIO_TEXM3x2DEPTH = 84,
WINED3DSIO_TEXDP3 = 85,
WINED3DSIO_TEXM3x3 = 86,
WINED3DSIO_TEXDEPTH = 87,
WINED3DSIO_CMP = 88,
WINED3DSIO_BEM = 89,
WINED3DSIO_DP2ADD = 90,
WINED3DSIO_DSX = 91,
WINED3DSIO_DSY = 92,
WINED3DSIO_TEXLDD = 93,
WINED3DSIO_SETP = 94,
WINED3DSIO_TEXLDL = 95,
WINED3DSIO_BREAKP = 96,
WINED3DSIO_PHASE = 0xfffd,
WINED3DSIO_COMMENT = 0xfffe,
WINED3DSIO_END = 0Xffff,
/* 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;
unsigned usesnrm : 1;
unsigned vpos : 1;
unsigned usesdsx : 1;
unsigned usesdsy : 1;
unsigned usestexldd : 1;
unsigned usesmova : 1;
unsigned usesfacing : 1;
unsigned usesrelconstF : 1;
unsigned fog : 1;
unsigned usestexldl : 1;
unsigned usesifc : 1;
unsigned usescall : 1;
unsigned padding : 4;
/* 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 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_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);
};
extern const struct wined3d_shader_frontend sm1_shader_frontend;
extern const struct wined3d_shader_frontend sm4_shader_frontend;
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 {
};
/* 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 *);
void (*shader_get_caps)(WINED3DDEVTYPE devtype, const struct wined3d_gl_info *gl_info, struct shader_caps *caps);
extern const shader_backend_t glsl_shader_backend;
extern const shader_backend_t arb_program_shader_backend;
extern const shader_backend_t none_shader_backend;
/* X11 locking */
extern void (* CDECL wine_tsx11_lock_ptr)(void);
extern void (* CDECL wine_tsx11_unlock_ptr)(void);
/* As GLX relies on X, this is needed */
extern int num_lock;
#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 */
/* --------------------- */
See MaxStreams in MSDN under GetDeviceCaps */
#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 (err == GL_NO_ERROR) { \
\
} else do { \
FIXME(">>>>>>>>>>>>>>>>> %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)
/* Macro to dump out the current state of the light chain */
#define DUMP_LIGHT_CHAIN() \
do { \
while (el) { \
TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
} \
} while(0)
/* Trace vector and strided data information */
#define TRACE_STRIDED(si, name) TRACE( #name "=(data:%p, stride:%d, format:%#x, vbo %d, stream %u)\n", \
/* Defines used for optimizations */
/* Only reapply what is necessary */
#define REAPPLY_ALPHAOP 0x0001
#define REAPPLY_ALL 0xFFFF
/* Advance declaration of structures to satisfy compiler */
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DPaletteImpl IWineD3DPaletteImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
/* Global variables */
extern const float identity[16];
/*****************************************************************************
* Compilable extra diagnostics
*/
/* Trace information per-vertex: (extremely high amount of trace) */
#if 0 /* NOTE: Must be 0 in cvs */
#else
# define VTRACE(A)
#endif
/* 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 GlPixelFormatDesc *format_desc;
};
struct wined3d_stream_info
{
};
/*****************************************************************************
* Prototypes
*/
/* Routine common to the draw primitive and draw indexed primitive routines */
extern glAttribFunc specular_func_3ubv;
#define eps 1e-8
/* Routines and structures related to state management */
typedef struct WineD3DContext WineD3DContext;
typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *ctx);
#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_HIGHEST (STATE_FRONTFACE)
struct StateEntry
{
};
struct StateEntryTemplate
{
struct StateEntry content;
};
struct fragment_caps {
};
struct fragment_pipeline {
void (*get_caps)(WINED3DDEVTYPE devtype, const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
const struct StateEntryTemplate *states;
};
extern const struct StateEntryTemplate misc_state_template[];
extern const struct StateEntryTemplate ffp_vertexstate_template[];
extern const struct fragment_pipeline ffp_fragment_pipeline;
extern const struct fragment_pipeline atifs_fragment_pipeline;
extern const struct fragment_pipeline arbfp_fragment_pipeline;
extern const struct fragment_pipeline nvts_fragment_pipeline;
extern const struct fragment_pipeline nvrc_fragment_pipeline;
/* "Base" state table */
/* Shaders for color conversions in blits */
struct blit_shader {
};
extern const struct blit_shader ffp_blit;
extern const struct blit_shader arbfp_blit;
enum fogsource {
};
#define WINED3D_MAX_FBO_ENTRIES 64
/* The new context manager that should deal with onscreen and offscreen rendering */
struct WineD3DContext
{
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 */
/* Stores some information about the context state for optimization */
enum fogsource fog_source;
char *vshader_const_dirty, *pshader_const_dirty;
/* The actual opengl context */
/* FBOs */
struct fbo_entry *current_fbo;
/* Extension emulation */
};
typedef enum ContextUsage {
} ContextUsage;
WineD3DContext *getActiveContext(void);
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms);
void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type);
/* 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])
/* Default callbacks for implicit object destruction */
/*****************************************************************************
* Internal representation of a light
*/
typedef struct PLIGHTINFOEL PLIGHTINFOEL;
struct PLIGHTINFOEL {
/* Converted parms to speed up swapping lights */
float lightPosn[4];
float lightDirn[4];
float exponent;
float cutoff;
};
/* The default light parameters */
extern const WINED3DLIGHT WINED3D_default_light;
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;
/* The adapter structure */
struct WineD3DAdapter
{
struct wined3d_gl_info gl_info;
const char *driver;
const char *description;
int nCfgs;
unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
unsigned int UsedTextureRam;
};
/*****************************************************************************
* High order patch management
*/
struct WineD3DRectPatch
{
float *mem;
float numSegs[4];
char has_normals, has_texcoords;
};
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;
};
extern const struct wine_rb_functions wined3d_ffp_frag_program_rb_functions;
void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype);
const struct ffp_frag_settings *settings);
/*****************************************************************************
* IWineD3D implementation structure
*/
typedef struct IWineD3DImpl
{
/* IUnknown fields */
const IWineD3DVtbl *lpVtbl;
/* WineD3D Information */
} IWineD3DImpl;
extern const IWineD3DVtbl IWineD3D_Vtbl;
/* TODO: setup some flags in the registry to enable, disable pbuffer support
(since it will break quite a few things until contexts are managed properly!) */
extern BOOL pbuffer_support;
/* allocate one pbuffer per surface */
extern BOOL pbuffer_per_surface;
/* A helper function that dumps a resource list */
/*****************************************************************************
* 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 WineD3DAdapter *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, max_ffp_texture_stages;
#define DDRAW_PITCH_ALIGNMENT 8
#define D3D8_PITCH_ALIGNMENT 4
unsigned char surface_alignment; /* Line Alignment of surfaces */
/* State block related */
/* Internal use fields */
unsigned int highest_dirty_ps_const, highest_dirty_vs_const;
/* Render Target Support */
/* Caches to avoid unneeded context changes */
/* palettes texture management */
/* For rendering to a texture using glCopyTexImage */
/* Cursor management */
/* The Wine logo surface */
/* Textures for when no other textures are mapped */
/* Device state management */
/* 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;
/* Context management */
/* High level patch management */
#define PATCHMAP_SIZE 43
struct WineD3DRectPatch *currentPatch;
};
extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, DWORD Count,
}
/* Support for IWineD3DResource ::Set/Get/FreePrivateData. */
typedef struct PrivateData
{
union
{
} ptr;
} PrivateData;
/*****************************************************************************
* IWineD3DResource implementation structure
*/
typedef struct IWineD3DResourceClass
{
/* IUnknown fields */
/* WineD3DResource Information */
const struct GlPixelFormatDesc *format_desc;
struct list privateData;
struct list resource_list_entry;
typedef struct IWineD3DResourceImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DResourceVtbl *lpVtbl;
/* Tests show that the start address of resources is 32 byte aligned */
#define RESOURCE_ALIGNMENT 32
/*****************************************************************************
* 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) */
};
/*****************************************************************************
* IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DBaseTextureClass
{
float pow2Matrix[16];
const struct min_lookup *minMipLookup;
typedef struct IWineD3DBaseTextureImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DBaseTextureVtbl *lpVtbl;
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE filter_type);
}
/*****************************************************************************
* IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
const IWineD3DTextureVtbl *lpVtbl;
/* IWineD3DTexture */
extern const IWineD3DTextureVtbl IWineD3DTexture_Vtbl;
/*****************************************************************************
* IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DCubeTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
const IWineD3DCubeTextureVtbl *lpVtbl;
/* IWineD3DCubeTexture */
extern const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
typedef struct _WINED3DVOLUMET_DESC
{
/*****************************************************************************
* IWineD3DVolume implementation structure (extends IUnknown)
*/
typedef struct IWineD3DVolumeImpl
{
/* IUnknown & WineD3DResource fields */
const IWineD3DVolumeVtbl *lpVtbl;
/* WineD3DVolume Information */
extern const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl;
/*****************************************************************************
* IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
*/
typedef struct IWineD3DVolumeTextureImpl
{
/* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
const IWineD3DVolumeTextureVtbl *lpVtbl;
/* IWineD3DVolumeTexture */
extern const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, UINT depth, UINT levels,
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 */
/* Oversized texture */
/* PBO */
int lockCount;
/* For GetDC */
/* Color keys for DDraw */
struct list renderbuffers;
/* DirectDraw clippers */
/* DirectDraw Overlay handling */
struct list overlay_entry;
};
extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
extern const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl;
UINT surface_calculate_size(const struct GlPixelFormatDesc *format_desc, UINT alignment, UINT width, UINT height);
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
/* Predeclare the shared Surface functions */
HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDevice(IWineD3DSurface *iface, IWineD3DDevice** ppDevice);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetContainer(IWineD3DSurface* iface, REFIID riid, void** ppContainer);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface, DWORD Flags, const WINEDDCOLORKEY *CKey);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3DBase *container);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface, DWORD Flags, IWineD3DSurface *Ref);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetClipper(IWineD3DSurface *iface, IWineD3DClipper *clipper);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD3DClipper **clipper);
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *SrcSurface,
HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags);
/* 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) */
/* In some conditions the surface memory must not be freed:
* SFLAG_OVERSIZE: Not all data can be kept in GL
* 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_OVERSIZE | \
SFLAG_CONVERTED | \
SFLAG_DIBSECTION | \
SFLAG_LOCKED | \
SFLAG_DYNLOCK | \
SFLAG_USERPTR | \
SFLAG_PBO | \
#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 {
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode);
/*****************************************************************************
* IWineD3DVertexDeclaration implementation structure
*/
#define MAX_ATTRIBS 16
{
const struct GlPixelFormatDesc *format_desc;
};
typedef struct IWineD3DVertexDeclarationImpl {
/* IUnknown Information */
const IWineD3DVertexDeclarationVtbl *lpVtbl;
extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
/*****************************************************************************
* 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 */
/* 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;
};
extern void stateblock_savedstates_set(
extern void stateblock_copy(
extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
/* 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;
/*TODO: replace with iface usage */
#if 0
#else
#endif
/* IWineD3DQuery fields */
enum query_state state;
/* TODO: Think about using a IUnknown instead of a void* */
void *extendedData;
extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
extern const IWineD3DQueryVtbl IWineD3DEventQuery_Vtbl;
extern const IWineD3DQueryVtbl IWineD3DOcclusionQuery_Vtbl;
/* Datastructures for IWineD3DQueryImpl.extendedData */
typedef struct WineQueryOcclusionData {
typedef struct WineQueryEventData {
/* 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_buffer
{
const struct IWineD3DBufferVtbl *vtbl;
struct wined3d_buffer_desc desc;
/* conversion stuff */
/* Extra load offsets, for FLOAT16 conversion */
};
extern const IWineD3DBufferVtbl wined3d_buffer_vtbl;
/* IWineD3DRendertargetView */
struct wined3d_rendertarget_view
{
const struct IWineD3DRendertargetViewVtbl *vtbl;
};
extern const IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl;
/*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
*/
typedef struct IWineD3DSwapChainImpl
{
/*IUnknown part*/
const IWineD3DSwapChainVtbl *lpVtbl;
/* IWineD3DSwapChain fields */
unsigned int vSyncCounter;
unsigned int num_contexts;
extern const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, REFIID riid, LPVOID *ppobj);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *pDestSurface);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer, WINED3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, WINED3DRASTER_STATUS *pRasterStatus);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, WINED3DDISPLAYMODE*pMode);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice**ppDevice);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, WINED3DPRESENT_PARAMETERS *pPresentationParameters);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, DWORD Flags, CONST WINED3DGAMMARAMP *pRamp);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, WINED3DGAMMARAMP *pRamp);
/*****************************************************************************
* Utility function prototypes
*/
/* Trace routines */
/* Routines for GL <-> D3D values */
BOOL is_invalid_op(IWineD3DDeviceImpl *This, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst);
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, DWORD coordtype, BOOL ffp_can_disable_proj);
void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height);
BOOL getDepthStencilBits(const struct GlPixelFormatDesc *format_desc, short *depthSize, short *stencilSize);
/* Math utils */
unsigned int count_bits(unsigned int mask);
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. */
/* Vertex shader utility functions */
extern BOOL vshader_get_input(
unsigned int* regnum);
/*****************************************************************************
* IDirect3DBaseShader implementation structure
*/
typedef struct IWineD3DBaseShaderClass
{
const struct wined3d_shader_frontend *frontend;
void *frontend_data;
/* 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 */
const struct wined3d_shader_version *shader_version);
const struct wined3d_shader_version *shader_version);
HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3d_shader_frontend *fe,
struct wined3d_shader_signature_element *output_signature, const DWORD *byte_code, DWORD constf_size);
void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *pFunction);
{
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 */
/* IWineD3DVertexShaderImpl */
/* The GL shader */
void *backend_priv;
/* Vertex shader input and output semantics */
extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
void find_vs_compile_args(IWineD3DVertexShaderImpl *shader, IWineD3DStateBlockImpl *stateblock, struct vs_compile_args *args);
/*****************************************************************************
* 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 */
/* IWineD3DPixelShaderImpl */
/* Pixel shader input semantics */
unsigned int declared_in_count;
/* The GL shader */
void *backend_priv;
/* Some information about the shader behavior */
char vpos_uniform;
extern const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;
void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseTexture * const *textures);
void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImpl *stateblock, struct ps_compile_args *args);
/* 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];
};
extern const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl;
/* 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
struct GlPixelFormatDesc
{
enum wined3d_ffp_emit_idx emit_idx;
unsigned int component_size;
unsigned int Flags;
float heightscale;
struct color_fixup_desc color_fixup;
};
const struct GlPixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt, const struct wined3d_gl_info *gl_info);
{
return (stateblock->vertexShader
}
{
return (stateblock->pixelShader
}
IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip);
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
#endif