ReactOS  0.4.14-dev-57-g333b8f1
stateblock.c File Reference
#include "config.h"
#include "wine/port.h"
#include "wined3d_private.h"
Include dependency graph for stateblock.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d)
 
static void stateblock_set_bits (DWORD *map, UINT map_size)
 
static void stateblock_savedstates_set_all (struct wined3d_saved_states *states, DWORD vs_consts, DWORD ps_consts)
 
static void stateblock_savedstates_set_pixel (struct wined3d_saved_states *states, const DWORD num_constants)
 
static void stateblock_savedstates_set_vertex (struct wined3d_saved_states *states, const DWORD num_constants)
 
void stateblock_init_contained_states (struct wined3d_stateblock *stateblock)
 
static void stateblock_init_lights (struct wined3d_stateblock *stateblock, struct list *light_map)
 
ULONG CDECL wined3d_stateblock_incref (struct wined3d_stateblock *stateblock)
 
void state_unbind_resources (struct wined3d_state *state)
 
void state_cleanup (struct wined3d_state *state)
 
ULONG CDECL wined3d_stateblock_decref (struct wined3d_stateblock *stateblock)
 
struct wined3d_light_infowined3d_state_get_light (const struct wined3d_state *state, unsigned int idx)
 
void wined3d_state_enable_light (struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, struct wined3d_light_info *light_info, BOOL enable)
 
static void wined3d_state_record_lights (struct wined3d_state *dst_state, const struct wined3d_state *src_state)
 
void CDECL wined3d_stateblock_capture (struct wined3d_stateblock *stateblock)
 
static void apply_lights (struct wined3d_device *device, const struct wined3d_state *state)
 
void CDECL wined3d_stateblock_apply (const struct wined3d_stateblock *stateblock)
 
static void state_init_default (struct wined3d_state *state, const struct wined3d_gl_info *gl_info)
 
void state_init (struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags)
 
static HRESULT stateblock_init (struct wined3d_stateblock *stateblock, struct wined3d_device *device, enum wined3d_stateblock_type type)
 
HRESULT CDECL wined3d_stateblock_create (struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
 

Variables

static const DWORD pixel_states_render []
 
static const DWORD pixel_states_texture []
 
static const DWORD pixel_states_sampler []
 
static const DWORD vertex_states_render []
 
static const DWORD vertex_states_texture []
 
static const DWORD vertex_states_sampler []
 

Function Documentation

◆ apply_lights()

static void apply_lights ( struct wined3d_device device,
const struct wined3d_state state 
)
static

Definition at line 947 of file stateblock.c.

948 {
949  UINT i;
950 
951  for (i = 0; i < LIGHTMAP_SIZE; ++i)
952  {
953  struct list *e;
954 
955  LIST_FOR_EACH(e, &state->light_map[i])
956  {
957  const struct wined3d_light_info *light = LIST_ENTRY(e, struct wined3d_light_info, entry);
958 
959  wined3d_device_set_light(device, light->OriginalIndex, &light->OriginalParms);
960  wined3d_device_set_light_enable(device, light->OriginalIndex, light->glIndex != -1);
961  }
962  }
963 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: devices.h:37
#define e
Definition: ke_i.h:82
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light)
Definition: device.c:1580
#define LIGHTMAP_SIZE
static int state
Definition: maze.c:121
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
unsigned int UINT
Definition: ndis.h:50
#define LIST_ENTRY(type)
Definition: queue.h:175
HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable)
Definition: device.c:1741

Referenced by wined3d_stateblock_apply().

◆ state_cleanup()

void state_cleanup ( struct wined3d_state state)

Definition at line 528 of file stateblock.c.

529 {
530  unsigned int counter;
531 
532  if (!(state->flags & WINED3D_STATE_NO_REF))
534 
535  for (counter = 0; counter < MAX_ACTIVE_LIGHTS; ++counter)
536  {
537  state->lights[counter] = NULL;
538  }
539 
540  for (counter = 0; counter < LIGHTMAP_SIZE; ++counter)
541  {
542  struct list *e1, *e2;
543  LIST_FOR_EACH_SAFE(e1, e2, &state->light_map[counter])
544  {
546  list_remove(&light->entry);
547  heap_free(light);
548  }
549  }
550 }
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
#define MAX_ACTIVE_LIGHTS
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
void state_unbind_resources(struct wined3d_state *state)
Definition: stateblock.c:429
#define LIGHTMAP_SIZE
static int state
Definition: maze.c:121
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define WINED3D_STATE_NO_REF
#define LIST_ENTRY(type)
Definition: queue.h:175
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by device_init(), wined3d_cs_create(), wined3d_cs_destroy(), wined3d_cs_exec_reset_state(), wined3d_device_decref(), wined3d_device_reset(), and wined3d_stateblock_decref().

◆ state_init()

void state_init ( struct wined3d_state state,
struct wined3d_fb_state fb,
const struct wined3d_gl_info gl_info,
const struct wined3d_d3d_info d3d_info,
DWORD  flags 
)

Definition at line 1310 of file stateblock.c.

