Changeset 39899 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Jan 27, 2012 3:46:44 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/basetexture.c
r38982 r39899 266 266 } 267 267 268 void basetexture_state_init(IWineD3DBaseTexture *iface, struct gl_texture *gl_tex) 269 { 270 /* Initialise the state of the texture object 271 to the openGL defaults, not the directx defaults */ 272 gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_WRAP; 273 gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_WRAP; 274 gl_tex->states[WINED3DTEXSTA_ADDRESSW] = WINED3DTADDRESS_WRAP; 275 gl_tex->states[WINED3DTEXSTA_BORDERCOLOR] = 0; 276 gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_LINEAR; 277 gl_tex->states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; /* GL_NEAREST_MIPMAP_LINEAR */ 278 gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_LINEAR; /* GL_NEAREST_MIPMAP_LINEAR */ 279 gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = 0; 280 gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1; 281 gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = 0; 282 gl_tex->states[WINED3DTEXSTA_ELEMENTINDEX] = 0; 283 gl_tex->states[WINED3DTEXSTA_DMAPOFFSET] = 0; 284 gl_tex->states[WINED3DTEXSTA_TSSADDRESSW] = WINED3DTADDRESS_WRAP; 285 IWineD3DBaseTexture_SetDirty(iface, TRUE); 286 } 287 268 288 /* Context activation is done by the caller. */ 269 289 HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) … … 291 311 if (VBOXSHRC_IS_SHARED_OPENED(This)) 292 312 { 313 ERR("should not be here!"); 293 314 gl_tex->name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(This); 315 TRACE("Assigned shared texture %d\n", gl_tex->name); 294 316 } 295 317 else … … 298 320 isNewTexture = TRUE; 299 321 glGenTextures(1, &gl_tex->name); 322 checkGLcall("glGenTextures"); 323 TRACE("Generated texture %d\n", gl_tex->name); 300 324 #ifdef VBOX_WITH_WDDM 301 325 if (VBOXSHRC_IS_SHARED(This)) … … 305 329 #endif 306 330 } 307 checkGLcall("glGenTextures");308 TRACE("Generated texture %d\n", gl_tex->name);309 331 #ifndef VBOX_WITH_WDDM 310 332 if (This->resource.pool == WINED3DPOOL_DEFAULT) { … … 321 343 /* Initialise the state of the texture object 322 344 to the openGL defaults, not the directx defaults */ 323 gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_WRAP; 324 gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_WRAP; 325 gl_tex->states[WINED3DTEXSTA_ADDRESSW] = WINED3DTADDRESS_WRAP; 326 gl_tex->states[WINED3DTEXSTA_BORDERCOLOR] = 0; 327 gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_LINEAR; 328 gl_tex->states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; /* GL_NEAREST_MIPMAP_LINEAR */ 329 gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_LINEAR; /* GL_NEAREST_MIPMAP_LINEAR */ 330 gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = 0; 331 gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1; 332 gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = 0; 333 gl_tex->states[WINED3DTEXSTA_ELEMENTINDEX] = 0; 334 gl_tex->states[WINED3DTEXSTA_DMAPOFFSET] = 0; 335 gl_tex->states[WINED3DTEXSTA_TSSADDRESSW] = WINED3DTADDRESS_WRAP; 336 IWineD3DBaseTexture_SetDirty(iface, TRUE); 345 basetexture_state_init(iface, gl_tex); 337 346 338 347 if(isNewTexture -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r39869 r39899 2649 2649 2650 2650 case CTXUSAGE_BLIT: 2651 case CTXUSAGE_BLIT_LIGHT:2652 2651 if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { 2653 2652 if (!context->render_offscreen) context_validate_onscreen_formats(device, context); … … 2683 2682 switch(usage) { 2684 2683 case CTXUSAGE_RESOURCELOAD: 2685 case CTXUSAGE_BLIT_LIGHT:2686 2684 /* This does not require any special states to be set up */ 2687 2685 break; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r39649 r39899 532 532 if (!VBOXSHRC_IS_SHARED_OPENED(surface)) 533 533 { 534 struct wined3d_context * context; 535 534 536 Assert(!(*shared_handle)); 535 537 *shared_handle = VBOXSHRC_GET_SHAREHANDLE(surface); 538 539 Assert(!device->isInDraw); 540 541 /* flush to ensure the texture is allocated before it is used by another 542 * process opening it */ 543 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 544 if (context->valid) 545 { 546 wglFlush(); 547 } 548 else 549 { 550 ERR("invalid context!"); 551 } 552 context_release(context); 536 553 } 537 554 else … … 990 1007 GLenum internal; 991 1008 1009 #ifdef VBOX_WITH_WDDM 1010 if (VBOXSHRC_IS_SHARED_OPENED(This)) 1011 { 1012 ERR("trying to allocate shared openned resource!!, ignoring..\n"); 1013 return; 1014 } 1015 #endif 1016 992 1017 if (srgb) 993 1018 { … … 1035 1060 } 1036 1061 1037 #ifdef VBOX_WITH_WDDM 1038 if (!VBOXSHRC_IS_SHARED_OPENED(This)) 1039 #endif 1040 { 1041 if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED && mem) 1042 { 1043 GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level, 1044 internal, width, height, 0, This->resource.size, mem)); 1045 } 1046 else 1047 { 1048 glTexImage2D(This->texture_target, This->texture_level, 1049 internal, width, height, 0, format_desc->glFormat, format_desc->glType, mem); 1050 checkGLcall("glTexImage2D"); 1051 } 1062 if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED && mem) 1063 { 1064 GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level, 1065 internal, width, height, 0, This->resource.size, mem)); 1066 } 1067 else 1068 { 1069 glTexImage2D(This->texture_target, This->texture_level, 1070 internal, width, height, 0, format_desc->glFormat, format_desc->glType, mem); 1071 checkGLcall("glTexImage2D"); 1052 1072 } 1053 1073 … … 1803 1823 IWineD3DDeviceImpl *device = This->resource.device; 1804 1824 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 1805 struct wined3d_context * context = NULL; 1806 if (!device->isInDraw) context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 1807 1808 surface_prepare_texture(This, gl_info, FALSE); 1809 /* no need to bind it here */ 1810 // surface_bind_and_dirtify(This, FALSE); 1811 1812 if (context) context_release(context); 1825 DWORD alloc_flag = SFLAG_ALLOCATED; 1826 CONVERT_TYPES convert; 1827 struct wined3d_format_desc desc; 1828 IWineD3DBaseTexture *baseTexture = NULL; 1829 1830 d3dfmt_get_conv(This, TRUE, TRUE, &desc, &convert); 1831 if(convert != NO_CONVERSION) This->Flags |= SFLAG_CONVERTED; 1832 else This->Flags &= ~SFLAG_CONVERTED; 1833 1834 if (IWineD3DSurface_GetContainer((IWineD3DSurface*)This, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == WINED3D_OK) { 1835 IWineD3DTextureImpl* pTex = (IWineD3DTextureImpl*)baseTexture; 1836 if (!pTex->baseTexture.texture_rgb.name) 1837 { 1838 pTex->baseTexture.texture_rgb.name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(pTex); 1839 /* @todo: this is not entirely correct: need to share this state among all instances of the given shared resource */ 1840 texture_state_init((IWineD3DTexture*)baseTexture, &pTex->baseTexture.texture_rgb); 1841 } 1842 IWineD3DBaseTexture_Release(baseTexture); 1843 } 1844 This->Flags |= alloc_flag; 1845 1846 This->texture_name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(This); 1813 1847 1814 1848 IWineD3DSurface_ModifyLocation((IWineD3DSurface*)This, SFLAG_INTEXTURE, TRUE); … … 2856 2890 if (VBOXSHRC_IS_SHARED_OPENED(This)) 2857 2891 { 2892 ERR("should not be here!"); 2858 2893 *name = (GLuint)VBOXSHRC_GET_SHAREHANDLE(This); 2859 2894 } … … 2862 2897 { 2863 2898 glGenTextures(1, name); 2899 checkGLcall("glGenTextures"); 2900 TRACE("Surface %p given name %d\n", This, *name); 2901 2902 glBindTexture(This->texture_target, *name); 2903 checkGLcall("glBindTexture"); 2904 glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 2905 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)"); 2906 glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 2907 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)"); 2908 glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); 2909 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)"); 2910 glTexParameteri(This->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 2911 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)"); 2912 glTexParameteri(This->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 2913 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)"); 2864 2914 #ifdef VBOX_WITH_WDDM 2865 2915 if (VBOXSHRC_IS_SHARED(This)) … … 2869 2919 #endif 2870 2920 } 2871 checkGLcall("glGenTextures");2872 TRACE("Surface %p given name %d\n", This, *name);2873 2874 glBindTexture(This->texture_target, *name);2875 checkGLcall("glBindTexture");2876 glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);2877 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");2878 glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);2879 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");2880 glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);2881 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)");2882 glTexParameteri(This->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);2883 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");2884 glTexParameteri(This->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);2885 checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");2886 2921 } 2887 2922 /* This is where we should be reducing the amount of GLMemoryUsed */ … … 3306 3341 } 3307 3342 3308 context = context_acquire(myDevice, SrcSurface, 3309 #ifdef VBOX_WITH_WDDM 3310 CTXUSAGE_BLIT_LIGHT 3311 #else 3312 CTXUSAGE_BLIT 3313 #endif 3314 ); 3343 context = context_acquire(myDevice, SrcSurface, CTXUSAGE_BLIT); 3315 3344 3316 3345 surface_internal_preload((IWineD3DSurface *) This, SRGB_RGB); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c
r38982 r39899 473 473 }; 474 474 475 void texture_state_init(IWineD3DTexture *iface, struct gl_texture *gl_tex) 476 { 477 basetexture_state_init((IWineD3DBaseTexture*)iface, gl_tex); 478 if(IWineD3DBaseTexture_IsCondNP2(iface)) { 479 gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_CLAMP; 480 gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_CLAMP; 481 gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_POINT; 482 gl_tex->states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; 483 gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_NONE; 484 } 485 } 486 475 487 HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, 476 488 IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, … … 687 699 } 688 700 #endif 701 702 if (!VBOXSHRC_IS_SHARED_OPENED(texture)) 703 { 704 struct wined3d_context * context; 705 706 Assert(!device->isInDraw); 707 708 /* flush to ensure the texture is allocated before it is used by another 709 * process opening it */ 710 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 711 if (context->valid) 712 { 713 wglFlush(); 714 } 715 else 716 { 717 ERR("invalid context!"); 718 } 719 context_release(context); 720 } 689 721 } 690 722 else -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r39602 r39899 1266 1266 CTXUSAGE_BLIT = 3, /* OpenGL states are set up 3D drawing */ 1267 1267 CTXUSAGE_CLEAR = 4, /* Drawable and states are set up for clearing */ 1268 CTXUSAGE_BLIT_LIGHT = 5, /* OpenGL states are set up 3D drawing */1269 1268 } ContextUsage; 1270 1269 … … 1987 1986 const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], 1988 1987 const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; 1988 void basetexture_state_init(IWineD3DBaseTexture *iface, struct gl_texture *gl_tex); 1989 1989 HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN; 1990 1990 void basetexture_cleanup(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; … … 2025 2025 } IWineD3DTextureImpl; 2026 2026 2027 void texture_state_init(IWineD3DTexture *iface, struct gl_texture *gl_tex); 2027 2028 HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, 2028 2029 IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool,
Note:
See TracChangeset
for help on using the changeset viewer.