From: Zebediah Figura Subject: [PATCH 1/5] wined3d: Introduce wined3d_stateblock_get_state(). Message-Id: <20191128015239.15259-1-z.figura12@gmail.com> Date: Wed, 27 Nov 2019 19:52:35 -0600 Signed-off-by: Zebediah Figura --- dlls/wined3d/stateblock.c | 5 +++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 66 --------------------------------- include/wine/wined3d.h | 67 ++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 66 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 1c3704c10a5..1196eb2a7f7 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1699,6 +1699,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 3ae7dab858e..4bc2ee19113 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -272,14 +272,7 @@ 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 +692,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 +1493,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; @@ -3121,25 +3108,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) - -struct wined3d_light_state -{ - /* Light hashmap. Collisions are handled using linked lists. */ - struct list light_map[LIGHTMAP_SIZE]; - const struct wined3d_light_info *lights[WINED3D_MAX_ACTIVE_LIGHTS]; -}; - #define WINED3D_STATE_NO_REF 0x00000001 #define WINED3D_STATE_INIT_DEFAULT 0x00000002 @@ -3216,40 +3184,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..c5ada12d66f 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,18 @@ 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_ACTIVE_LIGHTS 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 +2124,59 @@ struct wined3d_output_desc HMONITOR monitor; }; +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) + +struct wined3d_light_state +{ + /* Light hashmap. Collisions are handled using linked lists. */ + struct list light_map[LIGHTMAP_SIZE]; + const struct wined3d_light_info *lights[WINED3D_MAX_ACTIVE_LIGHTS]; +}; + +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 +2732,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); -- 2.23.0