1313 {
1314  unsigned int i;
1315 
1316  state->flags = flags;
1317  state->fb = fb;
1318 
1319  for (i = 0; i < LIGHTMAP_SIZE; i++)
1320  {
1321  list_init(&state->light_map[i]);
1322  }
1323 
1325  state_init_default(state, gl_info);
1326 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLbitfield flags
Definition: glext.h:7161
#define LIGHTMAP_SIZE
static int state
Definition: maze.c:121
#define WINED3D_STATE_INIT_DEFAULT
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static void state_init_default(struct wined3d_state *state, const struct wined3d_gl_info *gl_info)
Definition: stateblock.c:1107

Referenced by stateblock_init().

◆ state_init_default()

static void state_init_default ( struct wined3d_state state,
const struct wined3d_gl_info gl_info 
)
static

Definition at line 1107 of file stateblock.c.

1108 {
1109  union
1110  {
1111  struct wined3d_line_pattern lp;
1112  DWORD d;
1113  } lp;
1114  union {
1115  float f;
1116  DWORD d;
1117  } tmpfloat;
1118  unsigned int i;
1119  struct wined3d_matrix identity;
1120 
1121  TRACE("state %p, gl_info %p.\n", state, gl_info);
1122 
1124  state->gl_primitive_type = ~0u;
1125  state->gl_patch_vertices = 0;
1126 
1127  /* Set some of the defaults for lights, transforms etc */
1128  state->transforms[WINED3D_TS_PROJECTION] = identity;
1129  state->transforms[WINED3D_TS_VIEW] = identity;
1130  for (i = 0; i < 256; ++i)
1131  {
1132  state->transforms[WINED3D_TS_WORLD_MATRIX(i)] = identity;
1133  }
1134 
1135  TRACE("Render states\n");
1136  /* Render states: */
1137  state->render_states[WINED3D_RS_ZENABLE] = WINED3D_ZB_TRUE;
1138  state->render_states[WINED3D_RS_FILLMODE] = WINED3D_FILL_SOLID;
1140  lp.lp.repeat_factor = 0;
1141  lp.lp.line_pattern = 0;
1142  state->render_states[WINED3D_RS_LINEPATTERN] = lp.d;
1143  state->render_states[WINED3D_RS_ZWRITEENABLE] = TRUE;
1144  state->render_states[WINED3D_RS_ALPHATESTENABLE] = FALSE;
1145  state->render_states[WINED3D_RS_LASTPIXEL] = TRUE;
1146  state->render_states[WINED3D_RS_SRCBLEND] = WINED3D_BLEND_ONE;
1147  state->render_states[WINED3D_RS_DESTBLEND] = WINED3D_BLEND_ZERO;
1148  state->render_states[WINED3D_RS_CULLMODE] = WINED3D_CULL_BACK;
1149  state->render_states[WINED3D_RS_ZFUNC] = WINED3D_CMP_LESSEQUAL;
1150  state->render_states[WINED3D_RS_ALPHAFUNC] = WINED3D_CMP_ALWAYS;
1151  state->render_states[WINED3D_RS_ALPHAREF] = 0;
1152  state->render_states[WINED3D_RS_DITHERENABLE] = FALSE;
1153  state->render_states[WINED3D_RS_ALPHABLENDENABLE] = FALSE;
1154  state->render_states[WINED3D_RS_FOGENABLE] = FALSE;
1155  state->render_states[WINED3D_RS_SPECULARENABLE] = FALSE;
1156  state->render_states[WINED3D_RS_ZVISIBLE] = 0;
1157  state->render_states[WINED3D_RS_FOGCOLOR] = 0;
1159  tmpfloat.f = 0.0f;
1160  state->render_states[WINED3D_RS_FOGSTART] = tmpfloat.d;
1161  tmpfloat.f = 1.0f;
1162  state->render_states[WINED3D_RS_FOGEND] = tmpfloat.d;
1163  tmpfloat.f = 1.0f;
1164  state->render_states[WINED3D_RS_FOGDENSITY] = tmpfloat.d;
1165  state->render_states[WINED3D_RS_EDGEANTIALIAS] = FALSE;
1166  state->render_states[WINED3D_RS_RANGEFOGENABLE] = FALSE;
1167  state->render_states[WINED3D_RS_STENCILENABLE] = FALSE;
1171  state->render_states[WINED3D_RS_STENCILREF] = 0;
1172  state->render_states[WINED3D_RS_STENCILMASK] = 0xffffffff;
1174  state->render_states[WINED3D_RS_STENCILWRITEMASK] = 0xffffffff;
1175  state->render_states[WINED3D_RS_TEXTUREFACTOR] = 0xffffffff;
1176  state->render_states[WINED3D_RS_WRAP0] = 0;
1177  state->render_states[WINED3D_RS_WRAP1] = 0;
1178  state->render_states[WINED3D_RS_WRAP2] = 0;
1179  state->render_states[WINED3D_RS_WRAP3] = 0;
1180  state->render_states[WINED3D_RS_WRAP4] = 0;
1181  state->render_states[WINED3D_RS_WRAP5] = 0;
1182  state->render_states[WINED3D_RS_WRAP6] = 0;
1183  state->render_states[WINED3D_RS_WRAP7] = 0;
1184  state->render_states[WINED3D_RS_CLIPPING] = TRUE;
1185  state->render_states[WINED3D_RS_LIGHTING] = TRUE;
1186  state->render_states[WINED3D_RS_AMBIENT] = 0;
1188  state->render_states[WINED3D_RS_COLORVERTEX] = TRUE;
1189  state->render_states[WINED3D_RS_LOCALVIEWER] = TRUE;
1190  state->render_states[WINED3D_RS_NORMALIZENORMALS] = FALSE;
1196  state->render_states[WINED3D_RS_CLIPPLANEENABLE] = 0;
1198  tmpfloat.f = 1.0f;
1199  state->render_states[WINED3D_RS_POINTSIZE] = tmpfloat.d;
1200  tmpfloat.f = 1.0f;
1201  state->render_states[WINED3D_RS_POINTSIZE_MIN] = tmpfloat.d;
1202  state->render_states[WINED3D_RS_POINTSPRITEENABLE] = FALSE;
1203  state->render_states[WINED3D_RS_POINTSCALEENABLE] = FALSE;
1204  tmpfloat.f = 1.0f;
1205  state->render_states[WINED3D_RS_POINTSCALE_A] = tmpfloat.d;
1206  tmpfloat.f = 0.0f;
1207  state->render_states[WINED3D_RS_POINTSCALE_B] = tmpfloat.d;
1208  tmpfloat.f = 0.0f;
1209  state->render_states[WINED3D_RS_POINTSCALE_C] = tmpfloat.d;
1210  state->render_states[WINED3D_RS_MULTISAMPLEANTIALIAS] = TRUE;
1211  state->render_states[WINED3D_RS_MULTISAMPLEMASK] = 0xffffffff;
1213  tmpfloat.f = 1.0f;
1214  state->render_states[WINED3D_RS_PATCHSEGMENTS] = tmpfloat.d;
1215  state->render_states[WINED3D_RS_DEBUGMONITORTOKEN] = 0xbaadcafe;
1216  tmpfloat.f = gl_info->limits.pointsize_max;
1217  state->render_states[WINED3D_RS_POINTSIZE_MAX] = tmpfloat.d;
1219  tmpfloat.f = 0.0f;
1220  state->render_states[WINED3D_RS_TWEENFACTOR] = tmpfloat.d;
1221  state->render_states[WINED3D_RS_BLENDOP] = WINED3D_BLEND_OP_ADD;
1224  /* states new in d3d9 */
1225  state->render_states[WINED3D_RS_SCISSORTESTENABLE] = FALSE;
1226  state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] = 0;
1227  tmpfloat.f = 1.0f;
1228  state->render_states[WINED3D_RS_MINTESSELLATIONLEVEL] = tmpfloat.d;
1229  state->render_states[WINED3D_RS_MAXTESSELLATIONLEVEL] = tmpfloat.d;
1230  state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE] = FALSE;
1231  tmpfloat.f = 0.0f;
1232  state->render_states[WINED3D_RS_ADAPTIVETESS_X] = tmpfloat.d;
1233  state->render_states[WINED3D_RS_ADAPTIVETESS_Y] = tmpfloat.d;
1234  tmpfloat.f = 1.0f;
1235  state->render_states[WINED3D_RS_ADAPTIVETESS_Z] = tmpfloat.d;
1236  tmpfloat.f = 0.0f;
1237  state->render_states[WINED3D_RS_ADAPTIVETESS_W] = tmpfloat.d;
1239  state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE] = FALSE;
1244  state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff;
1245  state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0;
1246  state->render_states[WINED3D_RS_DEPTHBIAS] = 0;
1247  tmpfloat.f = 0.0f;
1248  state->render_states[WINED3D_RS_DEPTHBIASCLAMP] = tmpfloat.d;
1249  state->render_states[WINED3D_RS_DEPTHCLIP] = TRUE;
1250  state->render_states[WINED3D_RS_WRAP8] = 0;
1251  state->render_states[WINED3D_RS_WRAP9] = 0;
1252  state->render_states[WINED3D_RS_WRAP10] = 0;
1253  state->render_states[WINED3D_RS_WRAP11] = 0;
1254  state->render_states[WINED3D_RS_WRAP12] = 0;
1255  state->render_states[WINED3D_RS_WRAP13] = 0;
1256  state->render_states[WINED3D_RS_WRAP14] = 0;
1257  state->render_states[WINED3D_RS_WRAP15] = 0;
1262  for (i = 0; i < MAX_RENDER_TARGETS; ++i)
1263  state->render_states[WINED3D_RS_COLORWRITE(i)] = 0x0000000f;
1264 
1265  /* Texture Stage States - Put directly into state block, we will call function below */
1266  for (i = 0; i < MAX_TEXTURES; ++i)
1267  {
1268  TRACE("Setting up default texture states for texture Stage %u.\n", i);
1269  state->transforms[WINED3D_TS_TEXTURE0 + i] = identity;
1271  state->texture_states[i][WINED3D_TSS_COLOR_ARG1] = WINED3DTA_TEXTURE;
1272  state->texture_states[i][WINED3D_TSS_COLOR_ARG2] = WINED3DTA_CURRENT;
1274  state->texture_states[i][WINED3D_TSS_ALPHA_ARG1] = WINED3DTA_TEXTURE;
1275  state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] = WINED3DTA_CURRENT;
1276  state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00] = 0;
1277  state->texture_states[i][WINED3D_TSS_BUMPENV_MAT01] = 0;
1278  state->texture_states[i][WINED3D_TSS_BUMPENV_MAT10] = 0;
1279  state->texture_states[i][WINED3D_TSS_BUMPENV_MAT11] = 0;
1280  state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX] = i;
1281  state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE] = 0;
1282  state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET] = 0;
1284  state->texture_states[i][WINED3D_TSS_COLOR_ARG0] = WINED3DTA_CURRENT;
1285  state->texture_states[i][WINED3D_TSS_ALPHA_ARG0] = WINED3DTA_CURRENT;
1286  state->texture_states[i][WINED3D_TSS_RESULT_ARG] = WINED3DTA_CURRENT;
1287  }
1288 
1289  for (i = 0 ; i < MAX_COMBINED_SAMPLERS; ++i)
1290  {
1291  TRACE("Setting up default samplers states for sampler %u.\n", i);
1295  state->sampler_states[i][WINED3D_SAMP_BORDER_COLOR] = 0;
1296  state->sampler_states[i][WINED3D_SAMP_MAG_FILTER] = WINED3D_TEXF_POINT;
1297  state->sampler_states[i][WINED3D_SAMP_MIN_FILTER] = WINED3D_TEXF_POINT;
1298  state->sampler_states[i][WINED3D_SAMP_MIP_FILTER] = WINED3D_TEXF_NONE;
1299  state->sampler_states[i][WINED3D_SAMP_MIPMAP_LOD_BIAS] = 0;
1300  state->sampler_states[i][WINED3D_SAMP_MAX_MIP_LEVEL] = 0;
1301  state->sampler_states[i][WINED3D_SAMP_MAX_ANISOTROPY] = 1;
1302  state->sampler_states[i][WINED3D_SAMP_SRGB_TEXTURE] = 0;
1303  /* TODO: Indicates which element of a multielement texture to use. */
1304  state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0;
1305  /* TODO: Vertex offset in the presampled displacement map. */
1306  state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0;
1307  }
1308 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define MAX_RENDER_TARGETS
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:664
#define MAX_TEXTURES
#define TRUE
Definition: types.h:120
void get_identity_matrix(struct wined3d_matrix *mat)
Definition: utils.c:4879
static enum wined3d_render_state WINED3D_RS_COLORWRITE(int index)
Definition: wined3d.h:400
#define WINED3DTA_CURRENT
Definition: wined3d.h:868
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_COMBINED_SAMPLERS
static D3DRMMATRIX4D identity
Definition: frame.c:29
#define WINED3DTA_TEXTURE
Definition: wined3d.h:869
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
unsigned long DWORD
Definition: ntddk_ex.h:95
static int state
Definition: maze.c:121
#define f
Definition: ke_i.h:83
struct wined3d_gl_limits limits

