wined3d: Document GL context dependencies.

oldstable
Henri Verbeet 2009-06-26 10:07:12 +02:00 committed by Alexandre Julliard
parent 626baad817
commit 7363b6e2e3
16 changed files with 56 additions and 7 deletions

View File

@ -4266,6 +4266,7 @@ static void release_signature(struct wine_rb_entry *entry, void *context)
HeapFree(GetProcessHeap(), 0, sig);
}
/* Context activation is done by the caller. */
static void shader_arb_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
@ -4886,6 +4887,7 @@ struct arbfp_ffp_desc
unsigned int num_textures_used;
};
/* Context activation is done by the caller. */
static void arbfp_enable(IWineD3DDevice *iface, BOOL enable) {
ENTER_GL();
if(enable) {
@ -4922,6 +4924,7 @@ static HRESULT arbfp_alloc(IWineD3DDevice *iface) {
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *context)
{
const WineD3D_GL_Info *gl_info = context;
@ -4934,6 +4937,7 @@ static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *context)
LEAVE_GL();
}
/* Context activation is done by the caller. */
static void arbfp_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
struct shader_arb_priv *priv = This->fragment_priv;
@ -5881,6 +5885,8 @@ static HRESULT arbfp_blit_alloc(IWineD3DDevice *iface) {
}
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void arbfp_blit_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface;
struct arbfp_blit_priv *priv = device->blit_priv;
@ -6129,6 +6135,7 @@ static BOOL gen_yv12_read(SHADER_BUFFER *buffer, GLenum textype, char *luminance
return TRUE;
}
/* Context activation is done by the caller. */
static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum yuv_fixup yuv_fixup, GLenum textype)
{
GLenum shader;
@ -6265,6 +6272,7 @@ static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum yuv_fixup yuv_fixu
return shader;
}
/* Context activation is done by the caller. */
static HRESULT arbfp_blit_set(IWineD3DDevice *iface, const struct GlPixelFormatDesc *format_desc,
GLenum textype, UINT width, UINT height)
{
@ -6325,6 +6333,7 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, const struct GlPixelFormatD
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void arbfp_blit_unset(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface;

View File

@ -1038,6 +1038,7 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
};
/* Context activation is done by the caller. */
static void atifs_enable(IWineD3DDevice *iface, BOOL enable) {
ENTER_GL();
if(enable) {
@ -1118,6 +1119,7 @@ static HRESULT atifs_alloc(IWineD3DDevice *iface) {
}
#define GLINFO_LOCATION This->adapter->gl_info
/* Context activation is done by the caller. */
static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context)
{
IWineD3DDeviceImpl *This = context;
@ -1130,6 +1132,7 @@ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context)
LEAVE_GL();
}
/* Context activation is done by the caller. */
static void atifs_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
struct atifs_private_data *priv = This->fragment_priv;

View File

@ -197,6 +197,7 @@ BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface)
return This->baseTexture.dirty || This->baseTexture.srgbDirty;
}
/* Context activation is done by the caller. */
HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc)
{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;

View File

@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define VB_MAXDECLCHANGES 100 /* After that number we stop converting */
#define VB_RESETDECLCHANGE 1000 /* Reset the changecount after that number of draws */
/* Context activation is done by the caller. */
static void buffer_create_buffer_object(struct wined3d_buffer *This)
{
GLenum error, gl_usage;
@ -454,6 +455,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
return ret;
}
/* Context activation is done by the caller. */
static void buffer_check_buffer_object_size(struct wined3d_buffer *This)
{
UINT size = This->conversion_stride ?
@ -514,6 +516,7 @@ static inline void fixup_transformed_pos(float *p)
}
}
/* Context activation is done by the caller. */
const BYTE *buffer_get_memory(IWineD3DBuffer *iface, UINT offset, GLuint *buffer_object)
{
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
@ -573,6 +576,7 @@ static ULONG STDMETHODCALLTYPE buffer_AddRef(IWineD3DBuffer *iface)
return refcount;
}
/* Context activation is done by the caller. */
const BYTE *buffer_get_sysmem(struct wined3d_buffer *This)
{
/* AllocatedMemory exists if the buffer is double buffered or has no buffer object at all */

View File

@ -1235,6 +1235,7 @@ static inline void set_blit_dimension(UINT width, UINT height) {
* height: render target height
*
*****************************************************************************/
/* Context activation is done by the caller. */
static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *context, UINT width, UINT height) {
int i, sampler;
const struct StateEntry *StateTable = This->StateTable;
@ -1630,6 +1631,7 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf
return context;
}
/* Context activation is done by the caller. */
static void apply_draw_buffer(IWineD3DDeviceImpl *This, IWineD3DSurface *target, BOOL blit)
{
IWineD3DSwapChain *swapchain;

View File

@ -401,6 +401,7 @@ static BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface)
return basetexture_get_dirty((IWineD3DBaseTexture *)iface);
}
/* Context activation is done by the caller. */
static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *iface, BOOL srgb) {
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
BOOL set_gl_texture_desc;

View File

@ -166,6 +166,7 @@ static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum)
return TRUE;
}
/* Context activation is done by the caller. */
void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
BOOL use_vshader, struct wined3d_stream_info *stream_info, BOOL *fixup)
{
@ -2023,6 +2024,7 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi
return;
}
/* Context activation is done by the caller. */
static void create_dummy_textures(IWineD3DDeviceImpl *This) {
unsigned int i;
/* Under DirectX you can have texture stage operations even if no texture is
@ -2129,7 +2131,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
}
}
/* Setup the implicit swapchain */
/* Setup the implicit swapchain. This also initializes a context. */
TRACE("Creating implicit swapchain\n");
hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent,
pPresentationParameters, (IWineD3DSwapChain **)&swapchain);
@ -4034,6 +4036,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(
return WINED3D_OK;
}
/* Context activation is done by the caller. */
#define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount,
const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD dwFlags,

