From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/adapter_gl.c | 110 +--------- dlls/wined3d/arb_program_shader.c | 27 +-- dlls/wined3d/context_gl.c | 330 ++++++++++-------------------- dlls/wined3d/glsl_shader.c | 27 +-- dlls/wined3d/resource.c | 6 +- dlls/wined3d/shader.c | 4 +- dlls/wined3d/surface.c | 73 +------ dlls/wined3d/swapchain.c | 5 +- dlls/wined3d/texture.c | 34 +-- dlls/wined3d/utils.c | 44 +--- dlls/wined3d/view.c | 10 - dlls/wined3d/wined3d_gl.h | 2 - dlls/wined3d/wined3d_main.c | 1 - dlls/wined3d/wined3d_private.h | 4 - 14 files changed, 137 insertions(+), 540 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index af1a833e410..5539c879199 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -633,8 +633,6 @@ static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, struct w GLuint tex, fbo; GLenum status;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return FALSE; - memset(data, 0xcc, sizeof(data));
gl_info->gl_ops.gl.p_glGenTextures(1, &tex); @@ -735,8 +733,6 @@ static BOOL match_broken_arb_fog(const struct wined3d_gl_info *gl_info, struct w "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n" "END\n";
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - return FALSE; if (!gl_info->supported[ARB_FRAGMENT_PROGRAM]) return FALSE; if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) @@ -823,8 +819,6 @@ static BOOL match_broken_viewport_subpixel_bits(const struct wined3d_gl_info *gl { if (!gl_info->supported[ARB_VIEWPORT_ARRAY]) return FALSE; - if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - return FALSE; return !wined3d_caps_gl_ctx_test_viewport_subpixel_bits(ctx); }
@@ -840,8 +834,6 @@ static BOOL match_no_independent_bit_depths(const struct wined3d_gl_info *gl_inf * relevant case. */ if (!gl_info->supported[ARB_FRAMEBUFFER_OBJECT]) return TRUE; - if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - return TRUE;
gl_info->gl_ops.gl.p_glGenTextures(2, tex);
@@ -2905,7 +2897,7 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) gl_info->limits.general_combiners = gl_max; TRACE("Max general combiners: %d.\n", gl_max); } - if (gl_info->supported[ARB_DRAW_BUFFERS] && wined3d_settings.offscreen_rendering_mode == ORM_FBO) + if (gl_info->supported[ARB_DRAW_BUFFERS]) { gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max); gl_info->limits.buffers = min(WINED3D_MAX_RENDER_TARGETS, gl_max); @@ -3760,11 +3752,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter_gl *adapter_gl, = gl_info->gl_ops.ext.p_glGetFramebufferAttachmentParameterivEXT; gl_info->fbo_ops.glGenerateMipmap = gl_info->gl_ops.ext.p_glGenerateMipmapEXT; } - else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - WARN_(d3d_perf)("Framebuffer objects not supported, falling back to backbuffer offscreen rendering mode.\n"); - wined3d_settings.offscreen_rendering_mode = ORM_BACKBUFFER; - }
if (gl_info->supported[ARB_GEOMETRY_SHADER4]) { @@ -4443,100 +4430,11 @@ static void adapter_gl_get_wined3d_caps(const struct wined3d_adapter *adapter, s } }
-static BOOL wined3d_check_pixel_format_color(const struct wined3d_pixel_format *cfg, - const struct wined3d_format *format) -{ - /* Float formats need FBOs. If FBOs are used this function isn't called */ - if (format->attrs & WINED3D_FORMAT_ATTR_FLOAT) - return FALSE; - - /* Probably a RGBA_float or color index mode. */ - if (cfg->iPixelType != WGL_TYPE_RGBA_ARB) - return FALSE; - - if (cfg->redSize < format->red_size - || cfg->greenSize < format->green_size - || cfg->blueSize < format->blue_size - || cfg->alphaSize < format->alpha_size) - return FALSE; - - return TRUE; -} - -static BOOL wined3d_check_pixel_format_depth(const struct wined3d_pixel_format *cfg, - const struct wined3d_format *format) -{ - BOOL lockable = FALSE; - - /* Float formats need FBOs. If FBOs are used this function isn't called */ - if (format->attrs & WINED3D_FORMAT_ATTR_FLOAT) - return FALSE; - - if ((format->id == WINED3DFMT_D16_LOCKABLE) || (format->id == WINED3DFMT_D32_FLOAT)) - lockable = TRUE; - - /* On some modern cards like the Geforce8/9, GLX doesn't offer some - * depth/stencil formats which D3D9 reports. We can safely report - * "compatible" formats (e.g. D24 can be used for D16) as long as we - * aren't dealing with a lockable format. This also helps D3D <= 7 as they - * expect D16 which isn't offered without this on Geforce8 cards. */ - if (!(cfg->depthSize == format->depth_size || (!lockable && cfg->depthSize > format->depth_size))) - return FALSE; - - /* Some cards like Intel i915 ones only offer D24S8 but lots of games also - * need a format without stencil. We can allow a mismatch if the format - * doesn't have any stencil bits. If it does have stencil bits the size - * must match, or stencil wrapping would break. */ - if (format->stencil_size && cfg->stencilSize != format->stencil_size) - return FALSE; - - return TRUE; -} - static BOOL adapter_gl_check_format(const struct wined3d_adapter *adapter, const struct wined3d_format *adapter_format, const struct wined3d_format *rt_format, const struct wined3d_format *ds_format) { - const struct wined3d_adapter_gl *adapter_gl = wined3d_adapter_gl_const(adapter); - unsigned int i; - - if (wined3d_settings.offscreen_rendering_mode != ORM_BACKBUFFER) - return TRUE; - - if (adapter_format && rt_format) - { - /* In backbuffer mode the front and backbuffer share the same WGL - * pixelformat. The format must match in RGB, alpha is allowed to be - * different. (Only the backbuffer can have alpha.) */ - if (adapter_format->red_size != rt_format->red_size - || adapter_format->green_size != rt_format->green_size - || adapter_format->blue_size != rt_format->blue_size) - { - TRACE("Render target format %s doesn't match with adapter format %s.\n", - debug_d3dformat(rt_format->id), debug_d3dformat(adapter_format->id)); - return FALSE; - } - } - - for (i = 0; i < adapter_gl->pixel_format_count; ++i) - { - const struct wined3d_pixel_format *cfg = &adapter_gl->pixel_formats[i]; - - /* Check if there is a WGL pixel format matching the requirements, the format should also be window - * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */ - if (adapter_format && rt_format && !cfg->windowDrawable) - continue; - - if ((!adapter_format || wined3d_check_pixel_format_color(cfg, adapter_format)) - && (!rt_format || wined3d_check_pixel_format_color(cfg, rt_format)) - && (!ds_format || wined3d_check_pixel_format_depth(cfg, ds_format))) - { - TRACE("Pixel format %d is compatible.\n", cfg->iPixelFormat); - return TRUE; - } - } - - return FALSE; + return TRUE; }
static HRESULT adapter_gl_init_3d(struct wined3d_device *device) @@ -5204,9 +5102,6 @@ static float wined3d_adapter_find_fill_offset(struct wined3d_caps_gl_ctx *ctx) unsigned int upper = ARRAY_SIZE(test_array), lower = 0, test; float value;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - goto end; - while (upper != lower) { test = (upper + lower) / 2; @@ -5231,7 +5126,6 @@ static float wined3d_adapter_find_fill_offset(struct wined3d_caps_gl_ctx *ctx)
FIXME("Did not find a way to get the filling convention we want.\n");
-end: /* This value was used unconditionally before the dynamic test function was * introduced. */ return -1.0f / 64.0f; diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 4e5e3482dfd..fd58f8b080b 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7691,12 +7691,6 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine /* We only support YUV conversions. */ if (!is_complex_fixup(src_format->color_fixup)) { - if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) - { - WARN("Claiming fixup support because of ORM_BACKBUFFER.\n"); - return TRUE; - } - TRACE("[FAILED]\n"); return FALSE; } @@ -7733,7 +7727,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl struct wined3d_color_key alpha_test_key; struct wined3d_blitter *next; unsigned int src_level; - RECT s, d; + RECT d;
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, " "src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, " @@ -7794,25 +7788,6 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl src_texture_gl = wined3d_texture_gl(src_texture); src_sub_resource_idx = 0; } - else if (wined3d_settings.offscreen_rendering_mode != ORM_FBO - && (src_texture->sub_resources[src_sub_resource_idx].locations - & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE)) == WINED3D_LOCATION_DRAWABLE - && !wined3d_resource_is_offscreen(&src_texture->resource)) - { - - /* Without FBO blits transferring from the drawable to the texture is - * expensive, because we have to flip the data in sysmem. Since we can - * flip in the blitter, we don't actually need that flip anyway. So we - * use the surface's texture as scratch texture, and flip the source - * rectangle instead. */ - texture2d_load_fb_texture(src_texture_gl, src_sub_resource_idx, FALSE, context); - - s = *src_rect; - src_level = src_sub_resource_idx % src_texture->level_count; - s.top = wined3d_texture_get_level_height(src_texture, src_level) - s.top; - s.bottom = wined3d_texture_get_level_height(src_texture, src_level) - s.bottom; - src_rect = &s; - } else { wined3d_texture_load(src_texture, context, FALSE); diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index a1561f78133..a7caef64b46 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -1937,7 +1937,6 @@ static BOOL wined3d_context_gl_create_wgl_ctx(struct wined3d_context_gl *context struct wined3d_device *device; bool swap_effect_copy; HGLRC ctx, share_ctx; - unsigned int i;
device = context->device; adapter = device->adapter; @@ -1950,73 +1949,18 @@ static BOOL wined3d_context_gl_create_wgl_ctx(struct wined3d_context_gl *context
*new_drawable = !GetPixelFormat(context_gl->dc);
- if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) - { - static const enum wined3d_format_id ds_formats[] = - { - WINED3DFMT_D24_UNORM_S8_UINT, - WINED3DFMT_D32_UNORM, - WINED3DFMT_R24_UNORM_X8_TYPELESS, - WINED3DFMT_D16_UNORM, - WINED3DFMT_S1_UINT_D15_UNORM, - }; - - colour_format = target->format; - - /* In case of ORM_BACKBUFFER, make sure to request an alpha component for - * X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */ - if (colour_format->id == WINED3DFMT_B4G4R4X4_UNORM) - colour_format = wined3d_get_format(adapter, WINED3DFMT_B4G4R4A4_UNORM, target_bind_flags); - else if (colour_format->id == WINED3DFMT_B8G8R8X8_UNORM) - colour_format = wined3d_get_format(adapter, WINED3DFMT_B8G8R8A8_UNORM, target_bind_flags); - - /* DirectDraw supports 8bit paletted render targets and these are used by - * old games like StarCraft and C&C. Most modern hardware doesn't support - * 8bit natively so we perform some form of 8bit -> 32bit conversion. The - * conversion (ab)uses the alpha component for storing the palette index. - * For this reason we require a format with 8bit alpha, so request - * A8R8G8B8. */ - if (colour_format->id == WINED3DFMT_P8_UINT) - colour_format = wined3d_get_format(adapter, WINED3DFMT_B8G8R8A8_UNORM, target_bind_flags); - - /* Try to find a pixel format which matches our requirements. */ - if (!swapchain_gl->s.ds_format) - { - for (i = 0; i < ARRAY_SIZE(ds_formats); ++i) - { - ds_format = wined3d_get_format(adapter, ds_formats[i], WINED3D_BIND_DEPTH_STENCIL); - if ((context_gl->pixel_format = context_choose_pixel_format(device, - context_gl->dc, colour_format, ds_format, true, swap_effect_copy))) - { - swapchain_gl->s.ds_format = ds_format; - break; - } - - TRACE("Depth stencil format %s is not supported, trying next format.\n", - debug_d3dformat(ds_format->id)); - } - } - else - { - context_gl->pixel_format = context_choose_pixel_format(device, - context_gl->dc, colour_format, swapchain_gl->s.ds_format, true, swap_effect_copy); - } - } - else - { - /* When using FBOs for off-screen rendering, we only use the drawable for - * presentation blits, and don't do any rendering to it. That means we - * don't need depth or stencil buffers, and can mostly ignore the render - * target format. This wouldn't necessarily be quite correct for 10bpc - * display modes, but we don't currently support those. - * Using the same format regardless of the colour/depth/stencil targets - * makes it much less likely that different wined3d instances will set - * conflicting pixel formats. */ - colour_format = wined3d_get_format(adapter, WINED3DFMT_B8G8R8A8_UNORM, target_bind_flags); - ds_format = wined3d_get_format(adapter, WINED3DFMT_UNKNOWN, WINED3D_BIND_DEPTH_STENCIL); - context_gl->pixel_format = context_choose_pixel_format(device, - context_gl->dc, colour_format, ds_format, false, swap_effect_copy); - } + /* When using FBOs for off-screen rendering, we only use the drawable for + * presentation blits, and don't do any rendering to it. That means we + * don't need depth or stencil buffers, and can mostly ignore the render + * target format. This wouldn't necessarily be quite correct for 10bpc + * display modes, but we don't currently support those. + * Using the same format regardless of the colour/depth/stencil targets + * makes it much less likely that different wined3d instances will set + * conflicting pixel formats. */ + colour_format = wined3d_get_format(adapter, WINED3DFMT_B8G8R8A8_UNORM, target_bind_flags); + ds_format = wined3d_get_format(adapter, WINED3DFMT_UNKNOWN, WINED3D_BIND_DEPTH_STENCIL); + context_gl->pixel_format = context_choose_pixel_format(device, + context_gl->dc, colour_format, ds_format, false, swap_effect_copy);
if (!context_gl->pixel_format) { @@ -2500,33 +2444,26 @@ static void wined3d_context_gl_apply_draw_buffers(struct wined3d_context_gl *con } else { - if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - unsigned int i = 0; + unsigned int i = 0;
- while (rt_mask) - { - if (rt_mask & 1) - draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i; - else - draw_buffers[i] = GL_NONE; + while (rt_mask) + { + if (rt_mask & 1) + draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i; + else + draw_buffers[i] = GL_NONE;
- rt_mask >>= 1; - ++i; - } + rt_mask >>= 1; + ++i; + }
- if (gl_info->supported[ARB_DRAW_BUFFERS]) - { - GL_EXTCALL(glDrawBuffers(i, draw_buffers)); - } - else - { - gl_info->gl_ops.gl.p_glDrawBuffer(draw_buffers[0]); - } + if (gl_info->supported[ARB_DRAW_BUFFERS]) + { + GL_EXTCALL(glDrawBuffers(i, draw_buffers)); } else { - ERR("Unexpected draw buffers mask with backbuffer ORM.\n"); + gl_info->gl_ops.gl.p_glDrawBuffer(draw_buffers[0]); } }
@@ -3239,18 +3176,7 @@ static void wined3d_context_gl_set_render_offscreen(struct wined3d_context_gl *c
GLenum wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_gl *context_gl) { - switch (wined3d_settings.offscreen_rendering_mode) - { - case ORM_FBO: - return GL_COLOR_ATTACHMENT0; - - case ORM_BACKBUFFER: - return context_gl->aux_buffers > 0 ? GL_AUX0 : GL_BACK; - - default: - FIXME("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode); - return GL_BACK; - } + return GL_COLOR_ATTACHMENT0; }
static uint32_t wined3d_context_gl_generate_rt_mask_no_fbo(const struct wined3d_context_gl *context_gl, @@ -3493,64 +3419,56 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, if (isStateDirty(&context_gl->c, STATE_FRAMEBUFFER) || fb != &state->fb || rt_count != gl_info->limits.buffers) { + struct wined3d_rendertarget_info ds_info = {{0}}; + if (!have_framebuffer_attachment(rt_count, rts, dsv)) { WARN("Invalid render target config, need at least one attachment.\n"); return FALSE; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + if (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)) { - struct wined3d_rendertarget_info ds_info = {{0}}; - - if (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)) + memset(context_gl->blit_targets, 0, sizeof(context_gl->blit_targets)); + for (i = 0; i < rt_count; ++i) { - memset(context_gl->blit_targets, 0, sizeof(context_gl->blit_targets)); - for (i = 0; i < rt_count; ++i) + if (rts[i]) { - if (rts[i]) - { - struct wined3d_rendertarget_view_gl *rtv_gl = wined3d_rendertarget_view_gl(rts[i]); - context_gl->blit_targets[i].gl_view = rtv_gl->gl_view; - context_gl->blit_targets[i].resource = rtv_gl->v.resource; - context_gl->blit_targets[i].sub_resource_idx = rtv_gl->v.sub_resource_idx; - context_gl->blit_targets[i].layer_count = rtv_gl->v.layer_count; - } - if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL) - rt_mask |= (1u << i); + struct wined3d_rendertarget_view_gl *rtv_gl = wined3d_rendertarget_view_gl(rts[i]); + context_gl->blit_targets[i].gl_view = rtv_gl->gl_view; + context_gl->blit_targets[i].resource = rtv_gl->v.resource; + context_gl->blit_targets[i].sub_resource_idx = rtv_gl->v.sub_resource_idx; + context_gl->blit_targets[i].layer_count = rtv_gl->v.layer_count; } - - if (dsv) - { - struct wined3d_rendertarget_view_gl *dsv_gl = wined3d_rendertarget_view_gl(dsv); - ds_info.gl_view = dsv_gl->gl_view; - ds_info.resource = dsv_gl->v.resource; - ds_info.sub_resource_idx = dsv_gl->v.sub_resource_idx; - ds_info.layer_count = dsv_gl->v.layer_count; - } - - wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, context_gl->blit_targets, &ds_info, - rt_count ? rts[0]->resource->draw_binding : 0, dsv ? dsv->resource->draw_binding : 0); + if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL) + rt_mask |= (1u << i); } - else + + if (dsv) { - wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, NULL, &ds_info, - WINED3D_LOCATION_DRAWABLE, WINED3D_LOCATION_DRAWABLE); - rt_mask = context_generate_rt_mask_from_resource(rts[0]->resource); + struct wined3d_rendertarget_view_gl *dsv_gl = wined3d_rendertarget_view_gl(dsv); + ds_info.gl_view = dsv_gl->gl_view; + ds_info.resource = dsv_gl->v.resource; + ds_info.sub_resource_idx = dsv_gl->v.sub_resource_idx; + ds_info.layer_count = dsv_gl->v.layer_count; }
- /* If the framebuffer is not the device's fb the device's fb has to be reapplied - * next draw. Otherwise we could mark the framebuffer state clean here, once the - * state management allows this */ - context_invalidate_state(&context_gl->c, STATE_FRAMEBUFFER); + wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, context_gl->blit_targets, &ds_info, + rt_count ? rts[0]->resource->draw_binding : 0, dsv ? dsv->resource->draw_binding : 0); } else { - rt_mask = wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, rt_count ? rts[0]->resource : NULL); + wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, NULL, &ds_info, + WINED3D_LOCATION_DRAWABLE, WINED3D_LOCATION_DRAWABLE); + rt_mask = context_generate_rt_mask_from_resource(rts[0]->resource); } + + /* If the framebuffer is not the device's fb the device's fb has to be reapplied + * next draw. Otherwise we could mark the framebuffer state clean here, once the + * state management allows this */ + context_invalidate_state(&context_gl->c, STATE_FRAMEBUFFER); } - else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO - && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) + else if (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)) { for (i = 0; i < rt_count; ++i) { @@ -3572,8 +3490,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, context_invalidate_state(&context_gl->c, STATE_FRAMEBUFFER); }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - wined3d_context_gl_check_fbo_status(context_gl, GL_FRAMEBUFFER); + wined3d_context_gl_check_fbo_status(context_gl, GL_FRAMEBUFFER);
context_gl->c.last_was_blit = FALSE; context_gl->c.last_was_ffp_blit = FALSE; @@ -3608,9 +3525,7 @@ static uint32_t find_draw_buffers_mask(const struct wined3d_context_gl *context_ unsigned int rt_mask, mask; unsigned int i;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - return wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, rts[0]->resource); - else if (!context_gl->c.render_offscreen) + if (!context_gl->c.render_offscreen) return context_generate_rt_mask_from_resource(rts[0]->resource);
rt_mask = ps ? ps->reg_maps.rt_mask : 1; @@ -3639,33 +3554,23 @@ void context_gl_apply_texture_draw_state(struct wined3d_context_gl *context_gl, TRACE("context_gl %p, texture %p, sub_resource_idx %u, location %s.\n", context_gl, texture, sub_resource_idx, wined3d_debug_location(location));
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - if (format->depth_size || format->stencil_size) - wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_DRAW_FRAMEBUFFER, NULL, - 0, &texture->resource, sub_resource_idx, location); - else - wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_DRAW_FRAMEBUFFER, &texture->resource, - sub_resource_idx, NULL, 0, location); - } + if (format->depth_size || format->stencil_size) + wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_DRAW_FRAMEBUFFER, NULL, + 0, &texture->resource, sub_resource_idx, location); + else + wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_DRAW_FRAMEBUFFER, &texture->resource, + sub_resource_idx, NULL, 0, location);
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + if (location != WINED3D_LOCATION_DRAWABLE) { - if (location != WINED3D_LOCATION_DRAWABLE) - { - if (texture->resource.format->id == WINED3DFMT_NULL || format->depth_size || format->stencil_size) - rt_mask = 0; - else - rt_mask = 1; - } + if (texture->resource.format->id == WINED3DFMT_NULL || format->depth_size || format->stencil_size) + rt_mask = 0; else - { - rt_mask = context_generate_rt_mask_from_resource(&texture->resource); - } + rt_mask = 1; } else { - rt_mask = wined3d_context_gl_generate_rt_mask_no_fbo(context_gl, &texture->resource); + rt_mask = context_generate_rt_mask_from_resource(&texture->resource); }
cur_mask = context_gl->current_fbo ? &context_gl->current_fbo->rt_mask : &context_gl->draw_buffers_mask; @@ -3675,8 +3580,7 @@ void context_gl_apply_texture_draw_state(struct wined3d_context_gl *context_gl, *cur_mask = rt_mask; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER); + wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER); } @@ -3686,52 +3590,48 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat { struct wined3d_context_gl *context_gl = wined3d_context_gl(context); uint32_t rt_mask = find_draw_buffers_mask(context_gl, state); + struct wined3d_rendertarget_info ds_info = {{0}}; const struct wined3d_fb_state *fb = &state->fb; DWORD color_location = 0; uint32_t *cur_mask;
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + if (!context->render_offscreen) { - struct wined3d_rendertarget_info ds_info = {{0}}; + wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, NULL, &ds_info, + WINED3D_LOCATION_DRAWABLE, WINED3D_LOCATION_DRAWABLE); + } + else + { + const struct wined3d_rendertarget_view_gl *view_gl; + unsigned int i;
- if (!context->render_offscreen) - { - wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, NULL, &ds_info, - WINED3D_LOCATION_DRAWABLE, WINED3D_LOCATION_DRAWABLE); - } - else + memset(context_gl->blit_targets, 0, sizeof(context_gl->blit_targets)); + for (i = 0; i < context_gl->gl_info->limits.buffers; ++i) { - const struct wined3d_rendertarget_view_gl *view_gl; - unsigned int i; - - memset(context_gl->blit_targets, 0, sizeof(context_gl->blit_targets)); - for (i = 0; i < context_gl->gl_info->limits.buffers; ++i) - { - if (!fb->render_targets[i]) - continue; - - view_gl = wined3d_rendertarget_view_gl(fb->render_targets[i]); - context_gl->blit_targets[i].gl_view = view_gl->gl_view; - context_gl->blit_targets[i].resource = view_gl->v.resource; - context_gl->blit_targets[i].sub_resource_idx = view_gl->v.sub_resource_idx; - context_gl->blit_targets[i].layer_count = view_gl->v.layer_count; + if (!fb->render_targets[i]) + continue;
- if (!color_location) - color_location = view_gl->v.resource->draw_binding; - } + view_gl = wined3d_rendertarget_view_gl(fb->render_targets[i]); + context_gl->blit_targets[i].gl_view = view_gl->gl_view; + context_gl->blit_targets[i].resource = view_gl->v.resource; + context_gl->blit_targets[i].sub_resource_idx = view_gl->v.sub_resource_idx; + context_gl->blit_targets[i].layer_count = view_gl->v.layer_count;
- if (fb->depth_stencil) - { - view_gl = wined3d_rendertarget_view_gl(fb->depth_stencil); - ds_info.gl_view = view_gl->gl_view; - ds_info.resource = view_gl->v.resource; - ds_info.sub_resource_idx = view_gl->v.sub_resource_idx; - ds_info.layer_count = view_gl->v.layer_count; - } + if (!color_location) + color_location = view_gl->v.resource->draw_binding; + }
- wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, context_gl->blit_targets, &ds_info, - color_location, fb->depth_stencil ? fb->depth_stencil->resource->draw_binding : 0); + if (fb->depth_stencil) + { + view_gl = wined3d_rendertarget_view_gl(fb->depth_stencil); + ds_info.gl_view = view_gl->gl_view; + ds_info.resource = view_gl->v.resource; + ds_info.sub_resource_idx = view_gl->v.sub_resource_idx; + ds_info.layer_count = view_gl->v.layer_count; } + + wined3d_context_gl_apply_fbo_state(context_gl, GL_FRAMEBUFFER, context_gl->blit_targets, &ds_info, + color_location, fb->depth_stencil ? fb->depth_stencil->resource->draw_binding : 0); }
cur_mask = context_gl->current_fbo ? &context_gl->current_fbo->rt_mask : &context_gl->draw_buffers_mask; @@ -4437,8 +4337,7 @@ static BOOL context_apply_draw_state(struct wined3d_context *context, context->update_compute_unordered_access_view_bindings = 1; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - wined3d_context_gl_check_fbo_status(context_gl, GL_FRAMEBUFFER); + wined3d_context_gl_check_fbo_status(context_gl, GL_FRAMEBUFFER);
/* WINED3D_SHADER_CONST_PS_NP2_FIXUP may be set when binding shader * resources, so constant loading needs to be done after that. */ @@ -4574,27 +4473,6 @@ static void wined3d_context_gl_setup_target(struct wined3d_context_gl *context_g || !(texture->resource.format_caps & WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING)) context_invalidate_state(&context_gl->c, STATE_BLEND); } - - /* When switching away from an offscreen render target, and we're not - * using FBOs, we have to read the drawable into the texture. This is - * done via PreLoad (and WINED3D_LOCATION_DRAWABLE set on the surface). - * There are some things that need care though. PreLoad needs a GL context, - * and FindContext is called before the context is activated. It also - * has to be called with the old rendertarget active, otherwise a - * wrong drawable is read. */ - if (wined3d_settings.offscreen_rendering_mode != ORM_FBO - && old_render_offscreen && (context_gl->c.current_rt.texture != texture - || context_gl->c.current_rt.sub_resource_idx != sub_resource_idx)) - { - struct wined3d_texture_gl *prev_texture = wined3d_texture_gl(context_gl->c.current_rt.texture); - unsigned int prev_sub_resource_idx = context_gl->c.current_rt.sub_resource_idx; - - /* Read the back buffer of the old drawable into the destination texture. */ - if (prev_texture->texture_srgb.name) - wined3d_texture_load(&prev_texture->t, &context_gl->c, TRUE); - wined3d_texture_load(&prev_texture->t, &context_gl->c, FALSE); - wined3d_texture_invalidate_location(&prev_texture->t, prev_sub_resource_idx, WINED3D_LOCATION_DRAWABLE); - } }
context_gl->c.current_rt.texture = texture; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 6d582896bb2..21006d3cf46 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -8019,8 +8019,7 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_ shader_glsl_append_imm_vec(buffer, &wined3d_srgb_const[1].x, 4, gl_info); shader_addline(buffer, ";\n"); } - if ((reg_maps->usesdsy && wined3d_settings.offscreen_rendering_mode != ORM_FBO) - || (reg_maps->vpos && !gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS])) + if (reg_maps->vpos && !gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS]) { ++extra_constants_needed; shader_addline(buffer, "uniform vec4 ycorrection;\n"); @@ -13418,8 +13417,7 @@ static BOOL glsl_blitter_supported(enum wined3d_blit_op blit_op, const struct wi return FALSE; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO - && !((dst_format->caps[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3D_FORMAT_CAP_FBO_ATTACHABLE) + if (!((dst_format->caps[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3D_FORMAT_CAP_FBO_ATTACHABLE) || (dst_resource->bind_flags & WINED3D_BIND_RENDER_TARGET))) { TRACE("Destination texture is not FBO attachable.\n"); @@ -13449,7 +13447,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli struct wined3d_blitter *next; unsigned int src_level; GLint location; - RECT s, d; + RECT d;
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, " "src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, " @@ -13510,25 +13508,6 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli src_texture_gl = wined3d_texture_gl(src_texture); src_sub_resource_idx = 0; } - else if (wined3d_settings.offscreen_rendering_mode != ORM_FBO - && (src_texture->sub_resources[src_sub_resource_idx].locations - & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE)) == WINED3D_LOCATION_DRAWABLE - && !wined3d_resource_is_offscreen(&src_texture->resource)) - { - - /* Without FBO blits transferring from the drawable to the texture is - * expensive, because we have to flip the data in sysmem. Since we can - * flip in the blitter, we don't actually need that flip anyway. So we - * use the surface's texture as scratch texture, and flip the source - * rectangle instead. */ - texture2d_load_fb_texture(src_texture_gl, src_sub_resource_idx, FALSE, context); - - s = *src_rect; - src_level = src_sub_resource_idx % src_texture->level_count; - s.top = wined3d_texture_get_level_height(src_texture, src_level) - s.top; - s.bottom = wined3d_texture_get_level_height(src_texture, src_level) - s.bottom; - src_rect = &s; - } else { wined3d_texture_load(src_texture, context, FALSE); diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index bd8391ec3b3..e336e0048e0 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -436,16 +436,14 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) if (resource == &swapchain->front_buffer->resource) return FALSE;
- /* If the swapchain is rendered to an FBO, the backbuffer is - * offscreen, otherwise onscreen */ - return wined3d_settings.offscreen_rendering_mode == ORM_FBO; + return TRUE; }
void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) { const struct wined3d_d3d_info *d3d_info = &resource->device->adapter->d3d_info;
- if (!wined3d_resource_is_offscreen(resource) || wined3d_settings.offscreen_rendering_mode != ORM_FBO) + if (!wined3d_resource_is_offscreen(resource)) { resource->draw_binding = WINED3D_LOCATION_DRAWABLE; } diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index e6a3b4a33bb..a5dabc1f344 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3056,9 +3056,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 if (d3d_info->emulated_flatshading) args->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
- args->y_correction = (shader->reg_maps.vpos && d3d_info->frag_coord_correction) - || (shader->reg_maps.usesdsy && wined3d_settings.offscreen_rendering_mode != ORM_FBO) - ? !context->render_offscreen : 0; + args->y_correction = (shader->reg_maps.vpos && d3d_info->frag_coord_correction) ? !context->render_offscreen : 0;
for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i) { diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index e413689599d..b37a84b0086 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -375,15 +375,12 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i context_gl = wined3d_context_gl(context); gl_info = context_gl->gl_info;
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - if (resource->format->depth_size || resource->format->stencil_size) - wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_READ_FRAMEBUFFER, - NULL, 0, resource, sub_resource_idx, src_location); - else - wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_READ_FRAMEBUFFER, - resource, sub_resource_idx, NULL, 0, src_location); - } + if (resource->format->depth_size || resource->format->stencil_size) + wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_READ_FRAMEBUFFER, + NULL, 0, resource, sub_resource_idx, src_location); + else + wined3d_context_gl_apply_fbo_state_explicit(context_gl, GL_READ_FRAMEBUFFER, + resource, sub_resource_idx, NULL, 0, src_location);
/* Select the correct read buffer, and give some debug output. There is no * need to keep track of the current read buffer or reset it, every part @@ -405,8 +402,7 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i src_is_upside_down = FALSE; } checkGLcall("glReadBuffer"); - if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER); + wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER);
if (data.buffer_object) { @@ -481,58 +477,6 @@ error: context_restore(context, restore_texture, restore_idx); }
-/* Read the framebuffer contents into a texture. Note that this function - * doesn't do any kind of flipping. Using this on an onscreen surface will - * result in a flipped D3D texture. - * - * Context activation is done by the caller. This function may temporarily - * switch to a different context and restore the original one before return. */ -void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, - unsigned int sub_resource_idx, BOOL srgb, struct wined3d_context *context) -{ - struct wined3d_texture *restore_texture; - const struct wined3d_gl_info *gl_info; - struct wined3d_context_gl *context_gl; - struct wined3d_resource *resource; - unsigned int restore_idx, level; - struct wined3d_device *device; - GLenum target; - - resource = &texture_gl->t.resource; - device = resource->device; - restore_texture = context->current_rt.texture; - restore_idx = context->current_rt.sub_resource_idx; - if (restore_texture != &texture_gl->t || restore_idx != sub_resource_idx) - context = context_acquire(device, &texture_gl->t, sub_resource_idx); - else - restore_texture = NULL; - context_gl = wined3d_context_gl(context); - - gl_info = context_gl->gl_info; - device_invalidate_state(device, STATE_FRAMEBUFFER); - - wined3d_texture_gl_prepare_texture(texture_gl, context_gl, srgb); - wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, srgb); - - TRACE("Reading back offscreen render target %p, %u.\n", texture_gl, sub_resource_idx); - - if (wined3d_resource_is_offscreen(resource)) - gl_info->gl_ops.gl.p_glReadBuffer(wined3d_context_gl_get_offscreen_gl_buffer(context_gl)); - else - gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(&texture_gl->t)); - checkGLcall("glReadBuffer"); - - level = sub_resource_idx % texture_gl->t.level_count; - target = wined3d_texture_gl_get_sub_resource_target(texture_gl, sub_resource_idx); - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(target, level, 0, 0, 0, 0, - wined3d_texture_get_level_width(&texture_gl->t, level), - wined3d_texture_get_level_height(&texture_gl->t, level)); - checkGLcall("glCopyTexSubImage2D"); - - if (restore_texture) - context_restore(context, restore_texture, restore_idx); -} - /* Context activation is done by the caller. */ static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context) { @@ -1467,8 +1411,7 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ dst_swapchain = dst_texture->swapchain;
if (src_swapchain && dst_swapchain && src_swapchain != dst_swapchain - && (wined3d_settings.offscreen_rendering_mode != ORM_FBO - || src_texture == src_swapchain->front_buffer)) + && src_texture == src_swapchain->front_buffer) { /* TODO: We could support cross-swapchain blits by first downloading * the source to a texture. */ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index c18ac0afefc..6b2ad8d6954 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -523,7 +523,7 @@ static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, str unsigned int i; static const DWORD supported_locations = WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_RB_MULTISAMPLE;
- if (swapchain->state.desc.backbuffer_count < 2 || wined3d_settings.offscreen_rendering_mode != ORM_FBO) + if (swapchain->state.desc.backbuffer_count < 2) return;
texture_prev = wined3d_texture_gl(swapchain->back_buffers[0]); @@ -615,8 +615,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
wined3d_texture_load_location(back_buffer, 0, context, back_buffer->resource.draw_binding);
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - swapchain_blit(swapchain, context, src_rect, dst_rect); + swapchain_blit(swapchain, context, src_rect, dst_rect);
if (swapchain->device->context_count > 1) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 2fc6d5c06df..9edfc38c01c 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -287,9 +287,6 @@ static bool fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win const struct wined3d_format *dst_format = dst_resource->format; bool src_ds, dst_ds;
- if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer) - return false; - if ((src_resource->format_attrs | dst_resource->format_attrs) & WINED3D_FORMAT_ATTR_HEIGHT_SCALE) return false;
@@ -3037,8 +3034,7 @@ static BOOL wined3d_texture_load_drawable(struct wined3d_texture *texture, return FALSE; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO - && wined3d_resource_is_offscreen(&texture->resource)) + if (wined3d_resource_is_offscreen(&texture->resource)) { ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n"); return FALSE; @@ -3112,16 +3108,6 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
depth = texture_gl->t.resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL; sub_resource = &texture_gl->t.sub_resources[sub_resource_idx]; - - if (!depth && wined3d_settings.offscreen_rendering_mode != ORM_FBO - && wined3d_resource_is_offscreen(&texture_gl->t.resource) - && (sub_resource->locations & WINED3D_LOCATION_DRAWABLE)) - { - texture2d_load_fb_texture(texture_gl, sub_resource_idx, srgb, &context_gl->c); - - return TRUE; - } - level = sub_resource_idx % texture_gl->t.level_count; wined3d_texture_get_level_box(&texture_gl->t, level, &src_box);
@@ -3269,7 +3255,7 @@ static BOOL wined3d_texture_gl_prepare_location(struct wined3d_texture *texture, return TRUE;
case WINED3D_LOCATION_DRAWABLE: - if (!texture->swapchain && wined3d_settings.offscreen_rendering_mode != ORM_BACKBUFFER) + if (!texture->swapchain) ERR("Texture %p does not have a drawable.\n", texture); return TRUE;
@@ -3292,12 +3278,6 @@ static bool use_ffp_clear(const struct wined3d_texture *texture, unsigned int lo if (location == WINED3D_LOCATION_DRAWABLE) return true;
- /* If we are not using FBOs (and not rendering to the drawable), always - * upload. The upload should always succeed in this case; we cannot have - * ARB_texture_multisample without ARB_framebuffer_object. */ - if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - return false; - if (location == WINED3D_LOCATION_TEXTURE_RGB && !(texture->resource.format_caps & WINED3D_FORMAT_CAP_FBO_ATTACHABLE)) return false; @@ -5859,9 +5839,7 @@ static bool ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3 { if (dst_format->id == src_format->id && dst_location == WINED3D_LOCATION_DRAWABLE) { - if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) - WARN("Claiming fixup support because of ORM_BACKBUFFER.\n"); - else if (context->device->shader_backend == &none_shader_backend) + if (context->device->shader_backend == &none_shader_backend) WARN("Claiming fixup support because of no shader backend.\n"); return true; } @@ -6173,8 +6151,7 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
if (blitter_use_cpu_clear(view) || (!(view->resource->bind_flags & WINED3D_BIND_RENDER_TARGET) - && (wined3d_settings.offscreen_rendering_mode != ORM_FBO - || !(view->format_caps & WINED3D_FORMAT_CAP_FBO_ATTACHABLE)))) + && !(view->format_caps & WINED3D_FORMAT_CAP_FBO_ATTACHABLE))) { next_flags |= WINED3DCLEAR_TARGET; flags &= ~WINED3DCLEAR_TARGET; @@ -6523,9 +6500,6 @@ void wined3d_fbo_blitter_create(struct wined3d_blitter **next, const struct wine { struct wined3d_blitter *blitter;
- if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer) - return; - if (!(blitter = malloc(sizeof(*blitter)))) return;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index dcbc177d29e..8af50fbbf06 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -2905,13 +2905,10 @@ static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter, return; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - gl_info->fbo_ops.glGenFramebuffers(1, &fbo); - gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo); - gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0); - gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0); - } + gl_info->fbo_ops.glGenFramebuffers(1, &fbo); + gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo); + gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0); + gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
for (i = 0; i < WINED3D_FORMAT_COUNT; ++i) { @@ -2927,19 +2924,11 @@ static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter, continue; }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->f.id)); - check_fbo_compat(ctx, format); - } - else - { - format->rt_internal = format->internal; - } + TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->f.id)); + check_fbo_compat(ctx, format); }
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo); + gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo); }
static GLenum lookup_gl_view_class(GLenum internal_format) @@ -3136,8 +3125,7 @@ static void query_internal_format(struct wined3d_adapter *adapter, format_clear_caps(&format->f, WINED3D_FORMAT_CAP_SRGB_WRITE); }
- if ((!gl_info->supported[ARB_DEPTH_TEXTURE] || wined3d_settings.offscreen_rendering_mode != ORM_FBO) - && (format->f.depth_size || format->f.stencil_size)) + if (!gl_info->supported[ARB_DEPTH_TEXTURE] && (format->f.depth_size || format->f.stencil_size)) { TRACE("Disabling texturing support for depth / stencil format %s.\n", debug_d3dformat(format->f.id)); format->f.caps[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3D_FORMAT_CAP_TEXTURE; @@ -3151,8 +3139,7 @@ static void query_internal_format(struct wined3d_adapter *adapter,
if (format->internal && format->f.caps[WINED3D_GL_RES_TYPE_RB] & (WINED3D_FORMAT_CAP_RENDERTARGET | WINED3D_FORMAT_CAP_DEPTH_STENCIL) - && (gl_info->supported[ARB_FRAMEBUFFER_OBJECT] || gl_info->supported[EXT_FRAMEBUFFER_MULTISAMPLE]) - && wined3d_settings.offscreen_rendering_mode == ORM_FBO) + && (gl_info->supported[ARB_FRAMEBUFFER_OBJECT] || gl_info->supported[EXT_FRAMEBUFFER_MULTISAMPLE])) { if (gl_info->supported[ARB_INTERNALFORMAT_QUERY]) { @@ -3215,10 +3202,6 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win && (format->f.attrs & WINED3D_FORMAT_ATTR_INTEGER)) continue;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO - && (format->f.id == WINED3DFMT_D16_LOCKABLE || format->f.id == WINED3DFMT_NULL)) - continue; - format->internal = format_texture_info[i].gl_internal; format->srgb_internal = format_texture_info[i].gl_srgb_internal; format->rt_internal = format_texture_info[i].gl_rt_internal; @@ -3424,8 +3407,7 @@ static void init_format_filter_info(struct wined3d_adapter *adapter, if (gl_info->supported[ARB_INTERNALFORMAT_QUERY2]) return;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO - || !gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) + if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) { if (vendor == HW_VENDOR_NVIDIA && gl_info->supported[ARB_TEXTURE_FLOAT]) { @@ -4043,12 +4025,6 @@ static float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *c * Nvidia. Use this as a fallback if the detection fails. */ unsigned int fallback = 23;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) - { - FIXME("No FBOs, assuming polyoffset scale of 2^%u.\n", fallback); - return (float)(1u << fallback); - } - gl_info->gl_ops.gl.p_glGenTextures(1, &color); gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color); gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 09d1bfd32a1..73fd6d1125c 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -465,16 +465,6 @@ void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarg *width = texture->resource.width; *height = texture->resource.height; } - else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) - { - const struct wined3d_swapchain_desc *desc = &context->swapchain->state.desc; - - /* The drawable size of a backbuffer / aux buffer offscreen target is - * the size of the current context's drawable, which is the size of - * the back buffer of the swapchain the active context belongs to. */ - *width = desc->backbuffer_width; - *height = desc->backbuffer_height; - } else { unsigned int level_idx = view->sub_resource_idx % texture->level_count; diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 772e79e80a3..ab04315a7e9 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -1042,8 +1042,6 @@ struct wined3d_blt_info
void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, const RECT *rect, struct wined3d_blt_info *info); -void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, - BOOL srgb, struct wined3d_context *context); void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD src_location, DWORD dst_location);
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index cd20fe8b80d..863428bb53a 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -117,7 +117,6 @@ struct wined3d_settings wined3d_settings = { .cs_multithreaded = WINED3D_CSMT_ENABLE, .max_gl_version = MAKEDWORD_VERSION(4, 4), - .offscreen_rendering_mode = ORM_FBO, .pci_vendor_id = PCI_VENDOR_NONE, .pci_device_id = PCI_DEVICE_NONE, .multisample_textures = TRUE, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5f0c88eda97..83bc6a95efd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -456,9 +456,6 @@ static inline int wined3d_uint64_compare(uint64_t x, uint64_t y) return (x > y) - (x < y); }
-#define ORM_BACKBUFFER 0 -#define ORM_FBO 1 - #define PCI_VENDOR_NONE 0xffff /* e.g. 0x8086 for Intel and 0x10de for Nvidia */ #define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
@@ -478,7 +475,6 @@ struct wined3d_settings { unsigned int cs_multithreaded; unsigned int max_gl_version; - int offscreen_rendering_mode; unsigned short pci_vendor_id; unsigned short pci_device_id; /* Memory tracking and object counting. */