Referenced by state_init().

◆ state_unbind_resources()

void state_unbind_resources ( struct wined3d_state state)

Definition at line 429 of file stateblock.c.

430 {
431  struct wined3d_unordered_access_view *uav;
432  struct wined3d_shader_resource_view *srv;
433  struct wined3d_vertex_declaration *decl;
434  struct wined3d_sampler *sampler;
435  struct wined3d_texture *texture;
436  struct wined3d_buffer *buffer;
437  struct wined3d_shader *shader;
438  unsigned int i, j;
439 
440  if ((decl = state->vertex_declaration))
441  {
442  state->vertex_declaration = NULL;
444  }
445 
446  for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
447  {
448  if ((texture = state->textures[i]))
449  {
450  state->textures[i] = NULL;
452  }
453  }
454 
455  for (i = 0; i < WINED3D_MAX_STREAM_OUTPUT_BUFFERS; ++i)
456  {
457  if ((buffer = state->stream_output[i].buffer))
458  {
459  state->stream_output[i].buffer = NULL;
461  }
462  }
463 
464  for (i = 0; i < MAX_STREAMS; ++i)
465  {
466  if ((buffer = state->streams[i].buffer))
467  {
468  state->streams[i].buffer = NULL;
470  }
471  }
472 
473  if ((buffer = state->index_buffer))
474  {
475  state->index_buffer = NULL;
477  }
478 
479  for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
480  {
481  if ((shader = state->shader[i]))
482  {
483  state->shader[i] = NULL;
485  }
486 
487  for (j = 0; j < MAX_CONSTANT_BUFFERS; ++j)
488  {
489  if ((buffer = state->cb[i][j]))
490  {
491  state->cb[i][j] = NULL;
493  }
494  }
495 
496  for (j = 0; j < MAX_SAMPLER_OBJECTS; ++j)
497  {
498  if ((sampler = state->sampler[i][j]))
499  {
500  state->sampler[i][j] = NULL;
502  }
503  }
504 
505  for (j = 0; j < MAX_SHADER_RESOURCE_VIEWS; ++j)
506  {
507  if ((srv = state->shader_resource_view[i][j]))
508  {
509  state->shader_resource_view[i][j] = NULL;
511  }
512  }
513  }
514 
515  for (i = 0; i < WINED3D_PIPELINE_COUNT; ++i)
516  {
517  for (j = 0; j < MAX_UNORDERED_ACCESS_VIEWS; ++j)
518  {
519  if ((uav = state->unordered_access_view[i][j]))
520  {
521  state->unordered_access_view[i][j] = NULL;
523  }
524  }
525  }
526 }
#define MAX_SHADER_RESOURCE_VIEWS
#define MAX_CONSTANT_BUFFERS
#define WINED3D_MAX_STREAM_OUTPUT_BUFFERS
Definition: wined3d.h:1569
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_COMBINED_SAMPLERS
#define MAX_SAMPLER_OBJECTS
smooth NULL
Definition: ftsmooth.c:416
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
Definition: shader.c:3364
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define MAX_UNORDERED_ACCESS_VIEWS
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
GLuint shader
Definition: glext.h:6030
GLenum GLuint texture
Definition: glext.h:6295
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
Definition: sampler.c:53
static int state
Definition: maze.c:121
#define MAX_STREAMS
ULONG CDECL wined3d_unordered_access_view_decref(struct wined3d_unordered_access_view *view)
Definition: view.c:970
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
Definition: view.c:671
GLuint sampler
Definition: glext.h:7283

Referenced by state_cleanup(), wined3d_device_reset(), and wined3d_device_uninit_3d().

◆ stateblock_init()

static HRESULT stateblock_init ( struct wined3d_stateblock stateblock,
struct wined3d_device device,
enum wined3d_stateblock_type  type 
)
static

Definition at line 1328 of file stateblock.c.

1330 {
1331  const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
1332 
1333  stateblock->ref = 1;
1334  stateblock->device = device;
1335  state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0);
1336 
1337  if (type == WINED3D_SBT_RECORDED)
1338  return WINED3D_OK;
1339 
1340  TRACE("Updating changed flags appropriate for type %#x.\n", type);
1341 
1342  switch (type)
1343  {
1344  case WINED3D_SBT_ALL:
1345  stateblock_init_lights(stateblock, device->state.light_map);
1347  d3d_info->limits.vs_uniform_count, d3d_info->limits.ps_uniform_count);
1348  break;
1349 
1352  d3d_info->limits.ps_uniform_count);
1353  break;
1354 
1356  stateblock_init_lights(stateblock, device->state.light_map);
1358  d3d_info->limits.vs_uniform_count);
1359  break;
1360 
1361  default:
1362  FIXME("Unrecognized state block type %#x.\n", type);
1363  break;
1364  }
1365 
1367  wined3d_stateblock_capture(stateblock);
1368 
1369  return WINED3D_OK;
1370 }
struct wined3d_state state
struct wined3d_saved_states changed
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states, const DWORD num_constants)
Definition: stateblock.c:237
static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *states, const DWORD num_constants)
Definition: stateblock.c:263
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:290
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3D_OK
Definition: wined3d.h:37
void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags)
Definition: stateblock.c:1310
struct wined3d_d3d_limits limits
static void stateblock_init_lights(struct wined3d_stateblock *stateblock, struct list *light_map)
Definition: stateblock.c:402
struct wined3d_device * device
void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:684
static void stateblock_savedstates_set_all(struct wined3d_saved_states *states, DWORD vs_consts, DWORD ps_consts)
Definition: stateblock.c:205

◆ stateblock_init_contained_states()

void stateblock_init_contained_states ( struct wined3d_stateblock stateblock)

Definition at line 290 of file stateblock.c.

291 {
292  const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
293  unsigned int i, j;
294 
295  for (i = 0; i <= WINEHIGHEST_RENDER_STATE >> 5; ++i)
296  {
297  DWORD map = stateblock->changed.renderState[i];
298  for (j = 0; map; map >>= 1, ++j)
299  {
300  if (!(map & 1)) continue;
301 
302  stateblock->contained_render_states[stateblock->num_contained_render_states] = (i << 5) | j;
303  ++stateblock->num_contained_render_states;
304  }
305  }
306 
307  for (i = 0; i <= HIGHEST_TRANSFORMSTATE >> 5; ++i)
308  {
309  DWORD map = stateblock->changed.transform[i];
310  for (j = 0; map; map >>= 1, ++j)
311  {
312  if (!(map & 1)) continue;
313 
314  stateblock->contained_transform_states[stateblock->num_contained_transform_states] = (i << 5) | j;
315  ++stateblock->num_contained_transform_states;
316  }
317  }
318 
319  for (i = 0; i < d3d_info->limits.vs_uniform_count; ++i)
320  {
321  if (stateblock->changed.vs_consts_f[i])
322  {
323  stateblock->contained_vs_consts_f[stateblock->num_contained_vs_consts_f] = i;
324  ++stateblock->num_contained_vs_consts_f;
325  }
326  }
327 
328  for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
329  {
330  if (stateblock->changed.vertexShaderConstantsI & (1u << i))
331  {
332  stateblock->contained_vs_consts_i[stateblock->num_contained_vs_consts_i] = i;
333  ++stateblock->num_contained_vs_consts_i;
334  }
335  }
336 
337  for (i = 0; i < WINED3D_MAX_CONSTS_B; ++i)
338  {
339  if (stateblock->changed.vertexShaderConstantsB & (1u << i))
340  {
341  stateblock->contained_vs_consts_b[stateblock->num_contained_vs_consts_b] = i;
342  ++stateblock->num_contained_vs_consts_b;
343  }
344  }
345 
346  for (i = 0; i < d3d_info->limits.ps_uniform_count; ++i)
347  {
348  if (stateblock->changed.ps_consts_f[i])
349  {
350  stateblock->contained_ps_consts_f[stateblock->num_contained_ps_consts_f] = i;
351  ++stateblock->num_contained_ps_consts_f;
352  }
353  }
354 
355  for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
356  {
357  if (stateblock->changed.pixelShaderConstantsI & (1u << i))
358  {
359  stateblock->contained_ps_consts_i[stateblock->num_contained_ps_consts_i] = i;
360  ++stateblock->num_contained_ps_consts_i;
361  }
362  }
363 
364  for (i = 0; i < WINED3D_MAX_CONSTS_B; ++i)
365  {
366  if (stateblock->changed.pixelShaderConstantsB & (1u << i))
367  {
368  stateblock->contained_ps_consts_b[stateblock->num_contained_ps_consts_b] = i;
369  ++stateblock->num_contained_ps_consts_b;
370  }
371  }
372 
373  for (i = 0; i < MAX_TEXTURES; ++i)
374  {
375  DWORD map = stateblock->changed.textureState[i];
376 
377  for(j = 0; map; map >>= 1, ++j)
378  {
379  if (!(map & 1)) continue;
380 
381  stateblock->contained_tss_states[stateblock->num_contained_tss_states].stage = i;
382  stateblock->contained_tss_states[stateblock->num_contained_tss_states].state = j;
383  ++stateblock->num_contained_tss_states;
384  }
385  }
386 
387  for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
388  {
389  DWORD map = stateblock->changed.samplerState[i];
390 
391  for (j = 0; map; map >>= 1, ++j)
392  {
393  if (!(map & 1)) continue;
394 
395  stateblock->contained_sampler_states[stateblock->num_contained_sampler_states].stage = i;
396  stateblock->contained_sampler_states[stateblock->num_contained_sampler_states].state = j;
397  ++stateblock->num_contained_sampler_states;
398  }
399  }
400 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned int num_contained_ps_consts_f
#define MAX_TEXTURES
unsigned int num_contained_tss_states
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE+1]
DWORD contained_transform_states[HIGHEST_TRANSFORMSTATE+1]
struct wined3d_saved_states changed
#define WINED3D_MAX_CONSTS_I
DWORD contained_vs_consts_b[WINED3D_MAX_CONSTS_B]
struct StageState contained_sampler_states[MAX_COMBINED_SAMPLERS *WINED3D_HIGHEST_SAMPLER_STATE]
DWORD contained_ps_consts_i[WINED3D_MAX_CONSTS_I]
unsigned int num_contained_ps_consts_i
unsigned int num_contained_vs_consts_f
DWORD contained_vs_consts_i[WINED3D_MAX_CONSTS_I]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_COMBINED_SAMPLERS
unsigned int num_contained_vs_consts_i
unsigned int num_contained_render_states
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
DWORD contained_ps_consts_f[WINED3D_MAX_PS_CONSTS_F]
DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F]
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _map.h:44
unsigned int num_contained_ps_consts_b
struct wined3d_d3d_limits limits
struct wined3d_device * device
unsigned int num_contained_sampler_states
#define WINED3D_MAX_CONSTS_B
DWORD contained_ps_consts_b[WINED3D_MAX_CONSTS_B]
unsigned int num_contained_transform_states
struct StageState contained_tss_states[MAX_TEXTURES *(WINED3D_HIGHEST_TEXTURE_STATE+1)]
unsigned int num_contained_vs_consts_b
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
Definition: glfuncs.h:262

Referenced by stateblock_init(), and wined3d_device_end_stateblock().

◆ stateblock_init_lights()

static void stateblock_init_lights ( struct wined3d_stateblock stateblock,
struct list light_map 
)
static

Definition at line 402 of file stateblock.c.

403 {
404  unsigned int i;
405 
406  for (i = 0; i < LIGHTMAP_SIZE; ++i)
407  {
408  const struct wined3d_light_info *src_light;
409 
410  LIST_FOR_EACH_ENTRY(src_light, &light_map[i], struct wined3d_light_info, entry)
411  {
412  struct wined3d_light_info *dst_light = heap_alloc(sizeof(*dst_light));
413 
414  *dst_light = *src_light;
415  list_add_tail(&stateblock->state.light_map[i], &dst_light->entry);
416  }
417  }
418 }
struct wined3d_state state
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LIGHTMAP_SIZE
uint32_t entry
Definition: isohybrid.c:63

Referenced by stateblock_init().

◆ stateblock_savedstates_set_all()

static void stateblock_savedstates_set_all ( struct wined3d_saved_states states,
DWORD  vs_consts,
DWORD  ps_consts 
)
static

Definition at line 205 of file stateblock.c.

206 {
207  unsigned int i;
208 
209  /* Single values */
210  states->indices = 1;
211  states->material = 1;
212  states->viewport = 1;
213  states->vertexDecl = 1;
214  states->pixelShader = 1;
215  states->vertexShader = 1;
216  states->scissorRect = 1;
217 
218  /* Fixed size arrays */
219  states->streamSource = 0xffff;
220  states->streamFreq = 0xffff;
221  states->textures = 0xfffff;
224  for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff;
225  for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3ffe;
226  states->clipplane = (1u << MAX_CLIP_DISTANCES) - 1;
227  states->pixelShaderConstantsB = 0xffff;
228  states->pixelShaderConstantsI = 0xffff;
229  states->vertexShaderConstantsB = 0xffff;
230  states->vertexShaderConstantsI = 0xffff;
231 
232  /* Dynamically sized arrays */
233  memset(states->ps_consts_f, TRUE, sizeof(BOOL) * ps_consts);
234  memset(states->vs_consts_f, TRUE, sizeof(BOOL) * vs_consts);
235 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define MAX_TEXTURES
BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F]
#define TRUE
Definition: types.h:120
DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5)+1]
WORD samplerState[MAX_COMBINED_SAMPLERS]
BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_COMBINED_SAMPLERS
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD textureState[MAX_TEXTURES]
static void stateblock_set_bits(DWORD *map, UINT map_size)
Definition: stateblock.c:197
#define for
Definition: utility.h:88
#define MAX_CLIP_DISTANCES
DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5)+1]
#define HIGHEST_TRANSFORMSTATE
#define WINEHIGHEST_RENDER_STATE
Definition: wined3d.h:398
#define memset(x, y, z)
Definition: compat.h:39

Referenced by stateblock_init().

◆ stateblock_savedstates_set_pixel()

static void stateblock_savedstates_set_pixel ( struct wined3d_saved_states states,
const DWORD  num_constants 
)
static

Definition at line 237 of file stateblock.c.

