On 6 June 2016 at 11:39, Józef Kucia jkucia@codeweavers.com wrote:
+static BOOL gl_internal_format_equal(const struct wined3d_format *format1,
const struct wined3d_format *format2)
+{
- return format1->id == format2->id
|| (format1->glInternal == format2->glInternal
&& format1->glGammaInternal == format2->glGammaInternal
&& format1->rtInternal == format2->rtInternal);
+}
When would you use this? I was under the impression that Direct3D views were a bit more restricted then OpenGL views and only work between formats based on the same typeless format.
+static void wined3d_shader_resource_view_create_texture_view(struct wined3d_shader_resource_view *view,
const struct wined3d_shader_resource_view_desc *desc, const struct wined3d_format *view_format,
struct wined3d_texture *texture)
+{
- struct wined3d_context *context = context_acquire(texture->resource.device, NULL);
- const struct wined3d_gl_info *gl_info = context->gl_info;
- struct gl_texture *gl_texture;
This is fairly minor, but context_acquire() potentially does real work. It seems somewhat inappropriate to "hide" it in the declarations.
On Mon, Jun 6, 2016 at 2:59 PM, Henri Verbeet hverbeet@gmail.com wrote:
On 6 June 2016 at 11:39, Józef Kucia jkucia@codeweavers.com wrote:
+static BOOL gl_internal_format_equal(const struct wined3d_format *format1,
const struct wined3d_format *format2)
+{
- return format1->id == format2->id
|| (format1->glInternal == format2->glInternal
&& format1->glGammaInternal == format2->glGammaInternal
&& format1->rtInternal == format2->rtInternal);
+}
When would you use this? I was under the impression that Direct3D views were a bit more restricted then OpenGL views and only work between formats based on the same typeless format.
It's mostly for the case when a view is created for a typeless format with depth/stencil internal format in wined3d. The other condition in gl_texture_view_compatible() rejects depth/stencil formats because OpenGL texture views cannot be created between RGB and depth/stencil formats. This condition is more permissive than it should be because I wanted to avoid "regressions". Previously, we allowed creating any shader view with no validation. I guess I could also introduce an additional GLenum field in wined3d_format for GL_VIEW_COMPATIBILITY_CLASS and make the condition in gl_texture_view_compatible() more explicit and clear, i.e. format1->gl_view_class == format2->gl_view_class && format1->typeless_id == format2->typeless_id.