=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Allow draw calls without color attachments.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Mar 22 10:55:12 CDT 2016
Module: wine
Branch: master
Commit: 53f4cc1a9eef9708e8b4d537d745161222242a74
URL: http://source.winehq.org/git/wine.git/?a=commit;h=53f4cc1a9eef9708e8b4d537d745161222242a74
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Tue Mar 22 13:41:48 2016 +0100
wined3d: Allow draw calls without color attachments.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/context.c | 2 +-
dlls/wined3d/state.c | 50 ++++++++++++++++++++++++++++--------------
dlls/wined3d/wined3d_private.h | 2 +-
3 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index e372eaa..31fd22a 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2675,7 +2675,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
}
context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets,
wined3d_rendertarget_view_get_surface(fb->depth_stencil),
- fb->render_targets[0]->resource->draw_binding,
+ fb->render_targets[0] ? fb->render_targets[0]->resource->draw_binding : 0,
fb->depth_stencil ? fb->depth_stencil->resource->draw_binding : 0);
}
}
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index ec49d56..70f053b 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -367,11 +367,20 @@ static GLenum gl_blend_factor(enum wined3d_blend factor, const struct wined3d_fo
static void state_blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
- const struct wined3d_format *rt_format = state->fb->render_targets[0]->format;
- unsigned int rt_fmt_flags = state->fb->render_targets[0]->format_flags;
const struct wined3d_gl_info *gl_info = context->gl_info;
- GLenum srcBlend, dstBlend;
+ const struct wined3d_format *rt_format;
enum wined3d_blend d3d_blend;
+ GLenum srcBlend, dstBlend;
+ unsigned int rt_fmt_flags;
+
+ if (!state->fb->render_targets[0])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
+ return;
+ }
+
+ rt_format = state->fb->render_targets[0]->format;
+ rt_fmt_flags = state->fb->render_targets[0]->format_flags;
/* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific
* blending parameters to work. */
@@ -4544,31 +4553,40 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
+ const struct wined3d_rendertarget_view *depth_stencil = state->fb->depth_stencil;
const struct wined3d_rendertarget_view *target = state->fb->render_targets[0];
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_viewport vp = state->viewport;
+ unsigned int width, height;
+
+ if (target)
+ {
+ if (vp.width > target->width)
+ vp.width = target->width;
+ if (vp.height > target->height)
+ vp.height = target->height;
- if (vp.width > target->width)
- vp.width = target->width;
- if (vp.height > target->height)
- vp.height = target->height;
+ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
+ }
+ else if (depth_stencil)
+ {
+ width = depth_stencil->width;
+ height = depth_stencil->height;
+ }
+ else
+ {
+ FIXME("No attachments draw calls not supported.\n");
+ return;
+ }
gl_info->gl_ops.gl.p_glDepthRange(vp.min_z, vp.max_z);
checkGLcall("glDepthRange");
/* Note: GL requires lower left, DirectX supplies upper left. This is
* reversed when using offscreen rendering. */
if (context->render_offscreen)
- {
gl_info->gl_ops.gl.p_glViewport(vp.x, vp.y, vp.width, vp.height);
- }
else
- {
- UINT width, height;
-
- surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
- gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)),
- vp.width, vp.height);
- }
+ gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)), vp.width, vp.height);
checkGLcall("glViewport");
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 48d21d3..feb86d1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3431,7 +3431,7 @@ static inline BOOL needs_srgb_write(const struct wined3d_context *context,
{
return (!(context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
|| state->render_states[WINED3D_RS_SRGBWRITEENABLE])
- && fb->render_targets[0]->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
+ && fb->render_targets[0] && fb->render_targets[0]->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
}
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
More information about the wine-cvs
mailing list