238 {
239  DWORD texture_mask = 0;
240  WORD sampler_mask = 0;
241  unsigned int i;
242 
243  states->pixelShader = 1;
244 
245  for (i = 0; i < ARRAY_SIZE(pixel_states_render); ++i)
246  {
248  states->renderState[rs >> 5] |= 1u << (rs & 0x1f);
249  }
250 
251  for (i = 0; i < ARRAY_SIZE(pixel_states_texture); ++i)
252  texture_mask |= 1u << pixel_states_texture[i];
253  for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = texture_mask;
254  for (i = 0; i < ARRAY_SIZE(pixel_states_sampler); ++i)
255  sampler_mask |= 1u << pixel_states_sampler[i];
256  for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = sampler_mask;
257  states->pixelShaderConstantsB = 0xffff;
258  states->pixelShaderConstantsI = 0xffff;
259 
260  memset(states->ps_consts_f, TRUE, sizeof(BOOL) * num_constants);
261 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define MAX_TEXTURES
BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F]
#define TRUE
Definition: types.h:120
WORD samplerState[MAX_COMBINED_SAMPLERS]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_COMBINED_SAMPLERS
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD textureState[MAX_TEXTURES]
unsigned short WORD
Definition: ntddk_ex.h:93
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5)+1]
#define ARRAY_SIZE(a)
Definition: main.h:24
static const DWORD pixel_states_texture[]
Definition: stateblock.c:100
#define memset(x, y, z)
Definition: compat.h:39
static const DWORD pixel_states_render[]
Definition: stateblock.c:31
static const DWORD pixel_states_sampler[]
Definition: stateblock.c:121

Referenced by stateblock_init().

◆ stateblock_savedstates_set_vertex()

static void stateblock_savedstates_set_vertex ( struct wined3d_saved_states states,
const DWORD  num_constants 
)
static

Definition at line 263 of file stateblock.c.

264 {
265  DWORD texture_mask = 0;
266  WORD sampler_mask = 0;
267  unsigned int i;
268 
269  states->vertexDecl = 1;
270  states->vertexShader = 1;
271 
272  for (i = 0; i < ARRAY_SIZE(vertex_states_render); ++i)
273  {
275  states->renderState[rs >> 5] |= 1u << (rs & 0x1f);
276  }
277 
278  for (i = 0; i < ARRAY_SIZE(vertex_states_texture); ++i)
279  texture_mask |= 1u << vertex_states_texture[i];
280  for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = texture_mask;
281  for (i = 0; i < ARRAY_SIZE(vertex_states_sampler); ++i)
282  sampler_mask |= 1u << vertex_states_sampler[i];
283  for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = sampler_mask;
284  states->vertexShaderConstantsB = 0xffff;
285  states->vertexShaderConstantsI = 0xffff;
286 
287  memset(states->vs_consts_f, TRUE, sizeof(BOOL) * num_constants);
288 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define MAX_TEXTURES
#define TRUE
Definition: types.h:120
WORD samplerState[MAX_COMBINED_SAMPLERS]
static const DWORD vertex_states_sampler[]
Definition: stateblock.c:192
BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_COMBINED_SAMPLERS
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD textureState[MAX_TEXTURES]
static const DWORD vertex_states_texture[]
Definition: stateblock.c:186
unsigned short WORD
Definition: ntddk_ex.h:93
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5)+1]
#define ARRAY_SIZE(a)
Definition: main.h:24
static const DWORD vertex_states_render[]
Definition: stateblock.c:137
#define memset(x, y, z)
Definition: compat.h:39

Referenced by stateblock_init().

◆ stateblock_set_bits()

static void stateblock_set_bits ( DWORD map,
UINT  map_size 
)
inlinestatic

Definition at line 197 of file stateblock.c.

198 {
199  DWORD mask = (1u << (map_size & 0x1f)) - 1;
200  memset(map, 0xff, (map_size >> 5) * sizeof(*map));
201  if (mask) map[map_size >> 5] = mask;
202 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _map.h:44
#define memset(x, y, z)
Definition: compat.h:39

Referenced by stateblock_savedstates_set_all().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d  )

◆ wined3d_state_enable_light()

void wined3d_state_enable_light ( struct wined3d_state state,
const struct wined3d_d3d_info d3d_info,
struct wined3d_light_info light_info,
BOOL  enable 
)

Definition at line 582 of file stateblock.c.

584 {
585  unsigned int light_count, i;
586 
587  if (!(light_info->enabled = enable))
588  {
589  if (light_info->glIndex == -1)
590  {
591  TRACE("Light already disabled, nothing to do.\n");
592  return;
593  }
594 
595  state->lights[light_info->glIndex] = NULL;
596  light_info->glIndex = -1;
597  return;
598  }
599 
600  if (light_info->glIndex != -1)
601  {
602  TRACE("Light already enabled, nothing to do.\n");
603  return;
604  }
605 
606  /* Find a free light. */
607  light_count = d3d_info->limits.active_light_count;
608  for (i = 0; i < light_count; ++i)
609  {
610  if (state->lights[i])
611  continue;
612 
613  state->lights[i] = light_info;
614  light_info->glIndex = i;
615  return;
616  }
617 
618  /* Our tests show that Windows returns D3D_OK in this situation, even with
619  * D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE devices.
620  * This is consistent among ddraw, d3d8 and d3d9. GetLightEnable returns
621  * TRUE * as well for those lights.
622  *
623  * TODO: Test how this affects rendering. */
624  WARN("Too many concurrently active lights.\n");
625 }
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static int state
Definition: maze.c:121
GLboolean enable
Definition: glext.h:11120
struct wined3d_d3d_limits limits

Referenced by wined3d_cs_exec_set_light_enable(), and wined3d_device_set_light_enable().

◆ wined3d_state_get_light()

struct wined3d_light_info* wined3d_state_get_light ( const struct wined3d_state state,
unsigned int  idx 
)

Definition at line 567 of file stateblock.c.

568 {
569  struct wined3d_light_info *light_info;
570  unsigned int hash_idx;
571 
572  hash_idx = LIGHTMAP_HASHFUNC(idx);
573  LIST_FOR_EACH_ENTRY(light_info, &state->light_map[hash_idx], struct wined3d_light_info, entry)
574  {
575  if (light_info->OriginalIndex == idx)
576  return light_info;
577  }
578 
579  return NULL;
580 }
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIGHTMAP_HASHFUNC(x)
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
static int state
Definition: maze.c:121
uint32_t entry
Definition: isohybrid.c:63

Referenced by wined3d_cs_exec_set_light(), wined3d_cs_exec_set_light_enable(), wined3d_device_get_light(), wined3d_device_get_light_enable(), wined3d_device_set_light(), and wined3d_device_set_light_enable().

◆ wined3d_state_record_lights()

static void wined3d_state_record_lights ( struct wined3d_state dst_state,
const struct wined3d_state src_state 
)
static

Definition at line 627 of file stateblock.c.

628 {
629  UINT i;
630 
631  /* Lights... For a recorded state block, we just had a chain of actions
632  * to perform, so we need to walk that chain and update any actions which
633  * differ. */
634  for (i = 0; i < LIGHTMAP_SIZE; ++i)
635  {
636  struct list *e, *f;
637  LIST_FOR_EACH(e, &dst_state->light_map[i])
638  {
639  BOOL updated = FALSE;
640  struct wined3d_light_info *src = LIST_ENTRY(e, struct wined3d_light_info, entry), *realLight;
641 
642  /* Look up the light in the destination */
643  LIST_FOR_EACH(f, &src_state->light_map[i])
644  {
645  realLight = LIST_ENTRY(f, struct wined3d_light_info, entry);
646  if (realLight->OriginalIndex == src->OriginalIndex)
647  {
648  src->OriginalParms = realLight->OriginalParms;
649 
650  if (realLight->glIndex == -1 && src->glIndex != -1)
651  {
652  /* Light disabled */
653  dst_state->lights[src->glIndex] = NULL;
654  }
655  else if (realLight->glIndex != -1 && src->glIndex == -1)
656  {
657  /* Light enabled */
658  dst_state->lights[realLight->glIndex] = src;
659  }
660  src->glIndex = realLight->glIndex;
661  updated = TRUE;
662  break;
663  }
664  }
665 
666  if (!updated)
667  {
668  /* This can happen if the light was originally created as a
669  * default light for SetLightEnable() while recording. */
670  WARN("Light %u in dst_state %p does not exist in src_state %p.\n",
671  src->OriginalIndex, dst_state, src_state);
672 
673  src->OriginalParms = WINED3D_default_light;
674  if (src->glIndex != -1)
675  {
676  dst_state->lights[src->glIndex] = NULL;
677  src->glIndex = -1;
678  }
679  }
680  }
681  }
682 }
const struct wined3d_light WINED3D_default_light
Definition: device.c:41
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define e
Definition: ke_i.h:82
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
struct list light_map[LIGHTMAP_SIZE]
GLfloat f
Definition: glext.h:7540
const struct wined3d_light_info * lights[MAX_ACTIVE_LIGHTS]
#define LIGHTMAP_SIZE
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
GLenum src
Definition: glext.h:6340
#define f
Definition: ke_i.h:83
unsigned int UINT
Definition: ndis.h:50
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by wined3d_stateblock_capture().

