=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Retrieve FBO attachments from GL in context_check_fbo_status.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 24 11:01:41 CST 2016
Module: wine
Branch: master
Commit: f11f6f681e923f9d47a0f7d0151e02cd750cd150
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f11f6f681e923f9d47a0f7d0151e02cd750cd150
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Sun Feb 21 21:29:56 2016 +0000
wined3d: Retrieve FBO attachments from GL in context_check_fbo_status.
Signed-off-by: Stefan Dösinger <stefandoesinger at gmx.at>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/context.c | 115 +++++++++++++++++++++++++++++++++--------
dlls/wined3d/utils.c | 29 +++++++++++
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 123 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 442516a..3668195 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -243,6 +243,95 @@ static void context_attach_surface_fbo(struct wined3d_context *context,
}
}
+static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, GLenum target,
+ GLenum attachment)
+{
+ GLint type, name, samples, width, height, old_texture, level, face, fmt, tex_target;
+
+ gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment,
+ GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &name);
+ gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment,
+ GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
+
+ if (type == GL_RENDERBUFFER)
+ {
+ gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, name);
+ gl_info->fbo_ops.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width);
+ gl_info->fbo_ops.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height);
+ if (gl_info->limits.samples > 1)
+ gl_info->fbo_ops.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &samples);
+ else
+ samples = 1;
+ gl_info->fbo_ops.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_INTERNAL_FORMAT, &fmt);
+ FIXME(" %s: renderbuffer %d, %dx%d, %d samples, format %#x.\n",
+ debug_fboattachment(attachment), name, width, height, samples, fmt);
+ }
+ else if (type == GL_TEXTURE)
+ {
+ const char *tex_type_str;
+
+ gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, &level);
+ gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, &face);
+
+ if (face)
+ {
+ gl_info->gl_ops.gl.p_glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &old_texture);
+
+ glBindTexture(GL_TEXTURE_CUBE_MAP, name);
+ glGetTexLevelParameteriv(face, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
+ glGetTexLevelParameteriv(face, level, GL_TEXTURE_WIDTH, &width);
+ glGetTexLevelParameteriv(face, level, GL_TEXTURE_HEIGHT, &height);
+
+ tex_target = GL_TEXTURE_CUBE_MAP;
+ tex_type_str = "cube";
+ }
+ else
+ {
+ gl_info->gl_ops.gl.p_glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_texture);
+ while (gl_info->gl_ops.gl.p_glGetError());
+
+ glBindTexture(GL_TEXTURE_2D, name);
+ if (!gl_info->gl_ops.gl.p_glGetError())
+ {
+ tex_target = GL_TEXTURE_2D;
+ tex_type_str = "2d";
+ }
+ else
+ {
+ glBindTexture(GL_TEXTURE_2D, old_texture);
+ gl_info->gl_ops.gl.p_glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &old_texture);
+
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, name);
+ if (gl_info->gl_ops.gl.p_glGetError())
+ {
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture);
+ FIXME("Cannot find type of texture %d.\n", name);
+ return;
+ }
+ tex_target = GL_TEXTURE_RECTANGLE_ARB;
+ tex_type_str = "rectangle";
+ }
+
+ glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
+ glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_WIDTH, &width);
+ glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_HEIGHT, &height);
+ }
+
+ FIXME(" %s: %s texture %d, %dx%d, format %#x.\n", debug_fboattachment(attachment),
+ tex_type_str, name, width, height, fmt);
+
+ glBindTexture(tex_target, old_texture);
+ }
+ else if (type == GL_NONE)
+ {
+ FIXME("\t%s: NONE.\n", debug_fboattachment(attachment));
+ }
+ else
+ ERR("\t%s: Unknown attachment %#x.\n", debug_fboattachment(attachment), type);
+}
+
/* Context activation is done by the caller. */
void context_check_fbo_status(const struct wined3d_context *context, GLenum target)
{
@@ -258,7 +347,6 @@ void context_check_fbo_status(const struct wined3d_context *context, GLenum targ
}
else
{
- const struct wined3d_surface *attachment;
unsigned int i;
FIXME("FBO status %s (%#x)\n", debug_fbostatus(status), status);
@@ -269,29 +357,12 @@ void context_check_fbo_status(const struct wined3d_context *context, GLenum targ
return;
}
- FIXME("\tColor Location %s (%#x).\n", wined3d_debug_location(context->current_fbo->color_location),
- context->current_fbo->color_location);
- FIXME("\tDepth Stencil Location %s (%#x).\n", wined3d_debug_location(context->current_fbo->ds_location),
- context->current_fbo->ds_location);
+ context_dump_fbo_attachment(gl_info, target, GL_DEPTH_ATTACHMENT);
+ context_dump_fbo_attachment(gl_info, target, GL_STENCIL_ATTACHMENT);
- /* Dump the FBO attachments */
for (i = 0; i < gl_info->limits.buffers; ++i)
- {
- attachment = context->current_fbo->render_targets[i];
- if (attachment)
- {
- FIXME("\tColor attachment %d: (%p) %s %ux%u %u samples.\n",
- i, attachment, debug_d3dformat(attachment->resource.format->id),
- attachment->pow2Width, attachment->pow2Height, attachment->resource.multisample_type);
- }
- }
- attachment = context->current_fbo->depth_stencil;
- if (attachment)
- {
- FIXME("\tDepth attachment: (%p) %s %ux%u %u samples.\n",
- attachment, debug_d3dformat(attachment->resource.format->id),
- attachment->pow2Width, attachment->pow2Height, attachment->resource.multisample_type);
- }
+ context_dump_fbo_attachment(gl_info, target, GL_COLOR_ATTACHMENT0 + i);
+ checkGLcall("Dump FBO attachments");
}
}
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 734b265..4e33f86 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3948,6 +3948,35 @@ const char *debug_d3dpool(enum wined3d_pool pool)
}
}
+const char *debug_fboattachment(GLenum attachment)
+{
+ switch(attachment)
+ {
+#define WINED3D_TO_STR(x) case x: return #x
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT0);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT1);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT2);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT3);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT4);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT5);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT6);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT7);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT8);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT9);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT10);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT11);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT12);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT13);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT14);
+ WINED3D_TO_STR(GL_COLOR_ATTACHMENT15);
+ WINED3D_TO_STR(GL_DEPTH_ATTACHMENT);
+ WINED3D_TO_STR(GL_STENCIL_ATTACHMENT);
+#undef WINED3D_TO_STR
+ default:
+ return wine_dbg_sprintf("Unknown FBO attachment %#x", attachment);
+ }
+}
+
const char *debug_fbostatus(GLenum status) {
switch(status) {
#define FBOSTATUS_TO_STR(u) case u: return #u
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4e3d779..324fabd 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2969,6 +2969,7 @@ const char *debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_t
const char *debug_d3dtexturestate(enum wined3d_texture_stage_state state) DECLSPEC_HIDDEN;
const char *debug_d3dtstype(enum wined3d_transform_state tstype) DECLSPEC_HIDDEN;
const char *debug_d3dpool(enum wined3d_pool pool) DECLSPEC_HIDDEN;
+const char *debug_fboattachment(GLenum attachment) DECLSPEC_HIDDEN;
const char *debug_fbostatus(GLenum status) DECLSPEC_HIDDEN;
const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN;
const char *debug_d3dtop(enum wined3d_texture_op d3dtop) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list