Commit e6076c8d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move the OpenGL view class to struct wined3d_format_gl.

parent 62ef7516
......@@ -2991,23 +2991,23 @@ static GLenum lookup_gl_view_class(GLenum internal_format)
return GL_NONE;
}
static void query_view_class(struct wined3d_format *format)
static void query_view_class(struct wined3d_format_gl *format)
{
GLenum internal_view_class, gamma_view_class, rt_view_class;
internal_view_class = lookup_gl_view_class(format->glInternal);
gamma_view_class = lookup_gl_view_class(format->glGammaInternal);
rt_view_class = lookup_gl_view_class(format->rtInternal);
internal_view_class = lookup_gl_view_class(format->f.glInternal);
gamma_view_class = lookup_gl_view_class(format->f.glGammaInternal);
rt_view_class = lookup_gl_view_class(format->f.rtInternal);
if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
{
format->gl_view_class = internal_view_class;
format->view_class = internal_view_class;
TRACE("Format %s is member of GL view class %#x.\n",
debug_d3dformat(format->id), format->gl_view_class);
debug_d3dformat(format->f.id), format->view_class);
}
else
{
format->gl_view_class = GL_NONE;
format->view_class = GL_NONE;
}
}
......@@ -3083,7 +3083,7 @@ static void query_internal_format(struct wined3d_adapter *adapter,
}
}
query_view_class(format);
query_view_class(wined3d_format_gl_mutable(format));
if (format->glInternal && format->flags[WINED3D_GL_RES_TYPE_RB]
& (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
......
......@@ -531,7 +531,11 @@ static void wined3d_render_target_view_cs_init(void *object)
if (resource->format->id != view->format->id
|| (view->layer_count != 1 && view->layer_count != depth_or_layer_count))
{
if (resource->format->gl_view_class != view->format->gl_view_class)
GLenum resource_class, view_class;
resource_class = wined3d_format_gl(resource->format)->view_class;
view_class = wined3d_format_gl(view->format)->view_class;
if (resource_class != view_class)
{
FIXME("Render target view not supported, resource format %s, view format %s.\n",
debug_d3dformat(resource->format->id), debug_d3dformat(view->format->id));
......@@ -722,7 +726,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
else
{
struct wined3d_texture *texture = texture_from_resource(resource);
GLenum resource_class, view_class;
resource_class = wined3d_format_gl(resource->format)->view_class;
view_class = wined3d_format_gl(view_format)->view_class;
view_target = get_texture_view_target(gl_info, desc, texture);
if (resource->format->id == view_format->id && texture->target == view_target
......@@ -737,7 +744,7 @@ static void wined3d_shader_resource_view_cs_init(void *object)
FIXME("Swapchain shader resource views not supported.\n");
}
else if (resource->format->typeless_id == view_format->typeless_id
&& resource->format->gl_view_class == view_format->gl_view_class)
&& resource_class == view_class)
{
create_texture_view(&view->gl_view, view_target, desc, texture, view_format);
}
......
......@@ -4359,7 +4359,6 @@ struct wined3d_format
unsigned int width, unsigned int height, unsigned int depth);
enum wined3d_format_id typeless_id;
GLenum gl_view_class;
};
const struct wined3d_format *wined3d_get_format(const struct wined3d_adapter *adapter,
......@@ -4385,6 +4384,8 @@ struct wined3d_format_gl
GLenum vtx_type;
GLint vtx_format;
GLenum view_class;
};
static inline const struct wined3d_format_gl *wined3d_format_gl(const struct wined3d_format *format)
......
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