◆ wined3d_stateblock_apply()

void CDECL wined3d_stateblock_apply ( const struct wined3d_stateblock stateblock)

Definition at line 965 of file stateblock.c.

966 {
967  struct wined3d_device *device = stateblock->device;
968  unsigned int i;
969  DWORD map;
970 
971  TRACE("Applying stateblock %p to device %p.\n", stateblock, device);
972 
973  if (stateblock->changed.vertexShader)
975 
976  /* Vertex Shader Constants. */
977  for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
978  {
980  1, &stateblock->state.vs_consts_f[stateblock->contained_vs_consts_f[i]]);
981  }
982  for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
983  {
985  1, &stateblock->state.vs_consts_i[stateblock->contained_vs_consts_i[i]]);
986  }
987  for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
988  {
990  1, &stateblock->state.vs_consts_b[stateblock->contained_vs_consts_b[i]]);
991  }
992 
993  apply_lights(device, &stateblock->state);
994 
995  if (stateblock->changed.pixelShader)
997 
998  /* Pixel Shader Constants. */
999  for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
1000  {
1002  1, &stateblock->state.ps_consts_f[stateblock->contained_ps_consts_f[i]]);
1003  }
1004  for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
1005  {
1007  1, &stateblock->state.ps_consts_i[stateblock->contained_ps_consts_i[i]]);
1008  }
1009  for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i)
1010  {
1012  1, &stateblock->state.ps_consts_b[stateblock->contained_ps_consts_b[i]]);
1013  }
1014 
1015  /* Render states. */
1016  for (i = 0; i < stateblock->num_contained_render_states; ++i)
1017  {
1019  stateblock->state.render_states[stateblock->contained_render_states[i]]);
1020  }
1021 
1022  /* Texture states. */
1023  for (i = 0; i < stateblock->num_contained_tss_states; ++i)
1024  {
1025  DWORD stage = stateblock->contained_tss_states[i].stage;
1026  DWORD state = stateblock->contained_tss_states[i].state;
1027 
1028  wined3d_device_set_texture_stage_state(device, stage, state, stateblock->state.texture_states[stage][state]);
1029  }
1030 
1031  /* Sampler states. */
1032  for (i = 0; i < stateblock->num_contained_sampler_states; ++i)
1033  {
1034  DWORD stage = stateblock->contained_sampler_states[i].stage;
1035  DWORD state = stateblock->contained_sampler_states[i].state;
1036  DWORD value = stateblock->state.sampler_states[stage][state];
1037 
1040  }
1041 
1042  /* Transform states. */
1043  for (i = 0; i < stateblock->num_contained_transform_states; ++i)
1044  {
1046  &stateblock->state.transforms[stateblock->contained_transform_states[i]]);
1047  }
1048 
1049  if (stateblock->changed.indices)
1050  {
1051  wined3d_device_set_index_buffer(device, stateblock->state.index_buffer,
1052  stateblock->state.index_format, stateblock->state.index_offset);
1053  wined3d_device_set_base_vertex_index(device, stateblock->state.base_vertex_index);
1054  }
1055 
1056  if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration)
1057  wined3d_device_set_vertex_declaration(device, stateblock->state.vertex_declaration);
1058 
1059  if (stateblock->changed.material)
1060  wined3d_device_set_material(device, &stateblock->state.material);
1061 
1062  if (stateblock->changed.viewport)
1063  wined3d_device_set_viewport(device, &stateblock->state.viewport);
1064 
1065  if (stateblock->changed.scissorRect)
1066  wined3d_device_set_scissor_rect(device, &stateblock->state.scissor_rect);
1067 
1068  map = stateblock->changed.streamSource;
1069  for (i = 0; map; map >>= 1, ++i)
1070  {
1071  if (map & 1)
1073  stateblock->state.streams[i].buffer,
1074  0, stateblock->state.streams[i].stride);
1075  }
1076 
1077  map = stateblock->changed.streamFreq;
1078  for (i = 0; map; map >>= 1, ++i)
1079  {
1080  if (map & 1)
1082  stateblock->state.streams[i].frequency | stateblock->state.streams[i].flags);
1083  }
1084 
1085  map = stateblock->changed.textures;
1086  for (i = 0; map; map >>= 1, ++i)
1087  {
1088  DWORD stage;
1089 
1090  if (!(map & 1)) continue;
1091 
1093  wined3d_device_set_texture(device, stage, stateblock->state.textures[i]);
1094  }
1095 
1096  map = stateblock->changed.clipplane;
1097  for (i = 0; map; map >>= 1, ++i)
1098  {
1099  if (!(map & 1)) continue;
1100 
1101  wined3d_device_set_clip_plane(device, i, &stateblock->state.clip_planes[i]);
1102  }
1103 
1104  TRACE("Applied stateblock %p.\n", stateblock);
1105 }
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
Definition: device.c:2186
unsigned int num_contained_ps_consts_f
unsigned int num_contained_tss_states
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE+1]
DWORD contained_transform_states[HIGHEST_TRANSFORMSTATE+1]
HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: device.c:2463
struct wined3d_state state
struct wined3d_saved_states changed
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration)
Definition: device.c:2157
DWORD contained_vs_consts_b[WINED3D_MAX_CONSTS_B]
HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants)
Definition: device.c:2415
void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value)
Definition: device.c:3405
struct StageState contained_sampler_states[MAX_COMBINED_SAMPLERS *WINED3D_HIGHEST_SAMPLER_STATE]
DWORD contained_ps_consts_i[WINED3D_MAX_CONSTS_I]
void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: device.c:1874
unsigned int num_contained_ps_consts_i
unsigned int num_contained_vs_consts_f
DWORD contained_vs_consts_i[WINED3D_MAX_CONSTS_I]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int num_contained_vs_consts_i
HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants)
Definition: device.c:2630
Definition: devices.h:37
HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants)
Definition: device.c:2366
void CDECL wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: device.c:1505
void CDECL wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport)
Definition: device.c:1931
unsigned int num_contained_render_states
HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: device.c:1378
static void apply_lights(struct wined3d_device *device, const struct wined3d_state *state)
Definition: stateblock.c:947
#define TRACE(s)
Definition: solgame.cpp:4
DWORD contained_ps_consts_f[WINED3D_MAX_PS_CONSTS_F]
HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: device.c:2679
DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F]
#define MAX_FRAGMENT_SAMPLERS
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _map.h:44
HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane)
Definition: device.c:1783
HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants)
Definition: device.c:2581
unsigned int num_contained_ps_consts_b
HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture)
Definition: device.c:3462
static int state
Definition: maze.c:121
void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index)
Definition: device.c:1917
struct wined3d_device * device
unsigned int num_contained_sampler_states
#define WINED3DVERTEXTEXTURESAMPLER0
Definition: wined3d.h:1025
void CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material)
Definition: device.c:1849
DWORD contained_ps_consts_b[WINED3D_MAX_CONSTS_B]
unsigned int num_contained_transform_states
void CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect)
Definition: device.c:2126
struct StageState contained_tss_states[MAX_TEXTURES *(WINED3D_HIGHEST_TEXTURE_STATE+1)]
void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader)
Definition: device.c:2509
void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
Definition: device.c:2071
unsigned int num_contained_vs_consts_b
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
Definition: glfuncs.h:262
HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider)
Definition: device.c:1451

Referenced by d3d8_device_ApplyStateBlock(), d3d9_stateblock_Apply(), d3d_device7_ApplyStateBlock(), and ddraw_set_cooperative_level().

◆ wined3d_stateblock_capture()

void CDECL wined3d_stateblock_capture ( struct wined3d_stateblock stateblock)

Definition at line 684 of file stateblock.c.

