[PATCH 1/5] wined3d: Introduce wined3d_stateblock_set_sampler_state().

Zebediah Figura z.figura12 at gmail.com
Sat Oct 19 12:23:56 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/stateblock.c | 19 +++++++++++++++++++
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index a96093295c..70724f0545 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1443,6 +1443,25 @@ void CDECL wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateb
     stateblock->changed.blend_state = TRUE;
 }
 
+void CDECL wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock,
+        UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
+{
+    TRACE("stateblock %p, sampler_idx %u, state %s, value %#x.\n",
+            stateblock, sampler_idx, debug_d3dsamplerstate(state), value);
+
+    if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
+        sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
+
+    if (sampler_idx >= ARRAY_SIZE(stateblock->stateblock_state.sampler_states))
+    {
+        WARN("Invalid sampler %u.\n", sampler_idx);
+        return;
+    }
+
+    stateblock->stateblock_state.sampler_states[sampler_idx][state] = value;
+    stateblock->changed.samplerState[sampler_idx] |= 1u << 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 c7b10a2b56..bf6b786704 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -264,6 +264,7 @@
 @ cdecl wined3d_stateblock_set_ps_consts_f(ptr long long ptr)
 @ cdecl wined3d_stateblock_set_ps_consts_i(ptr long long ptr)
 @ cdecl wined3d_stateblock_set_render_state(ptr long long)
+@ cdecl wined3d_stateblock_set_sampler_state(ptr long long long)
 @ cdecl wined3d_stateblock_set_vertex_declaration(ptr ptr)
 @ cdecl wined3d_stateblock_set_vertex_shader(ptr ptr)
 @ cdecl wined3d_stateblock_set_vs_consts_b(ptr long long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 445ecd2f55..2fd16958d5 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2671,6 +2671,8 @@ HRESULT __cdecl wined3d_stateblock_set_ps_consts_i(struct wined3d_stateblock *st
         unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants);
 void __cdecl wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock,
         enum wined3d_render_state state, DWORD value);
+void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock,
+        UINT sampler_idx, enum wined3d_sampler_state state, DWORD value);
 void __cdecl wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock,
         struct wined3d_vertex_declaration *declaration);
 void __cdecl wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
-- 
2.20.1




More information about the wine-devel mailing list