=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Add fallback for WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0.
Alexandre Julliard
julliard at winehq.org
Wed Nov 21 16:08:06 CST 2018
Module: wine
Branch: master
Commit: efe867a2f6e4969b82e266251344967234881476
URL: https://source.winehq.org/git/wine.git/?a=commit;h=efe867a2f6e4969b82e266251344967234881476
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Wed Nov 21 15:14:01 2018 +0100
wined3d: Add fallback for WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0.
Use non-indexed queries when ARB_transform_feedback3 is not available.
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/query.c | 47 +++++++++++++++++++++++++++++++++++------------
1 file changed, 35 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 4239fc0..c0a1469 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -817,6 +817,24 @@ static BOOL wined3d_so_statistics_query_ops_poll(struct wined3d_query *query, DW
return written_available && generated_available;
}
+static void wined3d_so_statistics_query_end(struct wined3d_so_statistics_query *query,
+ struct wined3d_context *context)
+{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
+ if (gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
+ {
+ GL_EXTCALL(glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, query->stream_idx));
+ GL_EXTCALL(glEndQueryIndexed(GL_PRIMITIVES_GENERATED, query->stream_idx));
+ }
+ else
+ {
+ GL_EXTCALL(glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN));
+ GL_EXTCALL(glEndQuery(GL_PRIMITIVES_GENERATED));
+ }
+ checkGLcall("end query");
+}
+
static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, DWORD flags)
{
struct wined3d_so_statistics_query *pq = wined3d_so_statistics_query_from_query(query);
@@ -833,9 +851,7 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
{
if ((context = context_reacquire(device, pq->context)))
{
- gl_info = context->gl_info;
- GL_EXTCALL(glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, pq->stream_idx));
- GL_EXTCALL(glEndQueryIndexed(GL_PRIMITIVES_GENERATED, pq->stream_idx));
+ wined3d_so_statistics_query_end(pq, context);
}
else
{
@@ -854,10 +870,20 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
}
gl_info = context->gl_info;
- GL_EXTCALL(glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
- pq->stream_idx, pq->u.query.written));
- GL_EXTCALL(glBeginQueryIndexed(GL_PRIMITIVES_GENERATED,
- pq->stream_idx, pq->u.query.generated));
+ if (gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
+ {
+ GL_EXTCALL(glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
+ pq->stream_idx, pq->u.query.written));
+ GL_EXTCALL(glBeginQueryIndexed(GL_PRIMITIVES_GENERATED,
+ pq->stream_idx, pq->u.query.generated));
+ }
+ else
+ {
+ GL_EXTCALL(glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
+ pq->u.query.written));
+ GL_EXTCALL(glBeginQuery(GL_PRIMITIVES_GENERATED,
+ pq->u.query.generated));
+ }
checkGLcall("begin query");
context_release(context);
@@ -869,10 +895,7 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
{
if ((context = context_reacquire(device, pq->context)))
{
- gl_info = context->gl_info;
- GL_EXTCALL(glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, pq->stream_idx));
- GL_EXTCALL(glEndQueryIndexed(GL_PRIMITIVES_GENERATED, pq->stream_idx));
- checkGLcall("end query");
+ wined3d_so_statistics_query_end(pq, context);
context_release(context);
poll = TRUE;
@@ -1247,7 +1270,7 @@ static HRESULT wined3d_so_statistics_query_create(struct wined3d_device *device,
WARN("OpenGL implementation does not support primitive queries.\n");
return WINED3DERR_NOTAVAILABLE;
}
- if (!gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
+ if (stream_idx && !gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
{
WARN("OpenGL implementation does not support indexed queries.\n");
return WINED3DERR_NOTAVAILABLE;
More information about the wine-cvs
mailing list