685 {
686  const struct wined3d_state *src_state = &stateblock->device->state;
687  unsigned int i;
688  DWORD map;
689 
690  TRACE("stateblock %p.\n", stateblock);
691 
692  TRACE("Capturing state %p.\n", src_state);
693 
694  if (stateblock->changed.vertexShader && stateblock->state.shader[WINED3D_SHADER_TYPE_VERTEX]
695  != src_state->shader[WINED3D_SHADER_TYPE_VERTEX])
696  {
697  TRACE("Updating vertex shader from %p to %p\n",
698  stateblock->state.shader[WINED3D_SHADER_TYPE_VERTEX],
699  src_state->shader[WINED3D_SHADER_TYPE_VERTEX]);
700 
701  if (src_state->shader[WINED3D_SHADER_TYPE_VERTEX])
703  if (stateblock->state.shader[WINED3D_SHADER_TYPE_VERTEX])
705  stateblock->state.shader[WINED3D_SHADER_TYPE_VERTEX] = src_state->shader[WINED3D_SHADER_TYPE_VERTEX];
706  }
707 
708  /* Vertex shader float constants. */
709  for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
710  {
711  unsigned int idx = stateblock->contained_vs_consts_f[i];
712 
713  TRACE("Setting vs_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->vs_consts_f[idx]));
714 
715  stateblock->state.vs_consts_f[idx] = src_state->vs_consts_f[idx];
716  }
717 
718  /* Vertex shader integer constants. */
719  for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
720  {
721  unsigned int idx = stateblock->contained_vs_consts_i[i];
722 
723  TRACE("Setting vs_consts[%u] to %s.\n", idx, debug_ivec4(&src_state->vs_consts_i[idx]));
724 
725  stateblock->state.vs_consts_i[idx] = src_state->vs_consts_i[idx];
726  }
727 
728  /* Vertex shader boolean constants. */
729  for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
730  {
731  unsigned int idx = stateblock->contained_vs_consts_b[i];
732 
733  TRACE("Setting vs_consts_b[%u] to %s.\n",
734  idx, src_state->vs_consts_b[idx] ? "TRUE" : "FALSE");
735 
736  stateblock->state.vs_consts_b[idx] = src_state->vs_consts_b[idx];
737  }
738 
739  /* Pixel shader float constants. */
740  for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
741  {
742  unsigned int idx = stateblock->contained_ps_consts_f[i];
743 
744  TRACE("Setting ps_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->ps_consts_f[idx]));
745 
746  stateblock->state.ps_consts_f[idx] = src_state->ps_consts_f[idx];
747  }
748 
749  /* Pixel shader integer constants. */
750  for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
751  {
752  unsigned int idx = stateblock->contained_ps_consts_i[i];
753 
754  TRACE("Setting ps_consts_i[%u] to %s.\n", idx, debug_ivec4(&src_state->ps_consts_i[idx]));
755 
756  stateblock->state.ps_consts_i[idx] = src_state->ps_consts_i[idx];
757  }
758 
759  /* Pixel shader boolean constants. */
760  for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i)
761  {
762  unsigned int idx = stateblock->contained_ps_consts_b[i];
763  TRACE("Setting ps_consts_b[%u] to %s.\n",
764  idx, src_state->ps_consts_b[idx] ? "TRUE" : "FALSE");
765 
766  stateblock->state.ps_consts_b[idx] = src_state->ps_consts_b[idx];
767  }
768 
769  /* Others + Render & Texture */
770  for (i = 0; i < stateblock->num_contained_transform_states; ++i)
771  {
773 
774  TRACE("Updating transform %#x.\n", transform);
775 
776  stateblock->state.transforms[transform] = src_state->transforms[transform];
777  }
778 
779  if (stateblock->changed.indices
780  && ((stateblock->state.index_buffer != src_state->index_buffer)
781  || (stateblock->state.base_vertex_index != src_state->base_vertex_index)
782  || (stateblock->state.index_format != src_state->index_format)
783  || (stateblock->state.index_offset != src_state->index_offset)))
784  {
785  TRACE("Updating index buffer to %p, base vertex index to %d.\n",
786  src_state->index_buffer, src_state->base_vertex_index);
787 
788  if (src_state->index_buffer)
790  if (stateblock->state.index_buffer)
791  wined3d_buffer_decref(stateblock->state.index_buffer);
792  stateblock->state.index_buffer = src_state->index_buffer;
793  stateblock->state.base_vertex_index = src_state->base_vertex_index;
794  stateblock->state.index_format = src_state->index_format;
795  stateblock->state.index_offset = src_state->index_offset;
796  }
797 
798  if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration != src_state->vertex_declaration)
799  {
800  TRACE("Updating vertex declaration from %p to %p.\n",
801  stateblock->state.vertex_declaration, src_state->vertex_declaration);
802 
803  if (src_state->vertex_declaration)
805  if (stateblock->state.vertex_declaration)
806  wined3d_vertex_declaration_decref(stateblock->state.vertex_declaration);
807  stateblock->state.vertex_declaration = src_state->vertex_declaration;
808  }
809 
810  if (stateblock->changed.material
811  && memcmp(&src_state->material, &stateblock->state.material, sizeof(stateblock->state.material)))
812  {
813  TRACE("Updating material.\n");
814 
815  stateblock->state.material = src_state->material;
816  }
817 
818  if (stateblock->changed.viewport
819  && memcmp(&src_state->viewport, &stateblock->state.viewport, sizeof(stateblock->state.viewport)))
820  {
821  TRACE("Updating viewport.\n");
822 
823  stateblock->state.viewport = src_state->viewport;
824  }
825 
826  if (stateblock->changed.scissorRect && memcmp(&src_state->scissor_rect,
827  &stateblock->state.scissor_rect, sizeof(stateblock->state.scissor_rect)))
828  {
829  TRACE("Updating scissor rect.\n");
830 
831  stateblock->state.scissor_rect = src_state->scissor_rect;
832  }
833 
834  map = stateblock->changed.streamSource;
835  for (i = 0; map; map >>= 1, ++i)
836  {
837  if (!(map & 1)) continue;
838 
839  if (stateblock->state.streams[i].stride != src_state->streams[i].stride
840  || stateblock->state.streams[i].buffer != src_state->streams[i].buffer)
841  {
842  TRACE("Updating stream source %u to %p, stride to %u.\n",
843  i, src_state->streams[i].buffer,
844  src_state->streams[i].stride);
845 
846  stateblock->state.streams[i].stride = src_state->streams[i].stride;
847  if (src_state->streams[i].buffer)
848  wined3d_buffer_incref(src_state->streams[i].buffer);
849  if (stateblock->state.streams[i].buffer)
850  wined3d_buffer_decref(stateblock->state.streams[i].buffer);
851  stateblock->state.streams[i].buffer = src_state->streams[i].buffer;
852  }
853  }
854 
855  map = stateblock->changed.streamFreq;
856  for (i = 0; map; map >>= 1, ++i)
857  {
858  if (!(map & 1)) continue;
859 
860  if (stateblock->state.streams[i].frequency != src_state->streams[i].frequency
861  || stateblock->state.streams[i].flags != src_state->streams[i].flags)
862  {
863  TRACE("Updating stream frequency %u to %u flags to %#x.\n",
864  i, src_state->streams[i].frequency, src_state->streams[i].flags);
865 
866  stateblock->state.streams[i].frequency = src_state->streams[i].frequency;
867  stateblock->state.streams[i].flags = src_state->streams[i].flags;
868  }
869  }
870 
871  map = stateblock->changed.clipplane;
872  for (i = 0; map; map >>= 1, ++i)
873  {
874  if (!(map & 1)) continue;
875 
876  if (memcmp(&stateblock->state.clip_planes[i], &src_state->clip_planes[i], sizeof(src_state->clip_planes[i])))
877  {
878  TRACE("Updating clipplane %u.\n", i);
879  stateblock->state.clip_planes[i] = src_state->clip_planes[i];
880  }
881  }
882 
883  /* Render */
884  for (i = 0; i < stateblock->num_contained_render_states; ++i)
885  {
886  enum wined3d_render_state rs = stateblock->contained_render_states[i];
887 
888  TRACE("Updating render state %#x to %u.\n", rs, src_state->render_states[rs]);
889 
890  stateblock->state.render_states[rs] = src_state->render_states[rs];
891  }
892 
893  /* Texture states */
894  for (i = 0; i < stateblock->num_contained_tss_states; ++i)
895  {
896  DWORD stage = stateblock->contained_tss_states[i].stage;
897  DWORD state = stateblock->contained_tss_states[i].state;
898 
899  TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, state,
900  src_state->texture_states[stage][state], stateblock->state.texture_states[stage][state]);
901 
902  stateblock->state.texture_states[stage][state] = src_state->texture_states[stage][state];
903  }
904 
905  /* Samplers */
906  map = stateblock->changed.textures;
907  for (i = 0; map; map >>= 1, ++i)
908  {
909  if (!(map & 1)) continue;
910 
911  TRACE("Updating texture %u to %p (was %p).\n",
912  i, src_state->textures[i], stateblock->state.textures[i]);
913 
914  if (src_state->textures[i])
915  wined3d_texture_incref(src_state->textures[i]);
916  if (stateblock->state.textures[i])
917  wined3d_texture_decref(stateblock->state.textures[i]);
918  stateblock->state.textures[i] = src_state->textures[i];
919  }
920 
921  for (i = 0; i < stateblock->num_contained_sampler_states; ++i)
922  {
923  DWORD stage = stateblock->contained_sampler_states[i].stage;
924  DWORD state = stateblock->contained_sampler_states[i].state;
925 
926  TRACE("Updating sampler state %u, %u to %#x (was %#x).\n", stage, state,
927  src_state->sampler_states[stage][state], stateblock->state.sampler_states[stage][state]);
928 
929  stateblock->state.sampler_states[stage][state] = src_state->sampler_states[stage][state];
930  }
931 
932  if (stateblock->changed.pixelShader && stateblock->state.shader[WINED3D_SHADER_TYPE_PIXEL]
933  != src_state->shader[WINED3D_SHADER_TYPE_PIXEL])
934  {
935  if (src_state->shader[WINED3D_SHADER_TYPE_PIXEL])
937  if (stateblock->state.shader[WINED3D_SHADER_TYPE_PIXEL])
939  stateblock->state.shader[WINED3D_SHADER_TYPE_PIXEL] = src_state->shader[WINED3D_SHADER_TYPE_PIXEL];
940  }
941 
942  wined3d_state_record_lights(&stateblock->state, src_state);
943 
944  TRACE("Capture done.\n");
945 }
unsigned int num_contained_ps_consts_f
unsigned int num_contained_tss_states
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE+1]
DWORD contained_transform_states[HIGHEST_TRANSFORMSTATE+1]
const char * debug_ivec4(const struct wined3d_ivec4 *v)
Definition: utils.c:3949
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F]
struct wined3d_state state
struct wined3d_saved_states changed
struct wined3d_vertex_declaration * vertex_declaration
struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F]
DWORD contained_vs_consts_b[WINED3D_MAX_CONSTS_B]
struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I]
struct wined3d_texture * textures[MAX_COMBINED_SAMPLERS]
struct StageState contained_sampler_states[MAX_COMBINED_SAMPLERS *WINED3D_HIGHEST_SAMPLER_STATE]
DWORD contained_ps_consts_i[WINED3D_MAX_CONSTS_I]
static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state)
Definition: stateblock.c:627
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE+1]
unsigned int num_contained_ps_consts_i
unsigned int num_contained_vs_consts_f
const char * debug_vec4(const struct wined3d_vec4 *v)
Definition: utils.c:3965
struct wined3d_buffer * index_buffer
wined3d_render_state
Definition: wined3d.h:263
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
Definition: buffer.c:525
DWORD contained_vs_consts_i[WINED3D_MAX_CONSTS_I]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int num_contained_vs_consts_i
struct wined3d_shader * shader[WINED3D_SHADER_TYPE_COUNT]
unsigned int idx
Definition: utils.c:41
struct wined3d_viewport viewport
struct wined3d_stream_state streams[MAX_STREAMS+1]
struct wined3d_material material
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
Definition: shader.c:3364
unsigned int num_contained_render_states
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
#define TRACE(s)
Definition: solgame.cpp:4
DWORD contained_ps_consts_f[WINED3D_MAX_PS_CONSTS_F]
struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES]
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F]
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE+1]
Definition: _map.h:44
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]
unsigned int num_contained_ps_consts_b
static int state
Definition: maze.c:121
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B]
ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader)
Definition: shader.c:3339
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I]
enum wined3d_format_id index_format
struct wined3d_device * device
unsigned int num_contained_sampler_states
wined3d_transform_state
Definition: wined3d.h:646
DWORD contained_ps_consts_b[WINED3D_MAX_CONSTS_B]
unsigned int num_contained_transform_states
GLuint GLenum GLenum transform
Definition: glext.h:9407
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
struct StageState contained_tss_states[MAX_TEXTURES *(WINED3D_HIGHEST_TEXTURE_STATE+1)]
unsigned int index_offset
DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE+1]
DWORD render_states[WINEHIGHEST_RENDER_STATE+1]
ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration)
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:994
unsigned int num_contained_vs_consts_b
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
Definition: glfuncs.h:262