View File

@ -494,6 +494,7 @@ static DWORD ver_for_ext(GL_SupportedExt ext)
return 0;
}
/* Context activation is done by the caller. */
static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
const char *GL_Extensions = NULL;
const char *WGL_Extensions = NULL;
@ -3910,6 +3911,7 @@ static BOOL match_apple(const WineD3D_GL_Info *gl_info)
}
}
/* Context activation is done by the caller. */
static void test_pbo_functionality(WineD3D_GL_Info *gl_info) {
/* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
* but glTexSubImage from a PBO fails miserably, with the first line repeated over
@ -4243,6 +4245,7 @@ struct driver_quirk quirk_table[] = {
}
};
/* Context activation is done by the caller. */
static void fixup_extensions(WineD3D_GL_Info *gl_info) {
unsigned int i;

View File

@ -4491,6 +4491,7 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void shader_glsl_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;

View File

@ -595,8 +595,10 @@ static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
#undef GLINFO_LOCATION
#define GLINFO_LOCATION (*gl_info)
/* Context activation is done by the caller. */
static void nvrc_enable(IWineD3DDevice *iface, BOOL enable) { }
/* Context activation is done by the caller. */
static void nvts_enable(IWineD3DDevice *iface, BOOL enable) {
ENTER_GL();
if(enable) {
@ -664,6 +666,7 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info
}
static HRESULT nvrc_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
/* Context activation is done by the caller. */
static void nvrc_fragment_free(IWineD3DDevice *iface) {}
/* Two fixed function pipeline implementations using GL_NV_register_combiners and

View File

@ -5358,6 +5358,7 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
#undef GLINFO_LOCATION
#define GLINFO_LOCATION (*gl_info)
/* Context activation is done by the caller. */
static void ffp_enable(IWineD3DDevice *iface, BOOL enable) { }
static void ffp_fragment_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps)

View File

@ -299,6 +299,7 @@ void surface_set_texture_target(IWineD3DSurface *iface, GLenum target)
surface_force_reload(iface);
}
/* Context activation is done by the caller. */
static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) {
int active_sampler;
@ -341,8 +342,9 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device)
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
/* This call just downloads data, the caller is responsible for activating the
* right context and binding the correct texture. */
/* This call just downloads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
static void surface_download_data(IWineD3DSurfaceImpl *This) {
const struct GlPixelFormatDesc *format_desc = This->resource.format_desc;
@ -494,8 +496,9 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
This->Flags |= SFLAG_INSYSMEM;
}
/* This call just uploads data, the caller is responsible for activating the
* right context and binding the correct texture. */
/* This call just uploads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data) {
const struct GlPixelFormatDesc *format_desc = This->resource.format_desc;
@ -561,8 +564,9 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi
}
}
/* This call just allocates the texture, the caller is responsible for
* activating the right context and binding the correct texture. */
/* This call just allocates the texture, the caller is responsible for binding
* the correct texture. */
/* Context activation is done by the caller. */
static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal, GLsizei width, GLsizei height, GLenum format, GLenum type) {
const struct GlPixelFormatDesc *format_desc = This->resource.format_desc;
BOOL enable_client_storage = FALSE;
@ -815,6 +819,7 @@ static void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) {
surface_internal_preload(iface, SRGB_ANY);
}
/* Context activation is done by the caller. */
static void surface_remove_pbo(IWineD3DSurfaceImpl *This) {
This->resource.heapMemory = HeapAlloc(GetProcessHeap() ,0 , This->resource.size + RESOURCE_ALIGNMENT);
This->resource.allocatedMemory =
@ -2472,6 +2477,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
It supports GL_EXT_paletted_texture and GL_ARB_fragment_program, support for other
extensions like ATI_fragment_shaders is possible.
*/
/* Context activation is done by the caller. */
static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES convert) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
BYTE table[256][4];
@ -2632,6 +2638,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb) {
/* TODO: check for locks */
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
@ -4375,6 +4382,7 @@ void surface_modify_ds_location(IWineD3DSurface *iface, DWORD location) {
This->Flags |= location;
}
/* Context activation is done by the caller. */
void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
@ -5089,8 +5097,10 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
#define GLINFO_LOCATION device->adapter->gl_info
static HRESULT ffp_blit_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
/* Context activation is done by the caller. */
static void ffp_blit_free(IWineD3DDevice *iface) { }
/* Context activation is done by the caller. */
static HRESULT ffp_blit_set(IWineD3DDevice *iface, const struct GlPixelFormatDesc *format_desc,
GLenum textype, UINT width, UINT height)
{
@ -5101,6 +5111,7 @@ static HRESULT ffp_blit_set(IWineD3DDevice *iface, const struct GlPixelFormatDes
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void ffp_blit_unset(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface;
ENTER_GL();

View File

@ -422,6 +422,7 @@ static BOOL WINAPI IWineD3DTextureImpl_GetDirty(IWineD3DTexture *iface) {
return basetexture_get_dirty((IWineD3DBaseTexture *)iface);
}
/* Context activation is done by the caller. */
static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BOOL srgb) {
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
BOOL set_gl_texture_desc;

View File

@ -557,6 +557,7 @@ static BOOL init_format_compression_info(WineD3D_GL_Info *gl_info)
#define GLINFO_LOCATION (*gl_info)
/* Context activation is done by the caller. */
static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_format, GLenum format, GLenum type)
{
GLenum status;
@ -583,6 +584,7 @@ static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_form
return status == GL_FRAMEBUFFER_COMPLETE_EXT;
}
/* Context activation is done by the caller. */
static void init_format_fbo_compat_info(WineD3D_GL_Info *gl_info)
{
unsigned int i;
@ -856,6 +858,7 @@ BOOL initPixelFormatsNoGL(WineD3D_GL_Info *gl_info)
return TRUE;
}
/* Context activation is done by the caller. */
BOOL initPixelFormats(WineD3D_GL_Info *gl_info)
{
if (!init_format_base_info(gl_info)) return FALSE;

View File

@ -26,6 +26,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
/* Context activation is done by the caller. */
static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
IWineD3DVolumeTexture *texture;
@ -301,6 +302,7 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWi
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
const struct GlPixelFormatDesc *glDesc = This->resource.format_desc;

View File

@ -331,6 +331,7 @@ static BOOL WINAPI IWineD3DVolumeTextureImpl_GetDirty(IWineD3DVolumeTexture *ifa
return basetexture_get_dirty((IWineD3DBaseTexture *)iface);
}
/* Context activation is done by the caller. */
static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTexture *iface, BOOL srgb) {
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
BOOL dummy;