[PATCH 5/5] wined3d: Move the multisample renderbuffers from struct wined3d_texture to struct wined3d_texture_gl.
Henri Verbeet
hverbeet at codeweavers.com
Mon Oct 29 02:17:11 CDT 2018
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
dlls/wined3d/context.c | 4 +--
dlls/wined3d/swapchain.c | 30 ++++++++---------
dlls/wined3d/texture.c | 74 +++++++++++++++++++++---------------------
dlls/wined3d/wined3d_private.h | 6 ++--
4 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index d7d0ec4ed44..9027e94ed09 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -480,14 +480,14 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
break;
case WINED3D_LOCATION_RB_MULTISAMPLE:
- key->objects[idx].object = texture_gl->t.rb_multisample;
+ key->objects[idx].object = texture_gl->rb_multisample;
key->objects[idx].target = 0;
key->objects[idx].level = key->objects[idx].layer = 0;
key->rb_namespace |= 1 << idx;
break;
case WINED3D_LOCATION_RB_RESOLVED:
- key->objects[idx].object = texture_gl->t.rb_resolved;
+ key->objects[idx].object = texture_gl->rb_resolved;
key->objects[idx].target = 0;
key->objects[idx].level = key->objects[idx].layer = 0;
key->rb_namespace |= 1 << idx;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 5cca4be9775..1f0fd108362 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -340,10 +340,10 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
}
/* Context activation is done by the caller. */
-static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct wined3d_context *context)
+static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, struct wined3d_context *context)
{
struct wined3d_texture_sub_resource *sub_resource;
- struct wined3d_texture *texture, *texture_prev;
+ struct wined3d_texture_gl *texture, *texture_prev;
struct gl_texture tex0;
GLuint rb0;
DWORD locations0;
@@ -353,35 +353,35 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
if (swapchain->desc.backbuffer_count < 2 || !swapchain->render_to_fbo)
return;
- texture_prev = swapchain->back_buffers[0];
+ texture_prev = wined3d_texture_gl(swapchain->back_buffers[0]);
/* Back buffer 0 is already in the draw binding. */
- tex0 = texture_prev->texture_rgb;
+ tex0 = texture_prev->t.texture_rgb;
rb0 = texture_prev->rb_multisample;
- locations0 = texture_prev->sub_resources[0].locations;
+ locations0 = texture_prev->t.sub_resources[0].locations;
for (i = 1; i < swapchain->desc.backbuffer_count; ++i)
{
- texture = swapchain->back_buffers[i];
- sub_resource = &texture->sub_resources[0];
+ texture = wined3d_texture_gl(swapchain->back_buffers[i]);
+ sub_resource = &texture->t.sub_resources[0];
if (!(sub_resource->locations & supported_locations))
- wined3d_texture_load_location(texture, 0, context, texture->resource.draw_binding);
+ wined3d_texture_load_location(&texture->t, 0, context, texture->t.resource.draw_binding);
- texture_prev->texture_rgb = texture->texture_rgb;
+ texture_prev->t.texture_rgb = texture->t.texture_rgb;
texture_prev->rb_multisample = texture->rb_multisample;
- wined3d_texture_validate_location(texture_prev, 0, sub_resource->locations & supported_locations);
- wined3d_texture_invalidate_location(texture_prev, 0, ~(sub_resource->locations & supported_locations));
+ wined3d_texture_validate_location(&texture_prev->t, 0, sub_resource->locations & supported_locations);
+ wined3d_texture_invalidate_location(&texture_prev->t, 0, ~(sub_resource->locations & supported_locations));
texture_prev = texture;
}
- texture_prev->texture_rgb = tex0;
+ texture_prev->t.texture_rgb = tex0;
texture_prev->rb_multisample = rb0;
- wined3d_texture_validate_location(texture_prev, 0, locations0 & supported_locations);
- wined3d_texture_invalidate_location(texture_prev, 0, ~(locations0 & supported_locations));
+ wined3d_texture_validate_location(&texture_prev->t, 0, locations0 & supported_locations);
+ wined3d_texture_invalidate_location(&texture_prev->t, 0, ~(locations0 & supported_locations));
device_invalidate_state(swapchain->device, STATE_FRAMEBUFFER);
}
@@ -483,7 +483,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
/* call wglSwapBuffers through the gl table to avoid confusing the Steam overlay */
gl_info->gl_ops.wgl.p_wglSwapBuffers(context->hdc);
- wined3d_swapchain_rotate(swapchain, context);
+ wined3d_swapchain_gl_rotate(swapchain, context);
TRACE("SwapBuffers called, Starting new frame\n");
/* FPS support */
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 74029bfb3d8..42bae136a53 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -664,46 +664,46 @@ static void wined3d_texture_allocate_gl_immutable_storage(struct wined3d_texture
checkGLcall("allocate immutable storage");
}
-static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
+static void wined3d_texture_gl_unload_texture(struct wined3d_texture_gl *texture_gl)
{
- struct wined3d_device *device = texture->resource.device;
+ struct wined3d_device *device = texture_gl->t.resource.device;
const struct wined3d_gl_info *gl_info = NULL;
struct wined3d_context *context = NULL;
- if (texture->texture_rgb.name || texture->texture_srgb.name
- || texture->rb_multisample || texture->rb_resolved)
+ if (texture_gl->t.texture_rgb.name || texture_gl->t.texture_srgb.name
+ || texture_gl->rb_multisample || texture_gl->rb_resolved)
{
context = context_acquire(device, NULL, 0);
gl_info = context->gl_info;
}
- if (texture->texture_rgb.name)
- gltexture_delete(device, context->gl_info, &texture->texture_rgb);
+ if (texture_gl->t.texture_rgb.name)
+ gltexture_delete(device, context->gl_info, &texture_gl->t.texture_rgb);
- if (texture->texture_srgb.name)
- gltexture_delete(device, context->gl_info, &texture->texture_srgb);
+ if (texture_gl->t.texture_srgb.name)
+ gltexture_delete(device, context->gl_info, &texture_gl->t.texture_srgb);
- if (texture->rb_multisample)
+ if (texture_gl->rb_multisample)
{
- TRACE("Deleting multisample renderbuffer %u.\n", texture->rb_multisample);
- context_gl_resource_released(device, texture->rb_multisample, TRUE);
- gl_info->fbo_ops.glDeleteRenderbuffers(1, &texture->rb_multisample);
- texture->rb_multisample = 0;
+ TRACE("Deleting multisample renderbuffer %u.\n", texture_gl->rb_multisample);
+ context_gl_resource_released(device, texture_gl->rb_multisample, TRUE);
+ gl_info->fbo_ops.glDeleteRenderbuffers(1, &texture_gl->rb_multisample);
+ texture_gl->rb_multisample = 0;
}
- if (texture->rb_resolved)
+ if (texture_gl->rb_resolved)
{
- TRACE("Deleting resolved renderbuffer %u.\n", texture->rb_resolved);
- context_gl_resource_released(device, texture->rb_resolved, TRUE);
- gl_info->fbo_ops.glDeleteRenderbuffers(1, &texture->rb_resolved);
- texture->rb_resolved = 0;
+ TRACE("Deleting resolved renderbuffer %u.\n", texture_gl->rb_resolved);
+ context_gl_resource_released(device, texture_gl->rb_resolved, TRUE);
+ gl_info->fbo_ops.glDeleteRenderbuffers(1, &texture_gl->rb_resolved);
+ texture_gl->rb_resolved = 0;
}
if (context) context_release(context);
- wined3d_texture_set_dirty(texture);
+ wined3d_texture_set_dirty(&texture_gl->t);
- resource_unload(&texture->resource);
+ resource_unload(&texture_gl->t.resource);
}
static void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *texture)
@@ -903,7 +903,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
}
heap_free(texture->overlay_info);
}
- wined3d_texture_unload_gl_texture(texture);
}
static void wined3d_texture_gl_cleanup(struct wined3d_texture_gl *texture_gl)
@@ -930,6 +929,7 @@ static void wined3d_texture_gl_cleanup(struct wined3d_texture_gl *texture_gl)
}
wined3d_texture_cleanup(&texture_gl->t);
+ wined3d_texture_gl_unload_texture(texture_gl);
}
void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain)
@@ -1798,39 +1798,39 @@ void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct win
texture->flags |= alloc_flag;
}
-static void wined3d_texture_prepare_rb(struct wined3d_texture *texture,
+static void wined3d_texture_gl_prepare_rb(struct wined3d_texture_gl *texture_gl,
const struct wined3d_gl_info *gl_info, BOOL multisample)
{
const struct wined3d_format_gl *format_gl;
- format_gl = wined3d_format_gl(texture->resource.format);
+ format_gl = wined3d_format_gl(texture_gl->t.resource.format);
if (multisample)
{
DWORD samples;
- if (texture->rb_multisample)
+ if (texture_gl->rb_multisample)
return;
- samples = wined3d_texture_get_gl_sample_count(texture);
+ samples = wined3d_texture_get_gl_sample_count(&texture_gl->t);
- gl_info->fbo_ops.glGenRenderbuffers(1, &texture->rb_multisample);
- gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture->rb_multisample);
+ gl_info->fbo_ops.glGenRenderbuffers(1, &texture_gl->rb_multisample);
+ gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture_gl->rb_multisample);
gl_info->fbo_ops.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- format_gl->internal, texture->resource.width, texture->resource.height);
+ format_gl->internal, texture_gl->t.resource.width, texture_gl->t.resource.height);
checkGLcall("glRenderbufferStorageMultisample()");
- TRACE("Created multisample rb %u.\n", texture->rb_multisample);
+ TRACE("Created multisample rb %u.\n", texture_gl->rb_multisample);
}
else
{
- if (texture->rb_resolved)
+ if (texture_gl->rb_resolved)
return;
- gl_info->fbo_ops.glGenRenderbuffers(1, &texture->rb_resolved);
- gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture->rb_resolved);
+ gl_info->fbo_ops.glGenRenderbuffers(1, &texture_gl->rb_resolved);
+ gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture_gl->rb_resolved);
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format_gl->internal,
- texture->resource.width, texture->resource.height);
+ texture_gl->t.resource.width, texture_gl->t.resource.height);
checkGLcall("glRenderbufferStorage()");
- TRACE("Created resolved rb %u.\n", texture->rb_resolved);
+ TRACE("Created resolved rb %u.\n", texture_gl->rb_resolved);
}
}
@@ -1872,11 +1872,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
return TRUE;
case WINED3D_LOCATION_RB_MULTISAMPLE:
- wined3d_texture_prepare_rb(texture, context->gl_info, TRUE);
+ wined3d_texture_gl_prepare_rb(wined3d_texture_gl(texture), context->gl_info, TRUE);
return TRUE;
case WINED3D_LOCATION_RB_RESOLVED:
- wined3d_texture_prepare_rb(texture, context->gl_info, FALSE);
+ wined3d_texture_gl_prepare_rb(wined3d_texture_gl(texture), context->gl_info, FALSE);
return TRUE;
default:
@@ -2562,7 +2562,7 @@ static void wined3d_texture_gl_unload(struct wined3d_resource *resource)
context_release(context);
wined3d_texture_force_reload(&texture_gl->t);
- wined3d_texture_unload_gl_texture(&texture_gl->t);
+ wined3d_texture_gl_unload_texture(texture_gl);
}
static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e5da3df6363..e4cd7d39984 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3226,9 +3226,6 @@ struct wined3d_texture
GLenum target;
DWORD update_map_binding;
- GLuint rb_multisample;
- GLuint rb_resolved;
-
void *user_memory;
unsigned int row_pitch;
unsigned int slice_pitch;
@@ -3407,6 +3404,9 @@ struct wined3d_texture_gl
{
struct wined3d_texture t;
+ GLuint rb_multisample;
+ GLuint rb_resolved;
+
struct list renderbuffers;
const struct wined3d_renderbuffer_entry *current_renderbuffer;
};
--
2.11.0
More information about the wine-devel
mailing list