Referenced by d3d8_device_CaptureStateBlock(), d3d9_stateblock_Capture(), d3d_device7_CaptureStateBlock(), ddraw_set_cooperative_level(), and stateblock_init().

◆ wined3d_stateblock_create()

HRESULT CDECL wined3d_stateblock_create ( struct wined3d_device device,
enum wined3d_stateblock_type  type,
struct wined3d_stateblock **  stateblock 
)

Definition at line 1372 of file stateblock.c.

1374 {
1375  struct wined3d_stateblock *object;
1376  HRESULT hr;
1377 
1378  TRACE("device %p, type %#x, stateblock %p.\n",
1379  device, type, stateblock);
1380 
1381  if (!(object = heap_alloc_zero(sizeof(*object))))
1382  return E_OUTOFMEMORY;
1383 
1384  hr = stateblock_init(object, device, type);
1385  if (FAILED(hr))
1386  {
1387  WARN("Failed to initialize stateblock, hr %#x.\n", hr);
1388  heap_free(object);
1389  return hr;
1390  }
1391 
1392  TRACE("Created stateblock %p.\n", object);
1393  *stateblock = object;
1394 
1395  return WINED3D_OK;
1396 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
HRESULT stateblock_init(struct d3d9_stateblock *stateblock, struct d3d9_device *device, D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock)
Definition: stateblock.c:134
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_OK
Definition: wined3d.h:37
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by d3d8_device_CreateStateBlock(), d3d_device7_CreateStateBlock(), ddraw_set_cooperative_level(), stateblock_init(), and wined3d_device_begin_stateblock().

◆ wined3d_stateblock_decref()

ULONG CDECL wined3d_stateblock_decref ( struct wined3d_stateblock stateblock)

Definition at line 552 of file stateblock.c.

553 {
554  ULONG refcount = InterlockedDecrement(&stateblock->ref);
555 
556  TRACE("%p decreasing refcount to %u\n", stateblock, refcount);
557 
558  if (!refcount)
559  {
560  state_cleanup(&stateblock->state);
561  heap_free(stateblock);
562  }
563 
564  return refcount;
565 }
struct wined3d_state state
void state_cleanup(struct wined3d_state *state)
Definition: stateblock.c:528
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by d3d8_device_CreateStateBlock(), d3d8_device_DeleteStateBlock(), d3d8_device_EndStateBlock(), d3d9_device_EndStateBlock(), d3d9_stateblock_Release(), d3d_device7_CreateStateBlock(), d3d_device7_DeleteStateBlock(), d3d_device7_EndStateBlock(), ddraw_set_cooperative_level(), wined3d_device_decref(), and wined3d_device_reset().

◆ wined3d_stateblock_incref()

ULONG CDECL wined3d_stateblock_incref ( struct wined3d_stateblock stateblock)

Definition at line 420 of file stateblock.c.

421 {
422  ULONG refcount = InterlockedIncrement(&stateblock->ref);
423 
424  TRACE("%p increasing refcount to %u.\n", stateblock, refcount);
425 
426  return refcount;
427 }
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

Variable Documentation

◆ pixel_states_render

const DWORD pixel_states_render[]
static

Definition at line 31 of file stateblock.c.

Referenced by stateblock_savedstates_set_pixel().

◆ pixel_states_sampler

◆ pixel_states_texture

◆ vertex_states_render

const DWORD vertex_states_render[]
static

Definition at line 137 of file stateblock.c.

Referenced by stateblock_savedstates_set_vertex().

◆ vertex_states_sampler

const DWORD vertex_states_sampler[]
static
Initial value:

Definition at line 192 of file stateblock.c.

Referenced by stateblock_savedstates_set_vertex().

◆ vertex_states_texture