Henri Verbeet : wined3d: Pass a wined3d_context_gl structure to context_set_draw_buffer().

Alexandre Julliard julliard at winehq.org
Wed May 15 16:18:27 CDT 2019


Module: wine
Branch: master
Commit: 9cb572cb7018fc2aeb290abbde3f2db1d76b8d1b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9cb572cb7018fc2aeb290abbde3f2db1d76b8d1b

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed May 15 18:20:56 2019 +0430

wined3d: Pass a wined3d_context_gl structure to context_set_draw_buffer().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/arb_program_shader.c |  2 +-
 dlls/wined3d/context.c            | 13 ++++++++-----
 dlls/wined3d/glsl_shader.c        |  2 +-
 dlls/wined3d/surface.c            |  8 ++++----
 dlls/wined3d/wined3d_private.h    |  2 +-
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index a0f5e68..dadeafd 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7899,7 +7899,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
         }
         wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
                 &dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
-        context_set_draw_buffer(context, buffer);
+        wined3d_context_gl_set_draw_buffer(context_gl, buffer);
         wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
         context_invalidate_state(context, STATE_FRAMEBUFFER);
     }
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 4707d70..75388e0 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -702,6 +702,7 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context,
 /* Context activation is done by the caller. */
 static void context_apply_fbo_entry(struct wined3d_context *context, GLenum target, struct fbo_entry *entry)
 {
+    struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
     const struct wined3d_gl_info *gl_info = context->gl_info;
     GLuint read_binding, draw_binding;
     unsigned int i;
@@ -739,7 +740,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ
     /* Set valid read and draw buffer bindings to satisfy pedantic pre-ES2_compatibility
      * GL contexts requirements. */
     gl_info->gl_ops.gl.p_glReadBuffer(GL_NONE);
-    context_set_draw_buffer(context, GL_NONE);
+    wined3d_context_gl_set_draw_buffer(context_gl, GL_NONE);
     if (target != GL_FRAMEBUFFER)
     {
         if (target == GL_READ_FRAMEBUFFER)
@@ -2504,12 +2505,14 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt
 }
 
 /* Context activation is done by the caller. */
-void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
+void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl *context_gl, GLenum buffer)
 {
-    const struct wined3d_gl_info *gl_info = context->gl_info;
-    DWORD *current_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask;
-    DWORD new_mask = context_generate_rt_mask(buffer);
+    const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
+    struct fbo_entry *current_fbo = context_gl->c.current_fbo;
+    uint32_t new_mask = context_generate_rt_mask(buffer);
+    uint32_t *current_mask;
 
+    current_mask = current_fbo ? &current_fbo->rt_mask : &context_gl->c.draw_buffers_mask;
     if (new_mask == *current_mask)
         return;
 
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index dbf11d7..e52738b 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -13333,7 +13333,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
         }
         wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
                 &dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
-        context_set_draw_buffer(context, buffer);
+        wined3d_context_gl_set_draw_buffer(context_gl, buffer);
         wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
         context_invalidate_state(context, STATE_FRAMEBUFFER);
     }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index b76ebe9..318ac19 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -110,7 +110,7 @@ static void texture2d_depth_blt_fbo(const struct wined3d_device *device, struct
 
     wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER, NULL, 0,
             &dst_texture->resource, dst_sub_resource_idx, dst_location);
-    context_set_draw_buffer(context, GL_NONE);
+    wined3d_context_gl_set_draw_buffer(context_gl, GL_NONE);
     wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
     context_invalidate_state(context, STATE_FRAMEBUFFER);
 
@@ -270,7 +270,7 @@ static void texture2d_blt_fbo(const struct wined3d_device *device, struct wined3
 
     wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
             &dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
-    context_set_draw_buffer(context, buffer);
+    wined3d_context_gl_set_draw_buffer(context_gl, buffer);
     wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
     context_invalidate_state(context, STATE_FRAMEBUFFER);
 
@@ -1183,7 +1183,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture_gl *dst_texture,
     gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
-    context_set_draw_buffer(context, drawBuffer);
+    wined3d_context_gl_set_draw_buffer(context_gl, drawBuffer);
     gl_info->gl_ops.gl.p_glReadBuffer(drawBuffer);
 
     gl_info->gl_ops.gl.p_glBegin(GL_QUADS);
@@ -2259,7 +2259,7 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
         }
         wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
                 dst_resource, dst_sub_resource_idx, NULL, 0, dst_location);
-        context_set_draw_buffer(context, buffer);
+        wined3d_context_gl_set_draw_buffer(context_gl, buffer);
         wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
         context_invalidate_state(context, STATE_FRAMEBUFFER);
     }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f1e7f6d..2c0bdeb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2087,6 +2087,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl,
         struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
 void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl,
         const struct wined3d_stream_info *si, GLuint *current_bo, const struct wined3d_state *state) DECLSPEC_HIDDEN;
+void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl *context_gl, GLenum buffer) DECLSPEC_HIDDEN;
 void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context_gl,
         const struct wined3d_state *state) DECLSPEC_HIDDEN;
 
@@ -2258,7 +2259,6 @@ void context_resource_released(const struct wined3d_device *device, struct wined
 void context_restore(struct wined3d_context *context, struct wined3d_texture *texture,
         unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
 BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN;
-void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) DECLSPEC_HIDDEN;
 void context_set_tls_idx(DWORD idx) DECLSPEC_HIDDEN;
 void context_state_drawbuf(struct wined3d_context *context,
         const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list