Commit f11f6f68 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Retrieve FBO attachments from GL in context_check_fbo_status.

parent 749d5a57
...@@ -243,6 +243,95 @@ static void context_attach_surface_fbo(struct wined3d_context *context, ...@@ -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. */ /* Context activation is done by the caller. */
void context_check_fbo_status(const struct wined3d_context *context, GLenum target) 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 ...@@ -258,7 +347,6 @@ void context_check_fbo_status(const struct wined3d_context *context, GLenum targ
} }
else else
{ {
const struct wined3d_surface *attachment;
unsigned int i; unsigned int i;
FIXME("FBO status %s (%#x)\n", debug_fbostatus(status), status); 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 ...@@ -269,29 +357,12 @@ void context_check_fbo_status(const struct wined3d_context *context, GLenum targ
return; return;
} }
FIXME("\tColor Location %s (%#x).\n", wined3d_debug_location(context->current_fbo->color_location), context_dump_fbo_attachment(gl_info, target, GL_DEPTH_ATTACHMENT);
context->current_fbo->color_location); context_dump_fbo_attachment(gl_info, target, GL_STENCIL_ATTACHMENT);
FIXME("\tDepth Stencil Location %s (%#x).\n", wined3d_debug_location(context->current_fbo->ds_location),
context->current_fbo->ds_location);
/* Dump the FBO attachments */
for (i = 0; i < gl_info->limits.buffers; ++i) for (i = 0; i < gl_info->limits.buffers; ++i)
{ context_dump_fbo_attachment(gl_info, target, GL_COLOR_ATTACHMENT0 + i);
attachment = context->current_fbo->render_targets[i]; checkGLcall("Dump FBO attachments");
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);
}
} }
} }
......
...@@ -3948,6 +3948,35 @@ const char *debug_d3dpool(enum wined3d_pool pool) ...@@ -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) { const char *debug_fbostatus(GLenum status) {
switch(status) { switch(status) {
#define FBOSTATUS_TO_STR(u) case u: return #u #define FBOSTATUS_TO_STR(u) case u: return #u
......
...@@ -2969,6 +2969,7 @@ const char *debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_t ...@@ -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_d3dtexturestate(enum wined3d_texture_stage_state state) DECLSPEC_HIDDEN;
const char *debug_d3dtstype(enum wined3d_transform_state tstype) 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_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_fbostatus(GLenum status) DECLSPEC_HIDDEN;
const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN; const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN;
const char *debug_d3dtop(enum wined3d_texture_op d3dtop) DECLSPEC_HIDDEN; const char *debug_d3dtop(enum wined3d_texture_op d3dtop) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment