Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 215 ++++++++------------------------------ 1 file changed, 45 insertions(+), 170 deletions(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 208a1f0606..70943afdda 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -989,142 +989,83 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock, void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, struct wined3d_stateblock *device_state) { - struct wined3d_stateblock_state *state = &device_state->stateblock_state; - struct wined3d_device *device = stateblock->device; - struct wined3d_blend_state *blend_state; - struct wined3d_color colour; + const struct wined3d_stateblock_state *state = &stateblock->stateblock_state; struct wined3d_range range; unsigned int i, start; - BOOL set_blend_state; DWORD map;
TRACE("stateblock %p, device_state %p.\n", stateblock, device_state);
if (stateblock->changed.vertexShader) - { - if (stateblock->stateblock_state.vs) - wined3d_shader_incref(stateblock->stateblock_state.vs); - if (state->vs) - wined3d_shader_decref(state->vs); - state->vs = stateblock->stateblock_state.vs; - wined3d_device_set_vertex_shader(device, stateblock->stateblock_state.vs); - } + wined3d_stateblock_set_vertex_shader(device_state, state->vs);
for (start = 0; ; start = range.offset + range.size) { if (!wined3d_bitmap_get_range(stateblock->changed.vs_consts_f, WINED3D_MAX_VS_CONSTS_F, start, &range)) break; - - memcpy(&state->vs_consts_f[range.offset], &stateblock->stateblock_state.vs_consts_f[range.offset], - sizeof(*state->vs_consts_f) * range.size); - wined3d_device_set_vs_consts_f(device, range.offset, range.size, - &stateblock->stateblock_state.vs_consts_f[range.offset]); + wined3d_stateblock_set_vs_consts_f(device_state, range.offset, range.size, &state->vs_consts_f[range.offset]); } map = stateblock->changed.vertexShaderConstantsI; for (start = 0; ; start = range.offset + range.size) { if (!wined3d_bitmap_get_range(&map, WINED3D_MAX_CONSTS_I, start, &range)) break; - - memcpy(&state->vs_consts_i[range.offset], &stateblock->stateblock_state.vs_consts_i[range.offset], - sizeof(*state->vs_consts_i) * range.size); - wined3d_device_set_vs_consts_i(device, range.offset, range.size, - &stateblock->stateblock_state.vs_consts_i[range.offset]); + wined3d_stateblock_set_vs_consts_i(device_state, range.offset, range.size, &state->vs_consts_i[range.offset]); } map = stateblock->changed.vertexShaderConstantsB; for (start = 0; ; start = range.offset + range.size) { if (!wined3d_bitmap_get_range(&map, WINED3D_MAX_CONSTS_B, start, &range)) break; - - memcpy(&state->vs_consts_b[range.offset], &stateblock->stateblock_state.vs_consts_b[range.offset], - sizeof(*state->vs_consts_b) * range.size); - wined3d_device_set_vs_consts_b(device, range.offset, range.size, - &stateblock->stateblock_state.vs_consts_b[range.offset]); + wined3d_stateblock_set_vs_consts_b(device_state, range.offset, range.size, &state->vs_consts_b[range.offset]); }
if (stateblock->changed.lights) { - for (i = 0; i < ARRAY_SIZE(stateblock->stateblock_state.light_state->light_map); ++i) + for (i = 0; i < ARRAY_SIZE(state->light_state->light_map); ++i) { const struct wined3d_light_info *light; - struct wined3d_light_info *new_light;
- LIST_FOR_EACH_ENTRY(light, &stateblock->stateblock_state.light_state->light_map[i], struct wined3d_light_info, entry) + LIST_FOR_EACH_ENTRY(light, &state->light_state->light_map[i], struct wined3d_light_info, entry) { - if (SUCCEEDED(wined3d_light_state_set_light(state->light_state, light->OriginalIndex, - &light->OriginalParms, &new_light))) - { - wined3d_light_state_enable_light(state->light_state, &device->adapter->d3d_info, new_light, light->glIndex != -1); - } - wined3d_device_set_light(device, light->OriginalIndex, &light->OriginalParms); - wined3d_device_set_light_enable(device, light->OriginalIndex, light->glIndex != -1); + wined3d_stateblock_set_light(device_state, light->OriginalIndex, &light->OriginalParms); + wined3d_stateblock_set_light_enable(device_state, light->OriginalIndex, light->glIndex != -1); } } }
if (stateblock->changed.pixelShader) - { - if (stateblock->stateblock_state.ps) - wined3d_shader_incref(stateblock->stateblock_state.ps); - if (state->ps) - wined3d_shader_decref(state->ps); - state->ps = stateblock->stateblock_state.ps; - wined3d_device_set_pixel_shader(device, stateblock->stateblock_state.ps); - } + wined3d_stateblock_set_pixel_shader(device_state, state->ps);
for (start = 0; ; start = range.offset + range.size) { if (!wined3d_bitmap_get_range(stateblock->changed.ps_consts_f, WINED3D_MAX_PS_CONSTS_F, start, &range)) break; - - memcpy(&state->ps_consts_f[range.offset], &stateblock->stateblock_state.ps_consts_f[range.offset], - sizeof(*state->ps_consts_f) * range.size); - wined3d_device_set_ps_consts_f(device, range.offset, range.size, - &stateblock->stateblock_state.ps_consts_f[range.offset]); + wined3d_stateblock_set_ps_consts_f(device_state, range.offset, range.size, &state->ps_consts_f[range.offset]); } map = stateblock->changed.pixelShaderConstantsI; for (start = 0; ; start = range.offset + range.size) { if (!wined3d_bitmap_get_range(&map, WINED3D_MAX_CONSTS_I, start, &range)) break; - - memcpy(&state->ps_consts_i[range.offset], &stateblock->stateblock_state.ps_consts_i[range.offset], - sizeof(*state->ps_consts_i) * range.size); - wined3d_device_set_ps_consts_i(device, range.offset, range.size, - &stateblock->stateblock_state.ps_consts_i[range.offset]); + wined3d_stateblock_set_ps_consts_i(device_state, range.offset, range.size, &state->ps_consts_i[range.offset]); } map = stateblock->changed.pixelShaderConstantsB; for (start = 0; ; start = range.offset + range.size) { if (!wined3d_bitmap_get_range(&map, WINED3D_MAX_CONSTS_B, start, &range)) break; - - memcpy(&state->ps_consts_b[range.offset], &stateblock->stateblock_state.ps_consts_b[range.offset], - sizeof(*state->ps_consts_b) * range.size); - wined3d_device_set_ps_consts_b(device, range.offset, range.size, - &stateblock->stateblock_state.ps_consts_b[range.offset]); + wined3d_stateblock_set_ps_consts_b(device_state, range.offset, range.size, &state->ps_consts_b[range.offset]); }
- if ((set_blend_state = stateblock->changed.blend_state - || wined3d_bitmap_is_set(stateblock->changed.renderState, WINED3D_RS_ADAPTIVETESS_Y))) + if (stateblock->changed.blend_state) { - blend_state = stateblock->stateblock_state.rs[WINED3D_RS_ADAPTIVETESS_Y] == WINED3DFMT_ATOC - ? device->blend_state_atoc_enabled : stateblock->stateblock_state.blend_state; - - if (blend_state) - wined3d_blend_state_incref(blend_state); if (state->blend_state) - wined3d_blend_state_decref(state->blend_state); - - state->blend_state = blend_state; - - if (wined3d_bitmap_is_set(stateblock->changed.renderState, WINED3D_RS_BLENDFACTOR)) - wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]); - else - wined3d_device_get_blend_state(device, &colour); - - wined3d_device_set_blend_state(device, blend_state, &colour); + wined3d_blend_state_incref(state->blend_state); + if (device_state->stateblock_state.blend_state) + wined3d_blend_state_decref(device_state->stateblock_state.blend_state); + device_state->stateblock_state.blend_state = state->blend_state; + device_state->changed.blend_state = 1; }
/* Render states. */ @@ -1132,19 +1073,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, { enum wined3d_render_state rs = stateblock->contained_render_states[i];
- state->rs[rs] = stateblock->stateblock_state.rs[rs]; - if (rs != WINED3D_RS_BLENDFACTOR) - { - wined3d_device_set_render_state(device, rs, stateblock->stateblock_state.rs[rs]); - continue; - } - - if (!set_blend_state) - { - blend_state = wined3d_device_get_blend_state(device, &colour); - wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[rs]); - wined3d_device_set_blend_state(device, blend_state, &colour); - } + wined3d_stateblock_set_render_state(device_state, rs, state->rs[rs]); }
/* Texture states. */ @@ -1153,9 +1082,8 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, DWORD stage = stateblock->contained_tss_states[i].stage; DWORD texture_state = stateblock->contained_tss_states[i].state;
- state->texture_states[stage][texture_state] = stateblock->stateblock_state.texture_states[stage][texture_state]; - wined3d_device_set_texture_stage_state(device, stage, texture_state, - stateblock->stateblock_state.texture_states[stage][texture_state]); + wined3d_stateblock_set_texture_stage_state(device_state, stage, texture_state, + state->texture_states[stage][texture_state]); }
/* Sampler states. */ @@ -1163,11 +1091,10 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, { DWORD stage = stateblock->contained_sampler_states[i].stage; DWORD sampler_state = stateblock->contained_sampler_states[i].state; - DWORD value = stateblock->stateblock_state.sampler_states[stage][sampler_state];
- state->sampler_states[stage][sampler_state] = value; if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS; - wined3d_device_set_sampler_state(device, stage, sampler_state, value); + wined3d_stateblock_set_sampler_state(device_state, stage, sampler_state, + state->sampler_states[stage][sampler_state]); }
if (stateblock->changed.transforms) @@ -1176,113 +1103,61 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, { enum wined3d_transform_state transform = stateblock->contained_transform_states[i];
- state->transforms[transform] = stateblock->stateblock_state.transforms[transform]; - wined3d_device_set_transform(device, transform, &stateblock->stateblock_state.transforms[transform]); + wined3d_stateblock_set_transform(device_state, transform, &state->transforms[transform]); } }
if (stateblock->changed.indices) { - if (stateblock->stateblock_state.index_buffer) - wined3d_buffer_incref(stateblock->stateblock_state.index_buffer); - if (state->index_buffer) - wined3d_buffer_decref(state->index_buffer); - state->index_buffer = stateblock->stateblock_state.index_buffer; - state->index_format = stateblock->stateblock_state.index_format; - state->base_vertex_index = stateblock->stateblock_state.base_vertex_index; - - wined3d_device_set_index_buffer(device, stateblock->stateblock_state.index_buffer, - stateblock->stateblock_state.index_format, 0); - wined3d_device_set_base_vertex_index(device, stateblock->stateblock_state.base_vertex_index); + wined3d_stateblock_set_index_buffer(device_state, state->index_buffer, state->index_format); + wined3d_stateblock_set_base_vertex_index(device_state, state->base_vertex_index); }
- if (stateblock->changed.vertexDecl && stateblock->stateblock_state.vertex_declaration) - { - if (stateblock->stateblock_state.vertex_declaration) - wined3d_vertex_declaration_incref(stateblock->stateblock_state.vertex_declaration); - if (state->vertex_declaration) - wined3d_vertex_declaration_decref(state->vertex_declaration); - state->vertex_declaration = stateblock->stateblock_state.vertex_declaration; - wined3d_device_set_vertex_declaration(device, stateblock->stateblock_state.vertex_declaration); - } + if (stateblock->changed.vertexDecl && state->vertex_declaration) + wined3d_stateblock_set_vertex_declaration(device_state, state->vertex_declaration);
if (stateblock->changed.material) - { - state->material = stateblock->stateblock_state.material; - wined3d_device_set_material(device, &stateblock->stateblock_state.material); - } + wined3d_stateblock_set_material(device_state, &state->material);
if (stateblock->changed.viewport) - { - state->viewport = stateblock->stateblock_state.viewport; - - wined3d_device_set_viewports(device, 1, &stateblock->stateblock_state.viewport); - } + wined3d_stateblock_set_viewport(device_state, &state->viewport);
if (stateblock->changed.scissorRect) - { - state->scissor_rect = stateblock->stateblock_state.scissor_rect; - - wined3d_device_set_scissor_rects(device, 1, &stateblock->stateblock_state.scissor_rect); - } + wined3d_stateblock_set_scissor_rect(device_state, &state->scissor_rect);
map = stateblock->changed.streamSource; for (i = 0; map; map >>= 1, ++i) { - unsigned int offset, stride; - - if (!(map & 1)) continue; - - if (stateblock->stateblock_state.streams[i].buffer) - wined3d_buffer_incref(stateblock->stateblock_state.streams[i].buffer); - if (state->streams[i].buffer) - wined3d_buffer_decref(state->streams[i].buffer); - state->streams[i].buffer = stateblock->stateblock_state.streams[i].buffer; - - offset = stateblock->stateblock_state.streams[i].offset; - stride = stateblock->stateblock_state.streams[i].stride; - - state->streams[i].stride = stride; - state->streams[i].offset = offset; - wined3d_device_set_stream_source(device, i, - stateblock->stateblock_state.streams[i].buffer, offset, stride); + if (map & 1) + wined3d_stateblock_set_stream_source(device_state, i, state->streams[i].buffer, + state->streams[i].offset, state->streams[i].stride); }
map = stateblock->changed.streamFreq; for (i = 0; map; map >>= 1, ++i) { - if (!(map & 1)) continue; - - state->streams[i].frequency = stateblock->stateblock_state.streams[i].frequency; - state->streams[i].flags = stateblock->stateblock_state.streams[i].flags; - - wined3d_device_set_stream_source_freq(device, i, - stateblock->stateblock_state.streams[i].frequency | stateblock->stateblock_state.streams[i].flags); + if (map & 1) + wined3d_stateblock_set_stream_source_freq(device_state, i, + state->streams[i].frequency | state->streams[i].flags); }
map = stateblock->changed.textures; for (i = 0; map; map >>= 1, ++i) { - DWORD stage; + DWORD stage = i;
- if (!(map & 1)) continue; + if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS) + stage += WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS;
- stage = i < WINED3D_MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - WINED3D_MAX_FRAGMENT_SAMPLERS; - if (stateblock->stateblock_state.textures[i]) - wined3d_texture_incref(stateblock->stateblock_state.textures[i]); - if (state->textures[i]) - wined3d_texture_decref(state->textures[i]); - state->textures[i] = stateblock->stateblock_state.textures[i]; - wined3d_device_set_texture(device, stage, stateblock->stateblock_state.textures[i]); + if (map & 1) + wined3d_stateblock_set_texture(device_state, stage, state->textures[i]); }
map = stateblock->changed.clipplane; for (i = 0; map; map >>= 1, ++i) { - if (!(map & 1)) continue; - - state->clip_planes[i] = stateblock->stateblock_state.clip_planes[i]; - wined3d_device_set_clip_plane(device, i, &stateblock->stateblock_state.clip_planes[i]); + if (map & 1) + wined3d_stateblock_set_clip_plane(device_state, i, &state->clip_planes[i]); }
TRACE("Applied stateblock %p.\n", stateblock);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 250 -------------------------------------- dlls/wined3d/wined3d.spec | 16 --- include/wine/wined3d.h | 28 ----- 3 files changed, 294 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 99fbf21ada..441601efcb 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1350,21 +1350,6 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_stream_source_freq(const struct wined3d_device *device, - UINT stream_idx, UINT *divider) -{ - const struct wined3d_stream_state *stream; - - TRACE("device %p, stream_idx %u, divider %p.\n", device, stream_idx, divider); - - stream = &device->state.streams[stream_idx]; - *divider = stream->flags | stream->frequency; - - TRACE("Returning %#x.\n", *divider); - - return WINED3D_OK; -} - void CDECL wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix) { @@ -1399,26 +1384,6 @@ void CDECL wined3d_device_get_transform(const struct wined3d_device *device, *matrix = device->state.transforms[state]; }
-void CDECL wined3d_device_multiply_transform(struct wined3d_device *device, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix) -{ - struct wined3d_matrix *mat; - - TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); - - if (state > WINED3D_HIGHEST_TRANSFORM_STATE) - { - WARN("Unhandled transform state %#x.\n", state); - return; - } - - /* Tests show that stateblock recording is ignored; the change goes directly - * into the primary stateblock. */ - mat = &device->state.transforms[state]; - multiply_matrix(mat, mat, matrix); - wined3d_cs_emit_set_transform(device->cs, state, mat); -} - /* Note lights are real special cases. Although the device caps state only * e.g. 8 are supported, you can reference any indexes you want as long as * that number max are enabled at any one point in time. Therefore since the @@ -1558,23 +1523,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_light(const struct wined3d_device *device, - UINT light_idx, struct wined3d_light *light) -{ - struct wined3d_light_info *light_info; - - TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light); - - if (!(light_info = wined3d_light_state_get_light(&device->state.light_state, light_idx))) - { - TRACE("Light information requested but light not defined\n"); - return WINED3DERR_INVALIDCALL; - } - - *light = light_info->OriginalParms; - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable) { struct wined3d_light_info *light_info; @@ -1600,22 +1548,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable) -{ - struct wined3d_light_info *light_info; - - TRACE("device %p, light_idx %u, enable %p.\n", device, light_idx, enable); - - if (!(light_info = wined3d_light_state_get_light(&device->state.light_state, light_idx))) - { - TRACE("Light enabled state requested but light not defined.\n"); - return WINED3DERR_INVALIDCALL; - } - /* true is 128 according to SetLightEnable */ - *enable = light_info->enabled ? 128 : 0; - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane) { @@ -1640,22 +1572,6 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device, - UINT plane_idx, struct wined3d_vec4 *plane) -{ - TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane); - - if (plane_idx >= device->adapter->d3d_info.limits.max_clip_distances) - { - TRACE("Application has requested clipplane this device doesn't support.\n"); - return WINED3DERR_INVALIDCALL; - } - - *plane = device->state.clip_planes[plane_idx]; - - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_clip_status(struct wined3d_device *device, const struct wined3d_clip_status *clip_status) { @@ -1686,19 +1602,6 @@ void CDECL wined3d_device_set_material(struct wined3d_device *device, const stru wined3d_cs_emit_set_material(device->cs, material); }
-void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material) -{ - TRACE("device %p, material %p.\n", device, material); - - *material = device->state.material; - - TRACE("diffuse %s\n", debug_color(&material->diffuse)); - TRACE("ambient %s\n", debug_color(&material->ambient)); - TRACE("specular %s\n", debug_color(&material->specular)); - TRACE("emissive %s\n", debug_color(&material->emissive)); - TRACE("power %.8e.\n", material->power); -} - void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset) { @@ -1744,13 +1647,6 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I device->state.base_vertex_index = base_index; }
-INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device) -{ - TRACE("device %p.\n", device); - - return device->state.base_vertex_index; -} - void CDECL wined3d_device_set_viewports(struct wined3d_device *device, unsigned int viewport_count, const struct wined3d_viewport *viewports) { @@ -1922,24 +1818,6 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, wined3d_cs_emit_set_sampler_state(device->cs, sampler_idx, state, value); }
-DWORD CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device, - UINT sampler_idx, enum wined3d_sampler_state state) -{ - TRACE("device %p, sampler_idx %u, state %s.\n", - device, sampler_idx, debug_d3dsamplerstate(state)); - - if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) - sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS); - - if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states)) - { - WARN("Invalid sampler %u.\n", sampler_idx); - return 0; /* Windows accepts overflowing this array ... we do not. */ - } - - return device->state.sampler_states[sampler_idx][state]; -} - void CDECL wined3d_device_set_scissor_rects(struct wined3d_device *device, unsigned int rect_count, const RECT *rects) { @@ -2208,22 +2086,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_vs_consts_b(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, BOOL *constants) -{ - TRACE("device %p, start_idx %u, count %u, constants %p.\n", - device, start_idx, count, constants); - - if (!constants || start_idx >= WINED3D_MAX_CONSTS_B) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_B - start_idx) - count = WINED3D_MAX_CONSTS_B - start_idx; - memcpy(constants, &device->state.vs_consts_b[start_idx], count * sizeof(*constants)); - - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants) { @@ -2250,21 +2112,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_vs_consts_i(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_ivec4 *constants) -{ - TRACE("device %p, start_idx %u, count %u, constants %p.\n", - device, start_idx, count, constants); - - if (!constants || start_idx >= WINED3D_MAX_CONSTS_I) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_I - start_idx) - count = WINED3D_MAX_CONSTS_I - start_idx; - memcpy(constants, &device->state.vs_consts_i[start_idx], count * sizeof(*constants)); - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants) { @@ -2290,23 +2137,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants) -{ - const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; - - TRACE("device %p, start_idx %u, count %u, constants %p.\n", - device, start_idx, count, constants); - - if (!constants || start_idx >= d3d_info->limits.vs_uniform_count - || count > d3d_info->limits.vs_uniform_count - start_idx) - return WINED3DERR_INVALIDCALL; - - memcpy(constants, &device->state.vs_consts_f[start_idx], count * sizeof(*constants)); - - return WINED3D_OK; -} - void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader) { struct wined3d_shader *prev = device->state.shader[WINED3D_SHADER_TYPE_PIXEL]; @@ -2387,22 +2217,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_ps_consts_b(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, BOOL *constants) -{ - TRACE("device %p, start_idx %u, count %u,constants %p.\n", - device, start_idx, count, constants); - - if (!constants || start_idx >= WINED3D_MAX_CONSTS_B) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_B - start_idx) - count = WINED3D_MAX_CONSTS_B - start_idx; - memcpy(constants, &device->state.ps_consts_b[start_idx], count * sizeof(*constants)); - - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants) { @@ -2429,22 +2243,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_ps_consts_i(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_ivec4 *constants) -{ - TRACE("device %p, start_idx %u, count %u, constants %p.\n", - device, start_idx, count, constants); - - if (!constants || start_idx >= WINED3D_MAX_CONSTS_I) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_I - start_idx) - count = WINED3D_MAX_CONSTS_I - start_idx; - memcpy(constants, &device->state.ps_consts_i[start_idx], count * sizeof(*constants)); - - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants) { @@ -2470,23 +2268,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, return WINED3D_OK; }
-HRESULT CDECL wined3d_device_get_ps_consts_f(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants) -{ - const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; - - TRACE("device %p, start_idx %u, count %u, constants %p.\n", - device, start_idx, count, constants); - - if (!constants || start_idx >= d3d_info->limits.ps_uniform_count - || count > d3d_info->limits.ps_uniform_count - start_idx) - return WINED3DERR_INVALIDCALL; - - memcpy(constants, &device->state.ps_consts_f[start_idx], count * sizeof(*constants)); - - return WINED3D_OK; -} - void CDECL wined3d_device_set_hull_shader(struct wined3d_device *device, struct wined3d_shader *shader) { struct wined3d_shader *prev; @@ -3763,21 +3544,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, wined3d_cs_emit_set_texture_state(device->cs, stage, state, value); }
-DWORD CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *device, - UINT stage, enum wined3d_texture_stage_state state) -{ - TRACE("device %p, stage %u, state %s.\n", - device, stage, debug_d3dtexturestate(state)); - - if (state > WINED3D_HIGHEST_TEXTURE_STATE) - { - WARN("Invalid state %#x passed.\n", state); - return 0; - } - - return device->state.texture_states[stage][state]; -} - void CDECL wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture) { @@ -3816,22 +3582,6 @@ void CDECL wined3d_device_set_texture(struct wined3d_device *device, return; }
-struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_device *device, UINT stage) -{ - TRACE("device %p, stage %u.\n", device, stage); - - if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) - stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS); - - if (stage >= ARRAY_SIZE(device->state.textures)) - { - WARN("Ignoring invalid stage %u.\n", stage); - return NULL; /* Windows accepts overflowing this array ... we do not. */ - } - - return device->state.textures[stage]; -} - void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_stateblock *stateblock) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index b2f88039fa..c891c44608 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -61,9 +61,7 @@ @ cdecl wined3d_device_end_scene(ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) -@ cdecl wined3d_device_get_base_vertex_index(ptr) @ cdecl wined3d_device_get_blend_state(ptr ptr) -@ cdecl wined3d_device_get_clip_plane(ptr long ptr) @ cdecl wined3d_device_get_clip_status(ptr ptr) @ cdecl wined3d_device_get_compute_shader(ptr) @ cdecl wined3d_device_get_constant_buffer(ptr long long) @@ -86,46 +84,32 @@ @ cdecl wined3d_device_get_hs_sampler(ptr long) @ cdecl wined3d_device_get_hull_shader(ptr) @ cdecl wined3d_device_get_index_buffer(ptr ptr ptr) -@ cdecl wined3d_device_get_light(ptr long ptr) -@ cdecl wined3d_device_get_light_enable(ptr long ptr) -@ cdecl wined3d_device_get_material(ptr ptr) @ cdecl wined3d_device_get_max_frame_latency(ptr) @ cdecl wined3d_device_get_npatch_mode(ptr) @ cdecl wined3d_device_get_pixel_shader(ptr) @ cdecl wined3d_device_get_predication(ptr ptr) @ cdecl wined3d_device_get_primitive_type(ptr ptr ptr) -@ cdecl wined3d_device_get_ps_consts_b(ptr long long ptr) -@ cdecl wined3d_device_get_ps_consts_f(ptr long long ptr) -@ cdecl wined3d_device_get_ps_consts_i(ptr long long ptr) @ cdecl wined3d_device_get_ps_resource_view(ptr long) @ cdecl wined3d_device_get_ps_sampler(ptr long) @ cdecl wined3d_device_get_raster_status(ptr long ptr) @ cdecl wined3d_device_get_rasterizer_state(ptr) @ cdecl wined3d_device_get_render_state(ptr long) @ cdecl wined3d_device_get_rendertarget_view(ptr long) -@ cdecl wined3d_device_get_sampler_state(ptr long long) @ cdecl wined3d_device_get_scissor_rects(ptr ptr ptr) @ cdecl wined3d_device_get_software_vertex_processing(ptr) @ cdecl wined3d_device_get_stream_output(ptr long ptr) @ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr) -@ cdecl wined3d_device_get_stream_source_freq(ptr long ptr) @ cdecl wined3d_device_get_swapchain(ptr long) @ cdecl wined3d_device_get_swapchain_count(ptr) -@ cdecl wined3d_device_get_texture(ptr long) -@ cdecl wined3d_device_get_texture_stage_state(ptr long long) @ cdecl wined3d_device_get_transform(ptr long ptr) @ cdecl wined3d_device_get_unordered_access_view(ptr long) @ cdecl wined3d_device_get_vertex_declaration(ptr) @ cdecl wined3d_device_get_vertex_shader(ptr) @ cdecl wined3d_device_get_viewports(ptr ptr ptr) -@ cdecl wined3d_device_get_vs_consts_b(ptr long long ptr) -@ cdecl wined3d_device_get_vs_consts_f(ptr long long ptr) -@ cdecl wined3d_device_get_vs_consts_i(ptr long long ptr) @ cdecl wined3d_device_get_vs_resource_view(ptr long) @ cdecl wined3d_device_get_vs_sampler(ptr long) @ cdecl wined3d_device_get_wined3d(ptr) @ cdecl wined3d_device_incref(ptr) -@ cdecl wined3d_device_multiply_transform(ptr long ptr) @ cdecl wined3d_device_process_vertices(ptr long long long ptr ptr long long) @ cdecl wined3d_device_release_focus_window(ptr) @ cdecl wined3d_device_reset(ptr ptr ptr ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index bc09f969be..b724424bce 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2338,11 +2338,8 @@ void __cdecl wined3d_device_draw_primitive_instanced_indirect(struct wined3d_dev HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); UINT __cdecl wined3d_device_get_available_texture_mem(const struct wined3d_device *device); -INT __cdecl wined3d_device_get_base_vertex_index(const struct wined3d_device *device); struct wined3d_blend_state * __cdecl wined3d_device_get_blend_state(const struct wined3d_device *device, struct wined3d_color *blend_factor); -HRESULT __cdecl wined3d_device_get_clip_plane(const struct wined3d_device *device, - UINT plane_idx, struct wined3d_vec4 *plane); HRESULT __cdecl wined3d_device_get_clip_status(const struct wined3d_device *device, struct wined3d_clip_status *clip_status); struct wined3d_shader * __cdecl wined3d_device_get_compute_shader(const struct wined3d_device *device); @@ -2376,22 +2373,12 @@ struct wined3d_sampler * __cdecl wined3d_device_get_hs_sampler(const struct wine struct wined3d_shader * __cdecl wined3d_device_get_hull_shader(const struct wined3d_device *device); struct wined3d_buffer * __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device, enum wined3d_format_id *format, unsigned int *offset); -HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device, - UINT light_idx, struct wined3d_light *light); -HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable); -void __cdecl wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material); unsigned int __cdecl wined3d_device_get_max_frame_latency(const struct wined3d_device *device); float __cdecl wined3d_device_get_npatch_mode(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device); struct wined3d_query * __cdecl wined3d_device_get_predication(struct wined3d_device *device, BOOL *value); void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device, enum wined3d_primitive_type *primitive_topology, unsigned int *patch_vertex_count); -HRESULT __cdecl wined3d_device_get_ps_consts_b(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, BOOL *constants); -HRESULT __cdecl wined3d_device_get_ps_consts_f(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants); -HRESULT __cdecl wined3d_device_get_ps_consts_i(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_ivec4 *constants); struct wined3d_shader_resource_view * __cdecl wined3d_device_get_ps_resource_view(const struct wined3d_device *device, UINT idx); struct wined3d_sampler * __cdecl wined3d_device_get_ps_sampler(const struct wined3d_device *device, UINT idx); @@ -2401,8 +2388,6 @@ struct wined3d_rasterizer_state * __cdecl wined3d_device_get_rasterizer_state(st DWORD __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state); struct wined3d_rendertarget_view * __cdecl wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx); -DWORD __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *device, - UINT sampler_idx, enum wined3d_sampler_state state); void __cdecl wined3d_device_get_scissor_rects(const struct wined3d_device *device, unsigned int *rect_count, RECT *rect); BOOL __cdecl wined3d_device_get_software_vertex_processing(const struct wined3d_device *device); @@ -2410,14 +2395,9 @@ struct wined3d_buffer * __cdecl wined3d_device_get_stream_output(struct wined3d_ UINT idx, UINT *offset); HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride); -HRESULT __cdecl wined3d_device_get_stream_source_freq(const struct wined3d_device *device, - UINT stream_idx, UINT *divider); struct wined3d_swapchain * __cdecl wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx); UINT __cdecl wined3d_device_get_swapchain_count(const struct wined3d_device *device); -struct wined3d_texture * __cdecl wined3d_device_get_texture(const struct wined3d_device *device, UINT stage); -DWORD __cdecl wined3d_device_get_texture_stage_state(const struct wined3d_device *device, - UINT stage, enum wined3d_texture_stage_state state); void __cdecl wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix); struct wined3d_unordered_access_view * __cdecl wined3d_device_get_unordered_access_view( @@ -2426,19 +2406,11 @@ struct wined3d_vertex_declaration * __cdecl wined3d_device_get_vertex_declaratio struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(const struct wined3d_device *device); void __cdecl wined3d_device_get_viewports(const struct wined3d_device *device, unsigned int *viewport_count, struct wined3d_viewport *viewports); -HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, BOOL *constants); -HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants); -HRESULT __cdecl wined3d_device_get_vs_consts_i(const struct wined3d_device *device, - unsigned int start_idx, unsigned int count, struct wined3d_ivec4 *constants); struct wined3d_shader_resource_view * __cdecl wined3d_device_get_vs_resource_view(const struct wined3d_device *device, UINT idx); struct wined3d_sampler * __cdecl wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx); struct wined3d * __cdecl wined3d_device_get_wined3d(const struct wined3d_device *device); ULONG __cdecl wined3d_device_incref(struct wined3d_device *device); -void __cdecl wined3d_device_multiply_transform(struct wined3d_device *device, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix); HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 97 +------------------------------------------ 1 file changed, 2 insertions(+), 95 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 441601efcb..4c9f858c95 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1321,23 +1321,6 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic
TRACE("device %p, stream_idx %u, divider %#x.\n", device, stream_idx, divider);
- /* Verify input. At least in d3d9 this is invalid. */ - if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (divider & WINED3DSTREAMSOURCE_INDEXEDDATA)) - { - WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !stream_idx) - { - WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - if (!divider) - { - WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - stream = &device->state.streams[stream_idx]; old_flags = stream->flags; old_freq = stream->frequency; @@ -1395,42 +1378,12 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light) { struct wined3d_light_info *object = NULL; - HRESULT hr; float rho;
TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light);
- /* Check the parameter range. Need for speed most wanted sets junk lights - * which confuse the GL driver. */ - if (!light) - return WINED3DERR_INVALIDCALL; - - switch (light->type) - { - case WINED3D_LIGHT_POINT: - case WINED3D_LIGHT_SPOT: - case WINED3D_LIGHT_GLSPOT: - /* Incorrect attenuation values can cause the gl driver to crash. - * Happens with Need for speed most wanted. */ - if (light->attenuation0 < 0.0f || light->attenuation1 < 0.0f || light->attenuation2 < 0.0f) - { - WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - break; - - case WINED3D_LIGHT_DIRECTIONAL: - case WINED3D_LIGHT_PARALLELPOINT: - /* Ignores attenuation */ - break; - - default: - WARN("Light type out of range, returning WINED3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; - } - - if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object))) - return hr; + if (FAILED(wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object))) + return;
/* Initialize the object. */ TRACE("Light %u setting to type %#x, diffuse %s, specular %s, ambient %s, " @@ -1802,12 +1755,6 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
- if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states)) - { - WARN("Invalid sampler %u.\n", sampler_idx); - return; /* Windows accepts overflowing this array ... we do not. */ - } - if (value == device->state.sampler_states[sampler_idx][state]) { TRACE("Application is setting the old value over, nothing to do.\n"); @@ -2068,12 +2015,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, TRACE("device %p, start_idx %u, count %u, constants %p.\n", device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_B) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_B - start_idx) - count = WINED3D_MAX_CONSTS_B - start_idx; - memcpy(&device->state.vs_consts_b[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { @@ -2094,12 +2035,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, TRACE("device %p, start_idx %u, count %u, constants %p.\n", device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_I) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_I - start_idx) - count = WINED3D_MAX_CONSTS_I - start_idx; - memcpy(&device->state.vs_consts_i[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { @@ -2115,16 +2050,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants) { - const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; unsigned int i;
TRACE("device %p, start_idx %u, count %u, constants %p.\n", device, start_idx, count, constants);
- if (!constants || start_idx >= d3d_info->limits.vs_uniform_count - || count > d3d_info->limits.vs_uniform_count - start_idx) - return WINED3DERR_INVALIDCALL; - memcpy(&device->state.vs_consts_f[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { @@ -2199,12 +2129,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, TRACE("device %p, start_idx %u, count %u, constants %p.\n", device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_B) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_B - start_idx) - count = WINED3D_MAX_CONSTS_B - start_idx; - memcpy(&device->state.ps_consts_b[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { @@ -2225,12 +2149,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, TRACE("device %p, start_idx %u, count %u, constants %p.\n", device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_I) - return WINED3DERR_INVALIDCALL; - - if (count > WINED3D_MAX_CONSTS_I - start_idx) - count = WINED3D_MAX_CONSTS_I - start_idx; - memcpy(&device->state.ps_consts_i[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { @@ -2246,16 +2164,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants) { - const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; unsigned int i;
TRACE("device %p, start_idx %u, count %u, constants %p.\n", device, start_idx, count, constants);
- if (!constants || start_idx >= d3d_info->limits.ps_uniform_count - || count > d3d_info->limits.ps_uniform_count - start_idx) - return WINED3DERR_INVALIDCALL; - memcpy(&device->state.ps_consts_f[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { @@ -3520,12 +3433,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, TRACE("device %p, stage %u, state %s, value %#x.\n", device, stage, debug_d3dtexturestate(state), value);
- if (state > WINED3D_HIGHEST_TEXTURE_STATE) - { - WARN("Invalid state %#x passed.\n", state); - return; - } - if (stage >= d3d_info->limits.ffp_blend_stages) { WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n",
On Wed, 4 Mar 2020 at 03:26, Zebediah Figura z.figura12@gmail.com wrote:
- if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return hr;
- if (FAILED(wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return;
That doesn't look right.
It may also be worth splitting this patch, but that's up to you.
On 3/4/20 9:17 AM, Henri Verbeet wrote:
On Wed, 4 Mar 2020 at 03:26, Zebediah Figura z.figura12@gmail.com wrote:
- if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return hr;
- if (FAILED(wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return;
That doesn't look right.
It may also be worth splitting this patch, but that's up to you.
The reason I did that is because the only remaining callers of wined3d_device_set_light() don't check for errors anymore (and it's not obvious to me that they'd gain anything by doing so.) But I can leave the HRESULT signature if that'd be preferred.
On Wed, 4 Mar 2020 at 20:43, Zebediah Figura z.figura12@gmail.com wrote:
On 3/4/20 9:17 AM, Henri Verbeet wrote:
On Wed, 4 Mar 2020 at 03:26, Zebediah Figura z.figura12@gmail.com wrote:
- if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return hr;
- if (FAILED(wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return;
That doesn't look right.
It may also be worth splitting this patch, but that's up to you.
The reason I did that is because the only remaining callers of wined3d_device_set_light() don't check for errors anymore (and it's not obvious to me that they'd gain anything by doing so.) But I can leave the HRESULT signature if that'd be preferred.
It would be fine to change the return type to void, but this patch doesn't do that.
On 3/4/20 11:15 AM, Henri Verbeet wrote:
On Wed, 4 Mar 2020 at 20:43, Zebediah Figura z.figura12@gmail.com wrote:
On 3/4/20 9:17 AM, Henri Verbeet wrote:
On Wed, 4 Mar 2020 at 03:26, Zebediah Figura z.figura12@gmail.com wrote:
- if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return hr;
- if (FAILED(wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
return;
That doesn't look right.
It may also be worth splitting this patch, but that's up to you.
The reason I did that is because the only remaining callers of wined3d_device_set_light() don't check for errors anymore (and it's not obvious to me that they'd gain anything by doing so.) But I can leave the HRESULT signature if that'd be preferred.
It would be fine to change the return type to void, but this patch doesn't do that.
Ah, whoops, you're right. Looks like a rebasing error on my part.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 58 +++++++++++++-------------------------- dlls/wined3d/wined3d.spec | 16 ----------- include/wine/wined3d.h | 28 ------------------- 3 files changed, 19 insertions(+), 83 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 4c9f858c95..118c99e7f5 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1314,7 +1314,7 @@ HRESULT CDECL wined3d_device_get_stream_source(const struct wined3d_device *devi return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider) +static void wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider) { struct wined3d_stream_state *stream; UINT old_flags, old_freq; @@ -1329,11 +1329,9 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic stream->frequency = divider & 0x7fffff; if (stream->frequency != old_freq || stream->flags != old_flags) wined3d_cs_emit_set_stream_source_freq(device->cs, stream_idx, stream->frequency, stream->flags); - - return WINED3D_OK; }
-void CDECL wined3d_device_set_transform(struct wined3d_device *device, +static void wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix) { TRACE("device %p, state %s, matrix %p.\n", @@ -1359,7 +1357,7 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device, wined3d_cs_emit_set_transform(device->cs, d3dts, matrix); }
-void CDECL wined3d_device_get_transform(const struct wined3d_device *device, +static void wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix) { TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); @@ -1374,7 +1372,7 @@ void CDECL wined3d_device_get_transform(const struct wined3d_device *device, * stateblock problems. When capturing the state block, I duplicate the * hashmap, but when recording, just build a chain pretty much of commands to * be replayed. */ -HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, +static void wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light) { struct wined3d_light_info *object = NULL; @@ -1472,11 +1470,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, }
wined3d_cs_emit_set_light(device->cs, object); - - return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable) +static void wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable) { struct wined3d_light_info *light_info;
@@ -1491,17 +1487,15 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN if (!(light_info = wined3d_light_state_get_light(&device->state.light_state, light_idx))) { FIXME("Adding default lights has failed dismally\n"); - return WINED3DERR_INVALIDCALL; + return; } }
wined3d_light_state_enable_light(&device->state.light_state, &device->adapter->d3d_info, light_info, enable); wined3d_cs_emit_set_light_enable(device->cs, light_idx, enable); - - return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, +static void wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane) { TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane); @@ -1509,20 +1503,18 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, if (plane_idx >= device->adapter->d3d_info.limits.max_clip_distances) { TRACE("Application has requested clipplane this device doesn't support.\n"); - return WINED3DERR_INVALIDCALL; + return; }
if (!memcmp(&device->state.clip_planes[plane_idx], plane, sizeof(*plane))) { TRACE("Application is setting old values over, nothing to do.\n"); - return WINED3D_OK; + return; }
device->state.clip_planes[plane_idx] = *plane;
wined3d_cs_emit_set_clip_plane(device->cs, plane_idx, plane); - - return WINED3D_OK; }
HRESULT CDECL wined3d_device_set_clip_status(struct wined3d_device *device, @@ -1547,7 +1539,7 @@ HRESULT CDECL wined3d_device_get_clip_status(const struct wined3d_device *device return WINED3D_OK; }
-void CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material) +static void wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material) { TRACE("device %p, material %p.\n", device, material);
@@ -1746,7 +1738,7 @@ DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, return device->state.render_states[state]; }
-void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, +static void wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value) { TRACE("device %p, sampler_idx %u, state %s, value %#x.\n", @@ -2007,7 +1999,7 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3 return wined3d_device_get_sampler(device, WINED3D_SHADER_TYPE_VERTEX, idx); }
-HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, +static void wined3d_device_set_vs_consts_b(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants) { unsigned int i; @@ -2023,11 +2015,9 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, }
wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_B, start_idx, count, constants); - - return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, +static void wined3d_device_set_vs_consts_i(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants) { unsigned int i; @@ -2043,11 +2033,9 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, }
wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_I, start_idx, count, constants); - - return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, +static void wined3d_device_set_vs_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants) { unsigned int i; @@ -2063,8 +2051,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, }
wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_F, start_idx, count, constants); - - return WINED3D_OK; }
void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader) @@ -2121,7 +2107,7 @@ struct wined3d_sampler * CDECL wined3d_device_get_ps_sampler(const struct wined3 return wined3d_device_get_sampler(device, WINED3D_SHADER_TYPE_PIXEL, idx); }
-HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, +static void wined3d_device_set_ps_consts_b(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants) { unsigned int i; @@ -2137,11 +2123,9 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, }
wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants); - - return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, +static void wined3d_device_set_ps_consts_i(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants) { unsigned int i; @@ -2157,11 +2141,9 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, }
wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_I, start_idx, count, constants); - - return WINED3D_OK; }
-HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, +static void wined3d_device_set_ps_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants) { unsigned int i; @@ -2177,8 +2159,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, }
wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants); - - return WINED3D_OK; }
void CDECL wined3d_device_set_hull_shader(struct wined3d_device *device, struct wined3d_shader *shader) @@ -3425,7 +3405,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, return hr; }
-void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, +static void wined3d_device_set_texture_stage_state(struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value) { const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; @@ -3451,7 +3431,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, wined3d_cs_emit_set_texture_state(device->cs, stage, state, value); }
-void CDECL wined3d_device_set_texture(struct wined3d_device *device, +static void wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture) { struct wined3d_texture *prev; diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index c891c44608..05aa53dea0 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -101,7 +101,6 @@ @ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr) @ cdecl wined3d_device_get_swapchain(ptr long) @ cdecl wined3d_device_get_swapchain_count(ptr) -@ cdecl wined3d_device_get_transform(ptr long ptr) @ cdecl wined3d_device_get_unordered_access_view(ptr long) @ cdecl wined3d_device_get_vertex_declaration(ptr) @ cdecl wined3d_device_get_vertex_shader(ptr) @@ -116,7 +115,6 @@ @ cdecl wined3d_device_resolve_sub_resource(ptr ptr long ptr long long) @ cdecl wined3d_device_set_base_vertex_index(ptr long) @ cdecl wined3d_device_set_blend_state(ptr ptr ptr) -@ cdecl wined3d_device_set_clip_plane(ptr long ptr) @ cdecl wined3d_device_set_clip_status(ptr ptr) @ cdecl wined3d_device_set_compute_shader(ptr ptr) @ cdecl wined3d_device_set_constant_buffer(ptr long long ptr) @@ -138,39 +136,25 @@ @ cdecl wined3d_device_set_hs_sampler(ptr long ptr) @ cdecl wined3d_device_set_hull_shader(ptr ptr) @ cdecl wined3d_device_set_index_buffer(ptr ptr long long) -@ cdecl wined3d_device_set_light(ptr long ptr) -@ cdecl wined3d_device_set_light_enable(ptr long long) -@ cdecl wined3d_device_set_material(ptr ptr) @ cdecl wined3d_device_set_max_frame_latency(ptr long) @ cdecl wined3d_device_set_multithreaded(ptr) @ cdecl wined3d_device_set_npatch_mode(ptr float) @ cdecl wined3d_device_set_pixel_shader(ptr ptr) @ cdecl wined3d_device_set_predication(ptr ptr long) @ cdecl wined3d_device_set_primitive_type(ptr long long) -@ cdecl wined3d_device_set_ps_consts_b(ptr long long ptr) -@ cdecl wined3d_device_set_ps_consts_f(ptr long long ptr) -@ cdecl wined3d_device_set_ps_consts_i(ptr long long ptr) @ cdecl wined3d_device_set_ps_resource_view(ptr long ptr) @ cdecl wined3d_device_set_ps_sampler(ptr long ptr) @ cdecl wined3d_device_set_rasterizer_state(ptr ptr) @ cdecl wined3d_device_set_render_state(ptr long long) @ cdecl wined3d_device_set_rendertarget_view(ptr long ptr long) -@ cdecl wined3d_device_set_sampler_state(ptr long long long) @ cdecl wined3d_device_set_scissor_rects(ptr long ptr) @ cdecl wined3d_device_set_software_vertex_processing(ptr long) @ cdecl wined3d_device_set_stream_output(ptr long ptr long) @ cdecl wined3d_device_set_stream_source(ptr long ptr long long) -@ cdecl wined3d_device_set_stream_source_freq(ptr long long) -@ cdecl wined3d_device_set_texture(ptr long ptr) -@ cdecl wined3d_device_set_texture_stage_state(ptr long long long) -@ cdecl wined3d_device_set_transform(ptr long ptr) @ cdecl wined3d_device_set_unordered_access_view(ptr long ptr long) @ cdecl wined3d_device_set_vertex_declaration(ptr ptr) @ cdecl wined3d_device_set_vertex_shader(ptr ptr) @ cdecl wined3d_device_set_viewports(ptr long ptr) -@ cdecl wined3d_device_set_vs_consts_b(ptr long long ptr) -@ cdecl wined3d_device_set_vs_consts_f(ptr long long ptr) -@ cdecl wined3d_device_set_vs_consts_i(ptr long long ptr) @ cdecl wined3d_device_set_vs_resource_view(ptr long ptr) @ cdecl wined3d_device_set_vs_sampler(ptr long ptr) @ cdecl wined3d_device_show_cursor(ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index b724424bce..a2a5fb8191 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2398,8 +2398,6 @@ HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *de struct wined3d_swapchain * __cdecl wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx); UINT __cdecl wined3d_device_get_swapchain_count(const struct wined3d_device *device); -void __cdecl wined3d_device_get_transform(const struct wined3d_device *device, - enum wined3d_transform_state state, struct wined3d_matrix *matrix); struct wined3d_unordered_access_view * __cdecl wined3d_device_get_unordered_access_view( const struct wined3d_device *device, unsigned int idx); struct wined3d_vertex_declaration * __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device); @@ -2425,8 +2423,6 @@ void __cdecl wined3d_device_resolve_sub_resource(struct wined3d_device *device, void __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index); void __cdecl wined3d_device_set_blend_state(struct wined3d_device *device, struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor); -HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, - UINT plane_idx, const struct wined3d_vec4 *plane); HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device, const struct wined3d_clip_status *clip_status); void __cdecl wined3d_device_set_compute_shader(struct wined3d_device *device, struct wined3d_shader *shader); @@ -2463,10 +2459,6 @@ void __cdecl wined3d_device_set_hs_sampler(struct wined3d_device *device, void __cdecl wined3d_device_set_hull_shader(struct wined3d_device *device, struct wined3d_shader *shader); void __cdecl wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *index_buffer, enum wined3d_format_id format_id, unsigned int offset); -HRESULT __cdecl wined3d_device_set_light(struct wined3d_device *device, - UINT light_idx, const struct wined3d_light *light); -HRESULT __cdecl wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable); -void __cdecl wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material); void __cdecl wined3d_device_set_max_frame_latency(struct wined3d_device *device, unsigned int max_frame_latency); void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device); HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments); @@ -2475,12 +2467,6 @@ void __cdecl wined3d_device_set_predication(struct wined3d_device *device, struct wined3d_query *predicate, BOOL value); void __cdecl wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_topology, unsigned int patch_vertex_count); -HRESULT __cdecl wined3d_device_set_ps_consts_b(struct wined3d_device *device, - unsigned int start_idx, unsigned int count, const BOOL *constants); -HRESULT __cdecl wined3d_device_set_ps_consts_f(struct wined3d_device *device, - unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants); -HRESULT __cdecl wined3d_device_set_ps_consts_i(struct wined3d_device *device, - unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants); void __cdecl wined3d_device_set_ps_resource_view(struct wined3d_device *device, UINT idx, struct wined3d_shader_resource_view *view); void __cdecl wined3d_device_set_ps_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler); @@ -2490,8 +2476,6 @@ void __cdecl wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value); HRESULT __cdecl wined3d_device_set_rendertarget_view(struct wined3d_device *device, unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport); -void __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device, - UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); void __cdecl wined3d_device_set_scissor_rects(struct wined3d_device *device, unsigned int rect_count, const RECT *rect); void __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software); @@ -2499,12 +2483,6 @@ void __cdecl wined3d_device_set_stream_output(struct wined3d_device *device, UIN struct wined3d_buffer *buffer, UINT offset); HRESULT __cdecl wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride); -HRESULT __cdecl wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider); -void __cdecl wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture); -void __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *device, - UINT stage, enum wined3d_texture_stage_state state, DWORD value); -void __cdecl wined3d_device_set_transform(struct wined3d_device *device, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix); void __cdecl wined3d_device_set_unordered_access_view(struct wined3d_device *device, unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count); void __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, @@ -2512,12 +2490,6 @@ void __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device void __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); void __cdecl wined3d_device_set_viewports(struct wined3d_device *device, unsigned int viewport_count, const struct wined3d_viewport *viewports); -HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device, - unsigned int start_idx, unsigned int count, const BOOL *constants); -HRESULT __cdecl wined3d_device_set_vs_consts_f(struct wined3d_device *device, - unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants); -HRESULT __cdecl wined3d_device_set_vs_consts_i(struct wined3d_device *device, - unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants); void __cdecl wined3d_device_set_vs_resource_view(struct wined3d_device *device, UINT idx, struct wined3d_shader_resource_view *view); void __cdecl wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 20 ---------- dlls/d3d11/state.c | 8 +++- dlls/wined3d/context.c | 7 ++-- dlls/wined3d/cs.c | 6 +-- dlls/wined3d/device.c | 62 +++++++++++++++++++++++++----- dlls/wined3d/state.c | 85 +++++++++++++++++++++--------------------- dlls/wined3d/surface.c | 4 +- include/wine/wined3d.h | 6 +++ 8 files changed, 115 insertions(+), 83 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 212881a9b7..555d998da2 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -929,11 +929,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); struct d3d_rasterizer_state *rasterizer_state_impl; const D3D11_RASTERIZER_DESC *desc; - union - { - DWORD d; - float f; - } scale_bias, const_bias;
TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state);
@@ -941,13 +936,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon if (!(rasterizer_state_impl = unsafe_impl_from_ID3D11RasterizerState(rasterizer_state))) { wined3d_device_set_rasterizer_state(device->wined3d_device, NULL); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_FILLMODE, WINED3D_FILL_SOLID); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, WINED3D_CULL_BACK); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, FALSE); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ANTIALIASEDLINEENABLE, FALSE); wined3d_mutex_unlock(); return; } @@ -955,16 +944,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon wined3d_device_set_rasterizer_state(device->wined3d_device, rasterizer_state_impl->wined3d_state);
desc = &rasterizer_state_impl->desc; - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_FILLMODE, desc->FillMode); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode); - scale_bias.f = desc->SlopeScaledDepthBias; - const_bias.f = desc->DepthBias; - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, scale_bias.d); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, const_bias.d); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, desc->ScissorEnable); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, desc->MultisampleEnable); - wined3d_device_set_render_state(device->wined3d_device, - WINED3D_RS_ANTIALIASEDLINEENABLE, desc->AntialiasedLineEnable); wined3d_mutex_unlock(); }
diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 92b75f8e1f..dd2eb6306e 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -1076,9 +1076,15 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str return E_FAIL; }
+ wined3d_desc.fill_mode = desc->FillMode; + wined3d_desc.cull_mode = desc->CullMode; wined3d_desc.front_ccw = desc->FrontCounterClockwise; - wined3d_desc.depth_clip = desc->DepthClipEnable; + wined3d_desc.depth_bias = desc->DepthBias; wined3d_desc.depth_bias_clamp = desc->DepthBiasClamp; + wined3d_desc.scale_bias = desc->SlopeScaledDepthBias; + wined3d_desc.depth_clip = desc->DepthClipEnable; + wined3d_desc.scissor = desc->ScissorEnable; + wined3d_desc.line_antialias = desc->AntialiasedLineEnable;
/* We cannot fail after creating a wined3d_rasterizer_state object. It * would lead to double free. */ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index af2b00f88e..f4a5189ba1 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -3150,11 +3150,10 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl, gl_info->gl_ops.gl.p_glDisable(GL_BLEND); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE)); gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_CULLMODE)); + gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST); + context_invalidate_state(context, STATE_RASTERIZER); gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_STENCILENABLE)); - gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE)); if (gl_info->supported[ARB_POINT_SPRITE]) { gl_info->gl_ops.gl.p_glDisable(GL_POINT_SPRITE_ARB); @@ -3428,7 +3427,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, checkGLcall("setting up state for clear");
context_invalidate_state(&context_gl->c, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE)); - context_invalidate_state(&context_gl->c, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE)); + context_invalidate_state(&context_gl->c, STATE_RASTERIZER); context_invalidate_state(&context_gl->c, STATE_SCISSORRECT);
return TRUE; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index ec17b59d71..dbdf5f2ec2 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -614,7 +614,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * op->rt_count = rt_count; op->fb = &cs->fb; SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height); - if (state->render_states[WINED3D_RS_SCISSORTESTENABLE]) + if (state->rasterizer_state && state->rasterizer_state->desc.scissor) IntersectRect(&op->draw_rect, &op->draw_rect, &state->scissor_rects[0]); op->color = *color; op->depth = depth; @@ -1150,12 +1150,12 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const device_invalidate_state(device, STATE_RENDER(WINED3D_RS_ZENABLE)); device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILENABLE)); device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK)); - device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); + device_invalidate_state(device, STATE_RASTERIZER); } else if (prev) { if (prev->format->depth_bias_scale != op->view->format->depth_bias_scale) - device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); + device_invalidate_state(device, STATE_RASTERIZER); if (prev->format->stencil_size != op->view->format->stencil_size) device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILREF)); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 118c99e7f5..5fb05b67ce 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3475,11 +3475,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, const struct wined3d_stateblock_state *state = &stateblock->stateblock_state; const struct wined3d_saved_states *changed = &stateblock->changed; const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT; + BOOL set_rasterizer_state = FALSE, set_blend_state; struct wined3d_blend_state *blend_state; unsigned int i, j, start, idx; struct wined3d_color colour; struct wined3d_range range; - BOOL set_blend_state; DWORD map, stage;
TRACE("device %p, stateblock %p.\n", device, stateblock); @@ -3576,21 +3576,63 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, { j = wined3d_bit_scan(&map); idx = i * word_bit_count + j; - if (idx != WINED3D_RS_BLENDFACTOR) - { - wined3d_device_set_render_state(device, idx, state->rs[idx]); - continue; - }
- if (!set_blend_state) + switch (idx) { - blend_state = wined3d_device_get_blend_state(device, &colour); - wined3d_color_from_d3dcolor(&colour, state->rs[idx]); - wined3d_device_set_blend_state(device, blend_state, &colour); + case WINED3D_RS_BLENDFACTOR: + if (!set_blend_state) + { + blend_state = wined3d_device_get_blend_state(device, &colour); + wined3d_color_from_d3dcolor(&colour, state->rs[idx]); + wined3d_device_set_blend_state(device, blend_state, &colour); + } + break; + + case WINED3D_RS_FILLMODE: + case WINED3D_RS_CULLMODE: + case WINED3D_RS_SLOPESCALEDEPTHBIAS: + case WINED3D_RS_DEPTHBIAS: + case WINED3D_RS_SCISSORTESTENABLE: + case WINED3D_RS_ANTIALIASEDLINEENABLE: + set_rasterizer_state = TRUE; + break; + + default: + wined3d_device_set_render_state(device, idx, state->rs[idx]); } } }
+ if (set_rasterizer_state) + { + struct wined3d_rasterizer_state *rasterizer_state; + struct wined3d_rasterizer_state_desc desc; + union + { + DWORD d; + float f; + } bias; + + desc.fill_mode = state->rs[WINED3D_RS_FILLMODE]; + desc.cull_mode = state->rs[WINED3D_RS_CULLMODE]; + desc.front_ccw = FALSE; + bias.d = state->rs[WINED3D_RS_DEPTHBIAS]; + desc.depth_bias = bias.f; + desc.depth_bias_clamp = 0.0f; + bias.d = state->rs[WINED3D_RS_SLOPESCALEDEPTHBIAS]; + desc.scale_bias = bias.f; + desc.depth_clip = TRUE; + desc.scissor = state->rs[WINED3D_RS_SCISSORTESTENABLE]; + desc.line_antialias = state->rs[WINED3D_RS_ANTIALIASEDLINEENABLE]; + + if (SUCCEEDED(wined3d_rasterizer_state_create(device, &desc, + NULL, &wined3d_null_parent_ops, &rasterizer_state))) + { + wined3d_device_set_rasterizer_state(device, rasterizer_state); + wined3d_rasterizer_state_decref(rasterizer_state); + } + } + for (i = 0; i < ARRAY_SIZE(changed->textureState); ++i) { map = changed->textureState[i]; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index a4d88e1bfc..0c8a7a59ce 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -171,10 +171,9 @@ void state_nop(struct wined3d_context *context, const struct wined3d_state *stat TRACE("%s: nop in current pipe config.\n", debug_d3dstate(state_id)); }
-static void state_fillmode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void fillmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info) { - const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; - enum wined3d_fill_mode mode = state->render_states[WINED3D_RS_FILLMODE]; + enum wined3d_fill_mode mode = r ? r->desc.fill_mode : WINED3D_FILL_SOLID;
switch (mode) { @@ -256,13 +255,13 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ context_apply_state(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION)); }
-static void state_cullmode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void cullmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info) { - const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + enum wined3d_cull mode = r ? r->desc.cull_mode : WINED3D_CULL_BACK;
/* glFrontFace() is set in context.c at context init and on an * offscreen / onscreen rendering switch. */ - switch (state->render_states[WINED3D_RS_CULLMODE]) + switch (mode) { case WINED3D_CULL_NONE: gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE); @@ -281,8 +280,7 @@ static void state_cullmode(struct wined3d_context *context, const struct wined3d checkGLcall("glCullFace(GL_BACK)"); break; default: - FIXME("Unrecognized cull mode %#x.\n", - state->render_states[WINED3D_RS_CULLMODE]); + FIXME("Unrecognized cull mode %#x.\n", mode); } }
@@ -1709,9 +1707,9 @@ static void state_msaa(struct wined3d_context *context, const struct wined3d_sta static void state_line_antialias(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + const struct wined3d_rasterizer_state *r = state->rasterizer_state;
- if (state->render_states[WINED3D_RS_EDGEANTIALIAS] - || state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE]) + if (state->render_states[WINED3D_RS_EDGEANTIALIAS] || (r && r->desc.line_antialias)) { gl_info->gl_ops.gl.p_glEnable(GL_LINE_SMOOTH); checkGLcall("glEnable(GL_LINE_SMOOTH)"); @@ -1723,11 +1721,9 @@ static void state_line_antialias(struct wined3d_context *context, const struct w } }
-static void state_scissor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void scissor(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info) { - const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; - - if (state->render_states[WINED3D_RS_SCISSORTESTENABLE]) + if (r && r->desc.scissor) { gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); checkGLcall("glEnable(GL_SCISSOR_TEST)"); @@ -1754,25 +1750,25 @@ static void state_scissor(struct wined3d_context *context, const struct wined3d_ * * Note that SLOPESCALEDEPTHBIAS is a scaling factor for the depth slope, and * doesn't need to be scaled to account for GL vs D3D differences. */ -static void state_depthbias(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void depthbias(struct wined3d_context *context, const struct wined3d_state *state) { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + const struct wined3d_rasterizer_state *r = state->rasterizer_state; + float scale_bias = r ? r->desc.scale_bias : 0.0f; + union + { + DWORD d; + float f; + } const_bias;
- if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] - || state->render_states[WINED3D_RS_DEPTHBIAS]) + const_bias.f = r ? r->desc.depth_bias : 0.0f; + + if (scale_bias || const_bias.f) { const struct wined3d_rendertarget_view *depth = state->fb->depth_stencil; float factor, units, scale, clamp;
- union - { - DWORD d; - float f; - } scale_bias, const_bias; - clamp = state->rasterizer_state ? state->rasterizer_state->desc.depth_bias_clamp : 0.0f; - scale_bias.d = state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS]; - const_bias.d = state->render_states[WINED3D_RS_DEPTHBIAS];
if (context->d3d_info->wined3d_creation_flags & WINED3D_LEGACY_DEPTH_BIAS) { @@ -1794,7 +1790,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 scale = 0.0f; }
- factor = scale_bias.f; + factor = scale_bias; units = const_bias.f * scale; }
@@ -4324,31 +4320,39 @@ static void depth_clip(const struct wined3d_rasterizer_state *r, const struct wi static void rasterizer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + const struct wined3d_rasterizer_state *r = state->rasterizer_state; GLenum mode;
- mode = state->rasterizer_state && state->rasterizer_state->desc.front_ccw ? GL_CCW : GL_CW; + mode = r && r->desc.front_ccw ? GL_CCW : GL_CW; if (context->render_offscreen) mode = (mode == GL_CW) ? GL_CCW : GL_CW;
gl_info->gl_ops.gl.p_glFrontFace(mode); checkGLcall("glFrontFace"); - if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_DEPTHBIAS))) - state_depthbias(context, state, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); - depth_clip(state->rasterizer_state, gl_info); + fillmode(r, gl_info); + cullmode(r, gl_info); + depthbias(context, state); + depth_clip(r, gl_info); + scissor(r, gl_info); + state_line_antialias(context, state, STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE)); }
static void rasterizer_cc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + const struct wined3d_rasterizer_state *r = state->rasterizer_state; GLenum mode;
- mode = state->rasterizer_state && state->rasterizer_state->desc.front_ccw ? GL_CCW : GL_CW; + mode = r && r->desc.front_ccw ? GL_CCW : GL_CW;
gl_info->gl_ops.gl.p_glFrontFace(mode); checkGLcall("glFrontFace"); - if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_DEPTHBIAS))) - state_depthbias(context, state, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); - depth_clip(state->rasterizer_state, gl_info); + fillmode(r, gl_info); + cullmode(r, gl_info); + depthbias(context, state); + depth_clip(r, gl_info); + scissor(r, gl_info); + state_line_antialias(context, state, STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE)); }
static void psorigin_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -4509,7 +4513,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_DESTBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), state_blend }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), { STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), state_line_antialias}, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE), { STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE), state_line_antialias}, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_SEPARATEALPHABLENDENABLE), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_SRCBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, @@ -4588,7 +4591,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_ZENABLE), { STATE_RENDER(WINED3D_RS_ZENABLE), state_zenable }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAPU), { STATE_RENDER(WINED3D_RS_WRAPU), state_wrapu }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAPV), { STATE_RENDER(WINED3D_RS_WRAPV), state_wrapv }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_FILLMODE), { STATE_RENDER(WINED3D_RS_FILLMODE), state_fillmode }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_LINEPATTERN), { STATE_RENDER(WINED3D_RS_LINEPATTERN), state_linepattern }, WINED3D_GL_LEGACY_CONTEXT }, { STATE_RENDER(WINED3D_RS_LINEPATTERN), { STATE_RENDER(WINED3D_RS_LINEPATTERN), state_linepattern_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_MONOENABLE), { STATE_RENDER(WINED3D_RS_MONOENABLE), state_monoenable }, WINED3D_GL_EXT_NONE }, @@ -4596,7 +4598,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_PLANEMASK), { STATE_RENDER(WINED3D_RS_PLANEMASK), state_planemask }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZWRITEENABLE), { STATE_RENDER(WINED3D_RS_ZWRITEENABLE), state_zwriteenable }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_LASTPIXEL), { STATE_RENDER(WINED3D_RS_LASTPIXEL), state_lastpixel }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_CULLMODE), { STATE_RENDER(WINED3D_RS_CULLMODE), state_cullmode }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZFUNC), { STATE_RENDER(WINED3D_RS_ZFUNC), state_zfunc }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DITHERENABLE), { STATE_RENDER(WINED3D_RS_DITHERENABLE), state_ditherenable }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_SUBPIXEL), { STATE_RENDER(WINED3D_RS_SUBPIXEL), state_subpixel }, WINED3D_GL_EXT_NONE }, @@ -4660,15 +4661,12 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop }, WINED3D_GL_BLEND_EQUATION }, { STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE), { STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE), state_scissor }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), state_colorwrite1 }, EXT_DRAW_BUFFERS2 }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), state_colorwrite2 }, EXT_DRAW_BUFFERS2 }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), state_colorwrite3 }, EXT_DRAW_BUFFERS2 }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE }, /* Samplers */ { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, WINED3D_GL_EXT_NONE }, @@ -5426,16 +5424,17 @@ static void validate_state_table(struct wined3d_state_entry *state_table) { { 1, 1}, { 3, 3}, + { 8, 8}, { 17, 18}, - { 21, 21}, + { 21, 22}, { 42, 45}, { 47, 47}, { 61, 127}, {149, 150}, {169, 169}, - {177, 177}, + {174, 177}, {193, 193}, - {196, 197}, + {195, 197}, { 0, 0}, }; static const DWORD simple_states[] = diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index c0f28099cf..d8dc379c1a 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -131,7 +131,7 @@ static void texture2d_depth_blt_fbo(const struct wined3d_device *device, struct }
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE)); + context_invalidate_state(context, STATE_RASTERIZER);
gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, gl_mask, GL_NEAREST); @@ -267,7 +267,7 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3));
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE)); + context_invalidate_state(context, STATE_RASTERIZER);
gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, GL_COLOR_BUFFER_BIT, gl_filter); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index a2a5fb8191..c1fa3db5ad 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2033,9 +2033,15 @@ struct wined3d_blend_state_desc
struct wined3d_rasterizer_state_desc { + enum wined3d_fill_mode fill_mode; + enum wined3d_cull cull_mode; BOOL front_ccw; + float depth_bias; float depth_bias_clamp; + float scale_bias; BOOL depth_clip; + BOOL scissor; + BOOL line_antialias; };
struct wined3d_sampler_desc
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=66269
Your paranoid android.
=== debian10 (32 bit Chinese:China report) ===
d3d11: d3d11.c:16860: Test failed: Got {-1.00003052e+000, 0.00000000e+000, 1.00000000e+000, 0.00000000e+000}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 0.00000000e+000} at (0, 0), sub-resource 0.
On Wed, 4 Mar 2020 at 03:27, Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d11/device.c | 20 ---------- dlls/d3d11/state.c | 8 +++- dlls/wined3d/context.c | 7 ++-- dlls/wined3d/cs.c | 6 +-- dlls/wined3d/device.c | 62 +++++++++++++++++++++++++----- dlls/wined3d/state.c | 85 +++++++++++++++++++++--------------------- dlls/wined3d/surface.c | 4 +- include/wine/wined3d.h | 6 +++ 8 files changed, 115 insertions(+), 83 deletions(-)
This moves a bunch of things at the same time. That isn't necessarily wrong, but does make it harder to bisect if something were to inadvertently go wrong.
- if (set_rasterizer_state)
- {
struct wined3d_rasterizer_state *rasterizer_state;
struct wined3d_rasterizer_state_desc desc;
union
{
DWORD d;
float f;
} bias;
desc.fill_mode = state->rs[WINED3D_RS_FILLMODE];
desc.cull_mode = state->rs[WINED3D_RS_CULLMODE];
desc.front_ccw = FALSE;
bias.d = state->rs[WINED3D_RS_DEPTHBIAS];
desc.depth_bias = bias.f;
desc.depth_bias_clamp = 0.0f;
bias.d = state->rs[WINED3D_RS_SLOPESCALEDEPTHBIAS];
desc.scale_bias = bias.f;
desc.depth_clip = TRUE;
desc.scissor = state->rs[WINED3D_RS_SCISSORTESTENABLE];
desc.line_antialias = state->rs[WINED3D_RS_ANTIALIASEDLINEENABLE];
if (SUCCEEDED(wined3d_rasterizer_state_create(device, &desc,
NULL, &wined3d_null_parent_ops, &rasterizer_state)))
{
wined3d_device_set_rasterizer_state(device, rasterizer_state);
wined3d_rasterizer_state_decref(rasterizer_state);
}
- }
Recreating state objects here doesn't seem ideal. (For comparison, look at sampler objects in sampler().)
On 3/4/20 9:18 AM, Henri Verbeet wrote:
On Wed, 4 Mar 2020 at 03:27, Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d11/device.c | 20 ---------- dlls/d3d11/state.c | 8 +++- dlls/wined3d/context.c | 7 ++-- dlls/wined3d/cs.c | 6 +-- dlls/wined3d/device.c | 62 +++++++++++++++++++++++++----- dlls/wined3d/state.c | 85 +++++++++++++++++++++--------------------- dlls/wined3d/surface.c | 4 +- include/wine/wined3d.h | 6 +++ 8 files changed, 115 insertions(+), 83 deletions(-)
This moves a bunch of things at the same time. That isn't necessarily wrong, but does make it harder to bisect if something were to inadvertently go wrong.
Sure, makes sense. I can resend while moving one thing at a time.
- if (set_rasterizer_state)
- {
struct wined3d_rasterizer_state *rasterizer_state;
struct wined3d_rasterizer_state_desc desc;
union
{
DWORD d;
float f;
} bias;
desc.fill_mode = state->rs[WINED3D_RS_FILLMODE];
desc.cull_mode = state->rs[WINED3D_RS_CULLMODE];
desc.front_ccw = FALSE;
bias.d = state->rs[WINED3D_RS_DEPTHBIAS];
desc.depth_bias = bias.f;
desc.depth_bias_clamp = 0.0f;
bias.d = state->rs[WINED3D_RS_SLOPESCALEDEPTHBIAS];
desc.scale_bias = bias.f;
desc.depth_clip = TRUE;
desc.scissor = state->rs[WINED3D_RS_SCISSORTESTENABLE];
desc.line_antialias = state->rs[WINED3D_RS_ANTIALIASEDLINEENABLE];
if (SUCCEEDED(wined3d_rasterizer_state_create(device, &desc,
NULL, &wined3d_null_parent_ops, &rasterizer_state)))
{
wined3d_device_set_rasterizer_state(device, rasterizer_state);
wined3d_rasterizer_state_decref(rasterizer_state);
}
- }
Recreating state objects here doesn't seem ideal. (For comparison, look at sampler objects in sampler().)
Okay, that makes sense.
Broadly, though, I'm curious how this approach is more performant (or otherwise preferable) to just copying something like wined3d_rasterizer_state_desc as a flat structure. The only advantage I see is that it takes up less space in the CS; is that important enough to outweigh the overhead of allocation and rbtree lookup, or is there something else I'm missing?
On Wed, 4 Mar 2020 at 20:48, Zebediah Figura z.figura12@gmail.com wrote:
Broadly, though, I'm curious how this approach is more performant (or otherwise preferable) to just copying something like wined3d_rasterizer_state_desc as a flat structure. The only advantage I see is that it takes up less space in the CS; is that important enough to outweigh the overhead of allocation and rbtree lookup, or is there something else I'm missing?
For something like sampler objects, it means you can create the GL object at the same time the corresponding d3d11 object is created, instead of in the middle of a draw. The advantage is perhaps less obvious for something like the rasteriser state object with the GL backend, although it still allows you to e.g. translate D3D fill mode to GL fill mode once during state object creation instead of at draw time. However, in the case of Vulkan, where a bunch of state is combined together into a single pipeline object, having unique state objects means you can compare state objects by their pointer values instead of their contents. I.e., potentially cheaper lookup of Vulkan pipeline objects.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=66261
Your paranoid android.
=== debian10 (build log) ===
error: patch failed: dlls/wined3d/stateblock.c:989 Task: Patch failed to apply