Changeset 38588 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
- Timestamp:
- Aug 31, 2011 4:01:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r38565 r38588 3199 3199 * with single pixel copy calls 3200 3200 */ 3201 static inline voidfb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3DSurface *SrcSurface,3202 const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter, BOOL doit)3201 static inline BOOL fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3DSurface *SrcSurface, 3202 const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter, BOOL fFastOnly) 3203 3203 { 3204 3204 IWineD3DDeviceImpl *myDevice = This->resource.device; … … 3208 3208 struct wined3d_context *context; 3209 3209 BOOL upsidedown = FALSE; 3210 BOOL isOffscreen = surface_is_offscreen(SrcSurface); 3211 BOOL fNoStretching = TRUE; 3210 3212 RECT dst_rect = *dst_rect_in; 3211 3213 … … 3215 3217 if(dst_rect.top > dst_rect.bottom) { 3216 3218 UINT tmp = dst_rect.bottom; 3219 #ifdef DEBUG_misha 3220 ERR("validate this path!"); 3221 #endif 3217 3222 dst_rect.bottom = dst_rect.top; 3218 3223 dst_rect.top = tmp; … … 3220 3225 } 3221 3226 3227 if (isOffscreen) 3228 { 3229 upsidedown = !upsidedown; 3230 } 3231 3232 xrel = (float) (src_rect->right - src_rect->left) / (float) (dst_rect.right - dst_rect.left); 3233 yrel = (float) (src_rect->bottom - src_rect->top) / (float) (dst_rect.bottom - dst_rect.top); 3234 3235 if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) 3236 { 3237 FIXME("Doing a pixel by pixel copy from the framebuffer to a texture, expect major performance issues\n"); 3238 3239 if(Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) { 3240 ERR("Texture filtering not supported in direct blit\n"); 3241 } 3242 } 3243 else if ((Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) 3244 && ((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) 3245 { 3246 ERR("Texture filtering not supported in direct blit\n"); 3247 } 3248 3249 fNoStretching = !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) 3250 && !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps)); 3251 3252 if (fFastOnly && (!upsidedown || !fNoStretching)) 3253 { 3254 return FALSE; 3255 } 3256 3222 3257 context = context_acquire(myDevice, SrcSurface, CTXUSAGE_BLIT); 3223 3258 surface_internal_preload((IWineD3DSurface *) This, SRGB_RGB); … … 3227 3262 glBindTexture(This->texture_target, This->texture_name); 3228 3263 checkGLcall("glBindTexture"); 3229 if( surface_is_offscreen(SrcSurface)) {3264 if(isOffscreen) { 3230 3265 TRACE("Reading from an offscreen target\n"); 3231 upsidedown = !upsidedown;3232 3266 glReadBuffer(myDevice->offscreenBuffer); 3233 3267 } … … 3238 3272 checkGLcall("glReadBuffer"); 3239 3273 3240 xrel = (float) (src_rect->right - src_rect->left) / (float) (dst_rect.right - dst_rect.left); 3241 yrel = (float) (src_rect->bottom - src_rect->top) / (float) (dst_rect.bottom - dst_rect.top); 3242 3243 if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) 3244 { 3245 FIXME("Doing a pixel by pixel copy from the framebuffer to a texture, expect major performance issues\n"); 3246 3247 if(Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) { 3248 ERR("Texture filtering not supported in direct blit\n"); 3249 } 3250 } 3251 else if ((Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) 3252 && ((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) 3253 { 3254 ERR("Texture filtering not supported in direct blit\n"); 3255 } 3256 3257 if (upsidedown 3258 && !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) 3259 && !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) 3274 if (upsidedown && fNoStretching) 3260 3275 { 3261 3276 /* Upside down copy without stretching is nice, one glCopyTexSubImage call will do */ … … 3274 3289 */ 3275 3290 3276 if (!((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) 3277 && !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) 3291 if (fNoStretching) 3278 3292 { 3279 3293 /* No stretching involved, so just pass negative height and let host side take care of inverting */ 3280 3294 3281 if (doit) 3282 { 3283 glCopyTexSubImage2D(This->texture_target, This->texture_level, 3295 glCopyTexSubImage2D(This->texture_target, This->texture_level, 3284 3296 dst_rect.left /*xoffset */, dst_rect.top /* y offset */, 3285 3297 src_rect->left, Src->currentDesc.Height - src_rect->bottom, 3286 3298 dst_rect.right - dst_rect.left, -(dst_rect.bottom-dst_rect.top)); 3287 }3288 3299 } 3289 3300 else … … 3319 3330 */ 3320 3331 IWineD3DSurface_ModifyLocation((IWineD3DSurface *) This, SFLAG_INTEXTURE, TRUE); 3332 3333 return TRUE; 3321 3334 } 3322 3335 … … 3807 3820 ) 3808 3821 { 3809 stretch_rect_fbo((IWineD3DDevice *)myDevice, SrcSurface, &src_rect, 3810 (IWineD3DSurface *)This, &dst_rect, Filter); 3822 /* blit framebuffer might be buggy for some GPUs, try if fb_copy_to_texture_direct can do it quickly */ 3823 if (!fb_copy_to_texture_direct(This, SrcSurface, &src_rect, &dst_rect, Filter, TRUE /* fals only */)) 3824 { 3825 TRACE("fb_copy_to_texture_direct can not do it fast, use stretch_rect_fbo\n"); 3826 stretch_rect_fbo((IWineD3DDevice *)myDevice, SrcSurface, &src_rect, 3827 (IWineD3DSurface *)This, &dst_rect, Filter); 3828 } 3811 3829 } else if((!stretchx) || dst_rect.right - dst_rect.left > Src->currentDesc.Width || 3812 3830 dst_rect.bottom - dst_rect.top > Src->currentDesc.Height) { 3813 3831 TRACE("No stretching in x direction, using direct framebuffer -> texture copy\n"); 3814 fb_copy_to_texture_direct(This, SrcSurface, &src_rect, &dst_rect, Filter, TRUE);3832 fb_copy_to_texture_direct(This, SrcSurface, &src_rect, &dst_rect, Filter, FALSE /* do it alwais */); 3815 3833 } else { 3816 3834 TRACE("Using hardware stretching to flip / stretch the texture\n");
Note:
See TracChangeset
for help on using the changeset viewer.