wined3d: Attach render target texture views to FBO.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
73d57ce7a9
commit
e500cf7d97
|
@ -8457,7 +8457,9 @@ static void test_clear_render_target_view(void)
|
|||
check_texture_color(texture, expected_color, 1);
|
||||
}
|
||||
else
|
||||
win_skip("D3D11 is not available, skipping test.\n");
|
||||
{
|
||||
win_skip("D3D11 is not available.\n");
|
||||
}
|
||||
|
||||
ID3D10Device_ClearRenderTargetView(device, srgb_rtv, color);
|
||||
check_texture_color(srgb_texture, expected_srgb_color, 1);
|
||||
|
@ -8494,7 +8496,7 @@ static void test_clear_render_target_view(void)
|
|||
{
|
||||
BOOL broken_device = is_warp_device(device) || is_nvidia_device(device);
|
||||
DWORD color = get_readback_color(&rb, 80 + i * 160, 60 + j * 120);
|
||||
todo_wine ok(compare_color(color, expected_srgb_color, 1)
|
||||
ok(compare_color(color, expected_srgb_color, 1)
|
||||
|| broken(compare_color(color, expected_color, 1) && broken_device),
|
||||
"Got unexpected color 0x%08x.\n", color);
|
||||
}
|
||||
|
|
|
@ -8958,7 +8958,7 @@ static void test_clear_render_target_view(void)
|
|||
{
|
||||
BOOL broken_device = is_warp_device(device) || is_nvidia_device(device);
|
||||
DWORD color = get_readback_color(&rb, 80 + i * 160, 60 + j * 120);
|
||||
todo_wine ok(compare_color(color, expected_srgb_color, 1)
|
||||
ok(compare_color(color, expected_srgb_color, 1)
|
||||
|| broken(compare_color(color, expected_color, 1) && broken_device),
|
||||
"Got unexpected color 0x%08x.\n", color);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
|
|||
WINE_DECLARE_DEBUG_CHANNEL(d3d_synchronous);
|
||||
|
||||
#define WINED3D_MAX_FBO_ENTRIES 64
|
||||
#define WINED3D_ALL_LAYERS (~0u)
|
||||
|
||||
static DWORD wined3d_context_tls_idx;
|
||||
|
||||
|
@ -127,6 +128,17 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
|
|||
{
|
||||
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment, GL_TEXTURE_2D, 0, 0);
|
||||
}
|
||||
else if (resource->layer == WINED3D_ALL_LAYERS)
|
||||
{
|
||||
if (!gl_info->fbo_ops.glFramebufferTexture)
|
||||
{
|
||||
FIXME("OpenGL implementation doesn't support glFramebufferTexture().\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gl_info->fbo_ops.glFramebufferTexture(fbo_target, attachment,
|
||||
resource->object, resource->level);
|
||||
}
|
||||
else if (resource->target == GL_TEXTURE_2D_ARRAY)
|
||||
{
|
||||
if (!gl_info->fbo_ops.glFramebufferTextureLayer)
|
||||
|
@ -138,17 +150,6 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
|
|||
gl_info->fbo_ops.glFramebufferTextureLayer(fbo_target, attachment,
|
||||
resource->object, resource->level, resource->layer);
|
||||
}
|
||||
else if (resource->target == GL_TEXTURE_3D)
|
||||
{
|
||||
if (!gl_info->fbo_ops.glFramebufferTexture)
|
||||
{
|
||||
FIXME("OpenGL implementation doesn't support glFramebufferTexture().\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gl_info->fbo_ops.glFramebufferTexture(fbo_target, attachment,
|
||||
resource->object, resource->level);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment,
|
||||
|
@ -401,6 +402,15 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
|
|||
return;
|
||||
}
|
||||
|
||||
if (render_target->gl_view.name)
|
||||
{
|
||||
key->objects[idx].object = render_target->gl_view.name;
|
||||
key->objects[idx].target = render_target->gl_view.target;
|
||||
key->objects[idx].level = 0;
|
||||
key->objects[idx].layer = WINED3D_ALL_LAYERS;
|
||||
return;
|
||||
}
|
||||
|
||||
texture = wined3d_texture_from_resource(resource);
|
||||
if (resource->type == WINED3D_RTYPE_TEXTURE_2D)
|
||||
{
|
||||
|
@ -423,7 +433,7 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
|
|||
{
|
||||
key->objects[idx].target = texture->target;
|
||||
key->objects[idx].level = sub_resource_idx % texture->level_count;
|
||||
key->objects[idx].layer = 0;
|
||||
key->objects[idx].layer = WINED3D_ALL_LAYERS;
|
||||
}
|
||||
|
||||
switch (location)
|
||||
|
@ -457,7 +467,7 @@ static void context_generate_fbo_key(const struct wined3d_context *context,
|
|||
struct wined3d_surface *depth_stencil_surface, DWORD color_location,
|
||||
DWORD ds_location)
|
||||
{
|
||||
struct wined3d_rendertarget_info depth_stencil = {0};
|
||||
struct wined3d_rendertarget_info depth_stencil = {{0}};
|
||||
unsigned int i;
|
||||
|
||||
key->rb_namespace = 0;
|
||||
|
@ -2732,6 +2742,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
|
|||
{
|
||||
if (rts[i])
|
||||
{
|
||||
context->blit_targets[i].gl_view = rts[i]->gl_view;
|
||||
context->blit_targets[i].resource = rts[i]->resource;
|
||||
context->blit_targets[i].sub_resource_idx = rts[i]->sub_resource_idx;
|
||||
}
|
||||
|
@ -2865,6 +2876,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
|
|||
{
|
||||
if (fb->render_targets[i])
|
||||
{
|
||||
context->blit_targets[i].gl_view = fb->render_targets[i]->gl_view;
|
||||
context->blit_targets[i].resource = fb->render_targets[i]->resource;
|
||||
context->blit_targets[i].sub_resource_idx = fb->render_targets[i]->sub_resource_idx;
|
||||
}
|
||||
|
|
|
@ -1632,8 +1632,15 @@ struct wined3d_timestamp_query
|
|||
void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
|
||||
void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_gl_view
|
||||
{
|
||||
GLenum target;
|
||||
GLuint name;
|
||||
};
|
||||
|
||||
struct wined3d_rendertarget_info
|
||||
{
|
||||
struct wined3d_gl_view gl_view;
|
||||
struct wined3d_resource *resource;
|
||||
unsigned int sub_resource_idx;
|
||||
};
|
||||
|
@ -3375,12 +3382,6 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
|
|||
void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
|
||||
const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_gl_view
|
||||
{
|
||||
GLenum target;
|
||||
GLuint name;
|
||||
};
|
||||
|
||||
struct wined3d_rendertarget_view
|
||||
{
|
||||
LONG refcount;
|
||||
|
|
Loading…
Reference in New Issue