From 90d388f5577e4ddbcb622d56d7c29c77674b9316 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 30 Nov 2019 19:19:59 -0600 Subject: [PATCH] wined3d: Introduce wined3d_stateblock_get_state(). Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/stateblock.c | 5 +++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 55 --------------------------------- include/wine/wined3d.h | 56 ++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 55 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 24017490e67..1a0ba0a3d59 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1698,6 +1698,11 @@ HRESULT CDECL wined3d_stateblock_set_light_enable(struct wined3d_stateblock *sta return S_OK; } +const struct wined3d_stateblock_state * CDECL wined3d_stateblock_get_state(const struct wined3d_stateblock *stateblock) +{ + return &stateblock->stateblock_state; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index fed5ce1b128..bec84b5979c 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -259,6 +259,7 @@ @ cdecl wined3d_stateblock_capture(ptr ptr) @ cdecl wined3d_stateblock_create(ptr ptr long ptr) @ cdecl wined3d_stateblock_decref(ptr) +@ cdecl wined3d_stateblock_get_state(ptr) @ cdecl wined3d_stateblock_incref(ptr) @ cdecl wined3d_stateblock_init_contained_states(ptr) @ cdecl wined3d_stateblock_reset(ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index dd54161b44c..1ee22808c1d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -272,14 +272,8 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup } /* Device caps */ -#define WINED3D_MAX_STREAMS 16 -#define WINED3D_MAX_TEXTURES 8 -#define WINED3D_MAX_FRAGMENT_SAMPLERS 16 -#define WINED3D_MAX_VERTEX_SAMPLERS 4 -#define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS) #define WINED3D_MAX_ACTIVE_LIGHTS 8 #define WINED3D_MAX_SOFTWARE_ACTIVE_LIGHTS 32 -#define WINED3D_MAX_CLIP_DISTANCES 8 #define MAX_CONSTANT_BUFFERS 15 #define MAX_SAMPLER_OBJECTS 16 #define MAX_SHADER_RESOURCE_VIEWS 128 @@ -699,10 +693,6 @@ enum wined3d_shader_conditional_op #define MAX_REG_INPUT 32 #define MAX_REG_OUTPUT 32 #define WINED3D_MAX_CBS 15 -#define WINED3D_MAX_CONSTS_B 16 -#define WINED3D_MAX_CONSTS_I 16 -#define WINED3D_MAX_VS_CONSTS_F 256 -#define WINED3D_MAX_PS_CONSTS_F 224 /* FIXME: This needs to go up to 2048 for * Shader model 3 according to msdn (and for software shaders) */ @@ -1504,8 +1494,6 @@ static inline void wined3d_colour_srgb_from_linear(struct wined3d_color *colour_ colour_srgb->a = colour->a; } -#define WINED3D_HIGHEST_TRANSFORM_STATE WINED3D_TS_WORLD_MATRIX(255) /* Highest value in wined3d_transform_state. */ - void wined3d_check_gl_call(const struct wined3d_gl_info *gl_info, const char *file, unsigned int line, const char *name) DECLSPEC_HIDDEN; @@ -3122,15 +3110,6 @@ struct wined3d_stream_output UINT offset; }; -struct wined3d_stream_state -{ - struct wined3d_buffer *buffer; - UINT offset; - UINT stride; - UINT frequency; - UINT flags; -}; - #define LIGHTMAP_SIZE 43 #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) @@ -3217,40 +3196,6 @@ struct wined3d_dummy_textures * wined3d_device_create() ignores it. */ #define WINED3DCREATE_MULTITHREADED 0x00000004 -struct wined3d_stateblock_state -{ - struct wined3d_vertex_declaration *vertex_declaration; - struct wined3d_stream_state streams[WINED3D_MAX_STREAMS + 1]; - struct wined3d_buffer *index_buffer; - enum wined3d_format_id index_format; - int base_vertex_index; - - struct wined3d_shader *vs; - struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; - struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I]; - BOOL vs_consts_b[WINED3D_MAX_CONSTS_B]; - - struct wined3d_shader *ps; - struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; - struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I]; - BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; - - DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; - struct wined3d_color blend_factor; - - struct wined3d_texture *textures[WINED3D_MAX_COMBINED_SAMPLERS]; - DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; - DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; - - struct wined3d_matrix transforms[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; - struct wined3d_vec4 clip_planes[WINED3D_MAX_CLIP_DISTANCES]; - struct wined3d_material material; - struct wined3d_viewport viewport; - RECT scissor_rect; - - struct wined3d_light_state *light_state; -}; - struct wined3d_device { LONG ref; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index eba14e9a022..8b64bf66c23 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -668,6 +668,7 @@ enum wined3d_transform_state }; #define WINED3D_TS_WORLD_MATRIX(index) (enum wined3d_transform_state)(index + 256) +#define WINED3D_HIGHEST_TRANSFORM_STATE WINED3D_TS_WORLD_MATRIX(255) /* Highest value in wined3d_transform_state. */ enum wined3d_basis_type { @@ -1588,6 +1589,17 @@ enum wined3d_shader_type #define WINED3D_REGISTER_WINDOW_NO_ALT_ENTER 0x00000002u #define WINED3D_REGISTER_WINDOW_NO_PRINT_SCREEN 0x00000004u +#define WINED3D_MAX_STREAMS 16 +#define WINED3D_MAX_TEXTURES 8 +#define WINED3D_MAX_FRAGMENT_SAMPLERS 16 +#define WINED3D_MAX_VERTEX_SAMPLERS 4 +#define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS) +#define WINED3D_MAX_CLIP_DISTANCES 8 +#define WINED3D_MAX_CONSTS_B 16 +#define WINED3D_MAX_CONSTS_I 16 +#define WINED3D_MAX_VS_CONSTS_F 256 +#define WINED3D_MAX_PS_CONSTS_F 224 + struct wined3d_display_mode { UINT width; @@ -2111,6 +2123,49 @@ struct wined3d_output_desc HMONITOR monitor; }; +struct wined3d_stream_state +{ + struct wined3d_buffer *buffer; + UINT offset; + UINT stride; + UINT frequency; + UINT flags; +}; + +struct wined3d_stateblock_state +{ + struct wined3d_vertex_declaration *vertex_declaration; + struct wined3d_stream_state streams[WINED3D_MAX_STREAMS + 1]; + struct wined3d_buffer *index_buffer; + enum wined3d_format_id index_format; + int base_vertex_index; + + struct wined3d_shader *vs; + struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; + struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I]; + BOOL vs_consts_b[WINED3D_MAX_CONSTS_B]; + + struct wined3d_shader *ps; + struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; + struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I]; + BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; + + DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; + struct wined3d_color blend_factor; + + struct wined3d_texture *textures[WINED3D_MAX_COMBINED_SAMPLERS]; + DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; + DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; + + struct wined3d_matrix transforms[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; + struct wined3d_vec4 clip_planes[WINED3D_MAX_CLIP_DISTANCES]; + struct wined3d_material material; + struct wined3d_viewport viewport; + RECT scissor_rect; + + struct wined3d_light_state *light_state; +}; + struct wined3d_parent_ops { void (__stdcall *wined3d_object_destroyed)(void *parent); @@ -2666,6 +2721,7 @@ void __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock, HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, const struct wined3d_stateblock *device_state, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); +const struct wined3d_stateblock_state * __cdecl wined3d_stateblock_get_state(const struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_reset(struct wined3d_stateblock *stateblock);