wined3d: Get rid of ENTER_GL / LEAVE_GL.

This commit is contained in:
Henri Verbeet 2012-12-10 21:54:36 +01:00 committed by Alexandre Julliard
parent fc50e2b70b
commit 78984cf46c
17 changed files with 100 additions and 440 deletions

View File

@ -330,7 +330,8 @@ struct shader_arb_priv
const struct fragment_pipeline *fragment_pipe;
};
/* GL locking for state handlers is done by the caller. */
/* Context activation for state handlers is done by the caller. */
static BOOL need_rel_addr_const(const struct arb_vshader_private *shader_data,
const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info)
{
@ -377,7 +378,7 @@ static unsigned int reserved_vs_const(const struct arb_vshader_private *shader_d
* @target_type should be either GL_VERTEX_PROGRAM_ARB (for vertex shaders)
* or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders)
*/
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static unsigned int shader_arb_load_constantsF(const struct wined3d_shader *shader,
const struct wined3d_gl_info *gl_info, GLuint target_type, unsigned int max_constants,
const float *constants, char *dirty_consts)
@ -543,7 +544,7 @@ static void shader_arb_load_np2fixup_constants(void *shader_priv,
}
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
static void shader_arb_ps_local_constants(const struct arb_ps_compiled_shader *gl_shader,
const struct wined3d_context *context, const struct wined3d_state *state, UINT rt_height)
{
@ -607,7 +608,7 @@ static void shader_arb_ps_local_constants(const struct arb_ps_compiled_shader *g
checkGLcall("Load ps int consts");
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *gl_shader,
const struct wined3d_context *context, const struct wined3d_state *state)
{
@ -646,7 +647,7 @@ static void shader_arb_select(const struct wined3d_context *context, enum wined3
* We only support float constants in ARB at the moment, so don't
* worry about the Integers or Booleans
*/
/* GL locking is done by the caller (state handler) */
/* Context activation is done by the caller (state handler). */
static void shader_arb_load_constants_internal(const struct wined3d_context *context,
BOOL usePixelShader, BOOL useVertexShader, BOOL from_shader_select)
{
@ -3302,7 +3303,7 @@ static void shader_hw_call(const struct wined3d_shader_instruction *ins)
shader_addline(buffer, "CAL l%u;\n", ins->src[0].reg.idx[0].offset);
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLuint create_arb_blt_vertex_program(const struct wined3d_gl_info *gl_info)
{
GLuint program_id = 0;
@ -3341,7 +3342,7 @@ static GLuint create_arb_blt_vertex_program(const struct wined3d_gl_info *gl_inf
return program_id;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLuint create_arb_blt_fragment_program(const struct wined3d_gl_info *gl_info,
enum tex_types tex_type, BOOL masked)
{
@ -3577,7 +3578,7 @@ static void init_ps_input(const struct wined3d_shader *shader,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer,
const struct arb_ps_compile_args *args, struct arb_ps_compiled_shader *compiled)
@ -4166,7 +4167,7 @@ static void init_output_registers(const struct wined3d_shader *shader, DWORD sig
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer,
const struct arb_vs_compile_args *args, struct arb_vs_compiled_shader *compiled)
@ -4334,7 +4335,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
return ret;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *shader,
const struct arb_ps_compile_args *args)
{
@ -4648,7 +4649,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_arb_select(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode,
enum wined3d_shader_mode fragment_mode)
{
@ -4766,7 +4767,7 @@ static void shader_arb_select(const struct wined3d_context *context, enum wined3
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_arb_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info,
enum tex_types tex_type, const SIZE *ds_mask_size)
{
@ -4786,7 +4787,7 @@ static void shader_arb_select_depth_blt(void *shader_priv, const struct wined3d_
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_arb_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info)
{
struct shader_arb_priv *priv = shader_priv;
@ -4832,13 +4833,11 @@ static void shader_arb_destroy(struct wined3d_shader *shader)
{
struct wined3d_context *context = context_acquire(device, NULL);
ENTER_GL();
for (i = 0; i < shader_data->num_gl_shaders; ++i)
{
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
}
LEAVE_GL();
context_release(context);
}
@ -4858,13 +4857,11 @@ static void shader_arb_destroy(struct wined3d_shader *shader)
{
struct wined3d_context *context = context_acquire(device, NULL);
ENTER_GL();
for (i = 0; i < shader_data->num_gl_shaders; ++i)
{
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
}
LEAVE_GL();
context_release(context);
}
@ -4952,10 +4949,9 @@ static void shader_arb_free(struct wined3d_device *device)
struct shader_arb_priv *priv = device->shader_priv;
int i;
ENTER_GL();
if(priv->depth_blt_vprogram_id) {
if (priv->depth_blt_vprogram_id)
GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_vprogram_id));
}
for (i = 0; i < tex_type_count; ++i)
{
if (priv->depth_blt_fprogram_id_full[i])
@ -4967,7 +4963,6 @@ static void shader_arb_free(struct wined3d_device *device)
GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_fprogram_id_masked[i]));
}
}
LEAVE_GL();
wine_rb_destroy(&priv->signature_tree, release_signature, NULL);
HeapFree(GetProcessHeap(), 0, priv->pshader_const_dirty);
@ -5669,7 +5664,7 @@ struct arbfp_ffp_desc
GLuint shader;
};
/* Context activation and GL locking are done by the caller. */
/* Context activation is done by the caller. */
static void arbfp_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
if (enable)
@ -5715,11 +5710,9 @@ static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *context)
const struct wined3d_gl_info *gl_info = context;
struct arbfp_ffp_desc *entry_arb = WINE_RB_ENTRY_VALUE(entry, struct arbfp_ffp_desc, parent.entry);
ENTER_GL();
GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader));
checkGLcall("glDeleteProgramsARB(1, &entry_arb->shader)");
HeapFree(GetProcessHeap(), 0, entry_arb);
LEAVE_GL();
}
/* Context activation is done by the caller. */
@ -6707,7 +6700,6 @@ static void arbfp_blit_free(struct wined3d_device *device)
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct arbfp_blit_priv *priv = device->blit_priv;
ENTER_GL();
GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_rect_shader));
GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_2d_shader));
GL_EXTCALL(glDeleteProgramsARB(1, &priv->uyvy_rect_shader));
@ -6720,7 +6712,6 @@ static void arbfp_blit_free(struct wined3d_device *device)
if (priv->palette_texture)
gl_info->gl_ops.gl.p_glDeleteTextures(1, &priv->palette_texture);
LEAVE_GL();
HeapFree(GetProcessHeap(), 0, device->blit_priv);
device->blit_priv = NULL;
@ -6974,11 +6965,10 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
return 0;
}
ENTER_GL();
GL_EXTCALL(glGenProgramsARB(1, &shader));
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader));
LEAVE_GL();
if(!shader) {
if (!shader)
{
shader_buffer_free(&buffer);
return 0;
}
@ -7002,7 +6992,6 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
shader_addline(&buffer, "TEX result.color, index.a, texture[1], 1D;\n");
shader_addline(&buffer, "END\n");
ENTER_GL();
GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(buffer.buffer), buffer.buffer));
checkGLcall("glProgramStringARB()");
@ -7021,7 +7010,6 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
priv->p8_2d_shader = shader;
shader_buffer_free(&buffer);
LEAVE_GL();
return shader;
}
@ -7037,8 +7025,6 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d
d3dfmt_p8_init_palette(surface, table, colorkey);
ENTER_GL();
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
@ -7069,7 +7055,6 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d
/* Switch back to unit 0 in which the 2D texture will be stored. */
context_active_texture(context, gl_info, 0);
LEAVE_GL();
}
/* Context activation is done by the caller. */
@ -7088,13 +7073,12 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
return 0;
}
ENTER_GL();
GL_EXTCALL(glGenProgramsARB(1, &shader));
checkGLcall("GL_EXTCALL(glGenProgramsARB(1, &shader))");
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader));
checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)");
LEAVE_GL();
if(!shader) {
if (!shader)
{
shader_buffer_free(&buffer);
return 0;
}
@ -7181,7 +7165,6 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
shader_addline(&buffer, "MAD result.color.z, chroma.y, yuv_coef.w, luminance.%c;\n", luminance_component);
shader_addline(&buffer, "END\n");
ENTER_GL();
GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(buffer.buffer), buffer.buffer));
checkGLcall("glProgramStringARB()");
@ -7203,7 +7186,6 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
}
shader_buffer_free(&buffer);
LEAVE_GL();
switch (yuv_fixup)
{
@ -7245,10 +7227,8 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
if (surface->flags & SFLAG_CONVERTED)
{
ENTER_GL();
gl_info->gl_ops.gl.p_glEnable(textype);
checkGLcall("glEnable(textype)");
LEAVE_GL();
return WINED3D_OK;
}
@ -7257,10 +7237,8 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
TRACE("Fixup:\n");
dump_color_fixup_desc(surface->resource.format->color_fixup);
/* Don't bother setting up a shader for unconverted formats */
ENTER_GL();
gl_info->gl_ops.gl.p_glEnable(textype);
checkGLcall("glEnable(textype)");
LEAVE_GL();
return WINED3D_OK;
}
@ -7289,23 +7267,19 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
default:
FIXME("Unsupported complex fixup %#x, not setting a shader\n", fixup);
ENTER_GL();
gl_info->gl_ops.gl.p_glEnable(textype);
checkGLcall("glEnable(textype)");
LEAVE_GL();
return E_NOTIMPL;
}
if (!shader) shader = gen_yuv_shader(priv, gl_info, fixup, textype);
ENTER_GL();
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader));
checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)");
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, size));
checkGLcall("glProgramLocalParameter4fvARB");
LEAVE_GL();
return WINED3D_OK;
}
@ -7313,7 +7287,6 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
/* Context activation is done by the caller. */
static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info)
{
ENTER_GL();
gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
@ -7328,7 +7301,6 @@ static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info)
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
}
LEAVE_GL();
}
static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
@ -7425,13 +7397,9 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
arbfp_blit_set(device->blit_priv, context, src_surface);
ENTER_GL();
/* Draw a textured quad */
draw_textured_quad(src_surface, context, &src_rect, &dst_rect, filter);
LEAVE_GL();
/* Leave the opengl state valid for blitting */
arbfp_blit_unset(context->gl_info);

View File

@ -29,7 +29,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
WINE_DECLARE_DEBUG_CHANNEL(d3d);
/* GL locking for state handlers is done by the caller. */
/* Context activation for state handlers is done by the caller. */
/* Some private defines, Constant associations, etc.
* Env bump matrix and per stage constant should be independent,
@ -1085,7 +1085,7 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
};
/* Context activation and GL locking are done by the caller. */
/* Context activation is done by the caller. */
static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
if (enable)
@ -1173,11 +1173,9 @@ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context)
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct atifs_ffp_desc *entry_ati = WINE_RB_ENTRY_VALUE(entry, struct atifs_ffp_desc, parent.entry);
ENTER_GL();
GL_EXTCALL(glDeleteFragmentShaderATI(entry_ati->shader));
checkGLcall("glDeleteFragmentShaderATI(entry->shader)");
HeapFree(GetProcessHeap(), 0, entry_ati);
LEAVE_GL();
}
/* Context activation is done by the caller. */

View File

@ -98,10 +98,8 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g
{
if(!This->buffer_object) return;
ENTER_GL();
GL_EXTCALL(glDeleteBuffersARB(1, &This->buffer_object));
checkGLcall("glDeleteBuffersARB");
LEAVE_GL();
This->buffer_object = 0;
if(This->query)
@ -120,8 +118,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
TRACE("Creating an OpenGL vertex buffer object for wined3d_buffer %p with usage %s.\n",
This, debug_d3dusage(This->resource.usage));
ENTER_GL();
/* Make sure that the gl error is cleared. Do not use checkGLcall
* here because checkGLcall just prints a fixme and continues. However,
* if an error during VBO creation occurs we can fall back to non-vbo operation
@ -140,7 +136,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
if (!This->buffer_object || error != GL_NO_ERROR)
{
ERR("Failed to create a VBO with error %s (%#x)\n", debug_glerror(error), error);
LEAVE_GL();
goto fail;
}
@ -151,7 +146,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
if (error != GL_NO_ERROR)
{
ERR("Failed to bind the VBO with error %s (%#x)\n", debug_glerror(error), error);
LEAVE_GL();
goto fail;
}
@ -188,7 +182,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
*/
GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, This->resource.allocatedMemory, gl_usage));
error = gl_info->gl_ops.gl.p_glGetError();
LEAVE_GL();
if (error != GL_NO_ERROR)
{
ERR("glBufferDataARB failed with error %s (%#x)\n", debug_glerror(error), error);
@ -516,10 +509,8 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_inf
if (This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
device_invalidate_state(This->resource.device, STATE_INDEXBUFFER);
ENTER_GL();
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
GL_EXTCALL(glGetBufferSubDataARB(This->buffer_type_hint, 0, This->resource.size, This->resource.allocatedMemory));
LEAVE_GL();
This->flags |= WINED3D_BUFFER_DOUBLEBUFFER;
return This->resource.allocatedMemory;
@ -610,10 +601,8 @@ static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const st
if (flags & WINED3D_MAP_DISCARD)
{
ENTER_GL();
GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, NULL, This->buffer_object_usage));
checkGLcall("glBufferDataARB\n");
LEAVE_GL();
return;
}
@ -664,10 +653,8 @@ drop_query:
}
gl_info->gl_ops.gl.p_glFinish();
ENTER_GL();
GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE));
checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)");
LEAVE_GL();
This->flags &= ~WINED3D_BUFFER_APPLESYNC;
}
@ -677,8 +664,6 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
BYTE *map;
UINT start = 0, len = 0;
ENTER_GL();
/* This potentially invalidates the element array buffer binding, but the
* caller always takes care of this. */
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
@ -704,16 +689,13 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
syncflags |= WINED3D_MAP_DISCARD;
if (flags & WINED3D_BUFFER_NOSYNC)
syncflags |= WINED3D_MAP_NOOVERWRITE;
LEAVE_GL();
buffer_sync_apple(This, syncflags, gl_info);
ENTER_GL();
}
map = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_WRITE_ONLY_ARB));
checkGLcall("glMapBufferARB");
}
if (!map)
{
LEAVE_GL();
ERR("Failed to map opengl buffer\n");
return;
}
@ -739,8 +721,6 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
}
GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint));
checkGLcall("glUnmapBufferARB");
LEAVE_GL();
}
/* Do not call while under the GL lock. */
@ -938,12 +918,10 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
}
}
ENTER_GL();
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
checkGLcall("glBindBufferARB");
GL_EXTCALL(glBufferSubDataARB(buffer->buffer_type_hint, start, len, data + start));
checkGLcall("glBufferSubDataARB");
LEAVE_GL();
}
HeapFree(GetProcessHeap(), 0, data);
@ -1048,8 +1026,6 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
context = context_acquire(device, NULL);
gl_info = context->gl_info;
ENTER_GL();
if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
context_invalidate_state(context, STATE_INDEXBUFFER);
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
@ -1064,25 +1040,18 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
else
{
if (buffer->flags & WINED3D_BUFFER_APPLESYNC)
{
LEAVE_GL();
buffer_sync_apple(buffer, flags, gl_info);
ENTER_GL();
}
buffer->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(buffer->buffer_type_hint,
GL_READ_WRITE_ARB));
checkGLcall("glMapBufferARB");
}
LEAVE_GL();
if (((DWORD_PTR)buffer->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1))
{
WARN("Pointer %p is not %u byte aligned.\n", buffer->resource.allocatedMemory, RESOURCE_ALIGNMENT);
ENTER_GL();
GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint));
checkGLcall("glUnmapBufferARB");
LEAVE_GL();
buffer->resource.allocatedMemory = NULL;
if (buffer->resource.usage & WINED3DUSAGE_DYNAMIC)
@ -1168,8 +1137,6 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
context = context_acquire(device, NULL);
gl_info = context->gl_info;
ENTER_GL();
if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
context_invalidate_state(context, STATE_INDEXBUFFER);
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
@ -1194,7 +1161,6 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
}
GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint));
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);

View File

@ -35,7 +35,7 @@ static DWORD wined3d_context_tls_idx;
/* FBO helper functions */
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -84,7 +84,7 @@ static void context_bind_fbo(struct wined3d_context *context, GLenum target, GLu
checkGLcall("glBindFramebuffer()");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info, GLenum target)
{
unsigned int i;
@ -101,7 +101,7 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info,
checkGLcall("glFramebufferTexture2D()");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -130,7 +130,7 @@ static void context_attach_depth_stencil_rb(const struct wined3d_gl_info *gl_inf
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, struct wined3d_surface *depth_stencil, DWORD location)
{
@ -212,7 +212,7 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_attach_surface_fbo(struct wined3d_context *context,
GLenum fbo_target, DWORD idx, struct wined3d_surface *surface, DWORD location)
{
@ -262,7 +262,7 @@ static void context_attach_surface_fbo(struct wined3d_context *context,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
void context_check_fbo_status(const struct wined3d_context *context, GLenum target)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -341,7 +341,7 @@ static struct fbo_entry *context_create_fbo_entry(const struct wined3d_context *
return entry;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum target,
struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil,
DWORD location, struct fbo_entry *entry)
@ -357,7 +357,7 @@ static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum targ
entry->attached = FALSE;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_destroy_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry)
{
if (entry->id)
@ -371,8 +371,7 @@ static void context_destroy_fbo_entry(struct wined3d_context *context, struct fb
HeapFree(GetProcessHeap(), 0, entry);
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context, GLenum target,
struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location)
{
@ -418,7 +417,7 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context,
return entry;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_apply_fbo_entry(struct wined3d_context *context, GLenum target, struct fbo_entry *entry)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -442,7 +441,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ
entry->attached = TRUE;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void context_apply_fbo_state(struct wined3d_context *context, GLenum target,
struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location)
{
@ -471,7 +470,7 @@ static void context_apply_fbo_state(struct wined3d_context *context, GLenum targ
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location)
{
@ -496,10 +495,8 @@ void context_alloc_occlusion_query(struct wined3d_context *context, struct wined
{
if (gl_info->supported[ARB_OCCLUSION_QUERY])
{
ENTER_GL();
GL_EXTCALL(glGenQueriesARB(1, &query->id));
checkGLcall("glGenQueriesARB");
LEAVE_GL();
TRACE("Allocated occlusion query %u in context %p.\n", query->id, context);
}
@ -559,19 +556,15 @@ void context_alloc_event_query(struct wined3d_context *context, struct wined3d_e
}
else if (gl_info->supported[APPLE_FENCE])
{
ENTER_GL();
GL_EXTCALL(glGenFencesAPPLE(1, &query->object.id));
checkGLcall("glGenFencesAPPLE");
LEAVE_GL();
TRACE("Allocated event query %u in context %p.\n", query->object.id, context);
}
else if(gl_info->supported[NV_FENCE])
{
ENTER_GL();
GL_EXTCALL(glGenFencesNV(1, &query->object.id));
checkGLcall("glGenFencesNV");
LEAVE_GL();
TRACE("Allocated event query %u in context %p.\n", query->object.id, context);
}
@ -903,9 +896,8 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
if (context->valid && restore_ctx != context->glCtx)
context_set_gl_context(context);
else restore_ctx = NULL;
ENTER_GL();
else
restore_ctx = NULL;
LIST_FOR_EACH_ENTRY(occlusion_query, &context->occlusion_queries, struct wined3d_occlusion_query, entry)
{
@ -975,8 +967,6 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
checkGLcall("context cleanup");
}
LEAVE_GL();
HeapFree(GetProcessHeap(), 0, context->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, context->free_event_queries);
@ -1233,7 +1223,7 @@ static int context_choose_pixel_format(const struct wined3d_device *device, HDC
return iPixelFormat;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void bind_dummy_textures(const struct wined3d_device *device, const struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -1474,8 +1464,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
swap_interval, ret, GetLastError());
}
ENTER_GL();
gl_info->gl_ops.gl.p_glGetIntegerv(GL_AUX_BUFFERS, &ret->aux_buffers);
TRACE("Setting up the screen\n");
@ -1577,8 +1565,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
if (device->dummy_texture_2d[0])
bind_dummy_textures(device, ret);
LEAVE_GL();
TRACE("Created context %p.\n", ret);
return ret;
@ -1622,7 +1608,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
if (destroy) HeapFree(GetProcessHeap(), 0, context);
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void set_blit_dimension(const struct wined3d_gl_info *gl_info, UINT width, UINT height)
{
const GLdouble projection[] =
@ -1693,9 +1679,7 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
{
if (context->blit_w != rt_size.cx || context->blit_h != rt_size.cy)
{
ENTER_GL();
set_blit_dimension(gl_info, rt_size.cx, rt_size.cy);
LEAVE_GL();
context->blit_w = rt_size.cx;
context->blit_h = rt_size.cy;
/* No need to dirtify here, the states are still dirtified because
@ -1706,15 +1690,6 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
}
context->last_was_blit = TRUE;
/* TODO: Use a display list */
/* Call ENTER_GL() once for all gl calls below. In theory we should not call
* helper functions in between gl calls. This function is full of context_invalidate_state
* which can safely be called from here, we only lock once instead locking/unlocking
* after each GL call.
*/
ENTER_GL();
/* Disable all textures. The caller can then bind a texture it wants to blit
* from
*
@ -1863,8 +1838,6 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
context->select_shader = 1;
context->load_constants = 1;
LEAVE_GL();
context->blit_w = rt_size.cx;
context->blit_h = rt_size.cy;
context_invalidate_state(context, STATE_VIEWPORT);
@ -1881,7 +1854,7 @@ static inline GLenum draw_buffer_from_rt_mask(DWORD rt_mask)
return rt_mask & ~(1 << 31);
}
/* Context activation and GL locking are done by the caller. */
/* Context activation is done by the caller. */
static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt_mask)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -1931,7 +1904,7 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt
}
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -1944,7 +1917,7 @@ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
context->draw_buffers_mask = context_generate_rt_mask(buffer);
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit)
{
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0 + unit));
@ -2077,9 +2050,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
{
surface_internal_preload(rt, SRGB_RGB);
ENTER_GL();
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->draw_binding);
LEAVE_GL();
if (rt->resource.format->id != WINED3DFMT_NULL)
rt_mask = 1;
else
@ -2087,9 +2058,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
}
else
{
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
LEAVE_GL();
rt_mask = context_generate_rt_mask_from_surface(rt);
}
}
@ -2100,7 +2069,6 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask;
ENTER_GL();
if (rt_mask != *cur_mask)
{
context_apply_draw_buffers(context, rt_mask);
@ -2111,7 +2079,6 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
{
context_check_fbo_status(context, GL_FRAMEBUFFER);
}
LEAVE_GL();
SetupForBlit(device, context);
context_invalidate_state(context, STATE_FRAMEBUFFER);
@ -2153,8 +2120,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
{
context_validate_onscreen_formats(context, fb->depth_stencil);
ENTER_GL();
if (!rt_count || surface_is_offscreen(rts[0]))
{
for (i = 0; i < rt_count; ++i)
@ -2179,8 +2144,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
rt_mask = context_generate_rt_mask_from_surface(rts[0]);
}
LEAVE_GL();
/* 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 */
@ -2206,7 +2169,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask;
ENTER_GL();
if (rt_mask != *cur_mask)
{
context_apply_draw_buffers(context, rt_mask);
@ -2228,7 +2190,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
checkGLcall("glEnable GL_SCISSOR_TEST");
LEAVE_GL();
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE));
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE));
@ -2264,7 +2225,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
return rt_mask;
}
/* GL locking and context activation are done by the caller */
/* Context activation is done by the caller. */
void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_device *device = context->swapchain->device;
@ -2296,7 +2257,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
}
}
/* GL locking and context activation are done by the caller */
/* Context activation is done by the caller. */
void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_device *device = context->swapchain->device;
@ -2345,8 +2306,6 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
buffer_get_sysmem(state->index_buffer, context->gl_info);
}
ENTER_GL();
for (i = 0; i < context->numDirtyEntries; ++i)
{
DWORD rep = context->dirtyArray[i];
@ -2375,7 +2334,6 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
context_check_fbo_status(context, GL_FRAMEBUFFER);
}
LEAVE_GL();
context->numDirtyEntries = 0; /* This makes the whole list clean */
context->last_was_blit = FALSE;

View File

@ -710,8 +710,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
return;
}
ENTER_GL();
/* Only set the values up once, as they are not changing. */
if (flags & WINED3DCLEAR_STENCIL)
{
@ -816,8 +814,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
}
}
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering || (flags & WINED3DCLEAR_TARGET
&& target->container.type == WINED3D_CONTAINER_SWAPCHAIN
&& target->container.u.swapchain->front_buffer == target))
@ -978,7 +974,6 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
* OpenGL will only allow that when a valid texture is bound.
* We emulate this by creating dummy textures and binding them
* to each texture stage when the currently set D3D texture is NULL. */
ENTER_GL();
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
@ -1057,8 +1052,6 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
LEAVE_GL();
}
/* Context activation is done by the caller. */
@ -1066,7 +1059,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
{
unsigned int count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers);
ENTER_GL();
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_cube);
@ -1087,7 +1079,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d);
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)");
LEAVE_GL();
memset(device->dummy_texture_cube, 0, gl_info->limits.textures * sizeof(*device->dummy_texture_cube));
memset(device->dummy_texture_3d, 0, gl_info->limits.textures * sizeof(*device->dummy_texture_3d));
@ -1297,8 +1288,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
create_dummy_textures(device, context);
ENTER_GL();
/* Initialize the current view state */
device->view_ident = 1;
device->contexts[0]->last_was_rhw = 0;
@ -1325,7 +1314,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
}
TRACE("All defaults now set up, leaving 3D init.\n");
LEAVE_GL();
context_release(context);
@ -1438,9 +1426,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
/* Delete the mouse cursor texture */
if (device->cursorTexture)
{
ENTER_GL();
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->cursorTexture);
LEAVE_GL();
device->cursorTexture = 0;
}
@ -1449,9 +1435,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
*/
if (device->depth_blt_texture)
{
ENTER_GL();
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture);
LEAVE_GL();
device->depth_blt_texture = 0;
}
@ -3657,10 +3641,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
struct wined3d_buffer *vb = state->streams[e->stream_idx].buffer;
e->data.buffer_object = 0;
e->data.addr = (BYTE *)((ULONG_PTR)e->data.addr + (ULONG_PTR)buffer_get_sysmem(vb, gl_info));
ENTER_GL();
GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object));
vb->buffer_object = 0;
LEAVE_GL();
}
if (e->data.addr)
e->data.addr += e->stride * src_start_idx;
@ -4970,9 +4952,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
if (device->cursorTexture)
{
struct wined3d_context *context = context_acquire(device, NULL);
ENTER_GL();
context->gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->cursorTexture);
LEAVE_GL();
context_release(context);
device->cursorTexture = 0;
}
@ -5037,8 +5017,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
context = context_acquire(device, NULL);
ENTER_GL();
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
@ -5061,8 +5039,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
LEAVE_GL();
context_release(context);
}
else
@ -5219,7 +5195,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
device->shader_backend->shader_destroy(shader);
}
ENTER_GL();
if (device->depth_blt_texture)
{
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture);
@ -5230,7 +5205,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->cursorTexture);
device->cursorTexture = 0;
}
LEAVE_GL();
device->blitter->free_private(device);
device->shader_backend->shader_free_private(device);

View File

@ -412,8 +412,8 @@ ULONG CDECL wined3d_decref(struct wined3d *wined3d)
return refcount;
}
/* GL locking is done by the caller */
static inline BOOL test_arb_vs_offset_limit(const struct wined3d_gl_info *gl_info)
/* Context activation is done by the caller. */
static BOOL test_arb_vs_offset_limit(const struct wined3d_gl_info *gl_info)
{
GLuint prog;
BOOL ret = FALSE;
@ -523,8 +523,6 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
/* No PBO -> No point in testing them. */
if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) return;
ENTER_GL();
while (gl_info->gl_ops.gl.p_glGetError());
gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
@ -542,12 +540,10 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
checkGLcall("Loading the PBO test texture");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
LEAVE_GL();
gl_info->gl_ops.gl.p_glFinish(); /* just to be sure */
memset(check, 0, sizeof(check));
ENTER_GL();
gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, check);
checkGLcall("Reading back the PBO test texture");
@ -555,8 +551,6 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
GL_EXTCALL(glDeleteBuffersARB(1, &pbo));
checkGLcall("PBO test cleanup");
LEAVE_GL();
if (memcmp(check, pattern, sizeof(check)))
{
WARN("PBO test failed, read back data doesn't match original.\n"
@ -613,11 +607,9 @@ static BOOL match_allows_spec_alpha(const struct wined3d_gl_info *gl_info, const
if (!gl_info->supported[EXT_SECONDARY_COLOR])
return FALSE;
ENTER_GL();
while (gl_info->gl_ops.gl.p_glGetError());
GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, 4, data);
error = gl_info->gl_ops.gl.p_glGetError();
LEAVE_GL();
if (error == GL_NO_ERROR)
{
@ -648,14 +640,12 @@ static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const ch
if (!gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]) return FALSE;
ENTER_GL();
while (gl_info->gl_ops.gl.p_glGetError());
GL_EXTCALL(glGenProgramsARB(1, &prog));
if(!prog)
{
ERR("Failed to create the NVvp clip test program\n");
LEAVE_GL();
return FALSE;
}
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
@ -675,7 +665,6 @@ static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const ch
GL_EXTCALL(glDeleteProgramsARB(1, &prog));
checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
LEAVE_GL();
return ret;
}
@ -691,8 +680,6 @@ static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, const ch
memset(data, 0xcc, sizeof(data));
ENTER_GL();
gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -729,8 +716,6 @@ static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, const ch
gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
checkGLcall("glDeleteTextures");
LEAVE_GL();
return *(DWORD *)data == 0x11111111;
}
@ -743,8 +728,6 @@ static BOOL match_broken_rgba16(const struct wined3d_gl_info *gl_info, const cha
GLuint tex;
GLint size;
ENTER_GL();
gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT, NULL);
@ -759,8 +742,6 @@ static BOOL match_broken_rgba16(const struct wined3d_gl_info *gl_info, const cha
gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
checkGLcall("glDeleteTextures");
LEAVE_GL();
return size < 16;
}
@ -2608,13 +2589,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
TRACE("adapter %p.\n", adapter);
ENTER_GL();
gl_renderer_str = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_RENDERER);
TRACE("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str));
if (!gl_renderer_str)
{
LEAVE_GL();
ERR("Received a NULL GL_RENDERER.\n");
return FALSE;
}
@ -2623,7 +2601,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
TRACE("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str));
if (!gl_vendor_str)
{
LEAVE_GL();
ERR("Received a NULL GL_VENDOR.\n");
return FALSE;
}
@ -2633,7 +2610,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
TRACE("GL_VERSION: %s.\n", debugstr_a(gl_version_str));
if (!gl_version_str)
{
LEAVE_GL();
ERR("Received a NULL GL_VERSION.\n");
return FALSE;
}
@ -2643,13 +2619,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
GL_Extensions = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_EXTENSIONS);
if (!GL_Extensions)
{
LEAVE_GL();
ERR("Received a NULL GL_EXTENSIONS.\n");
return FALSE;
}
LEAVE_GL();
memset(gl_info->supported, 0, sizeof(gl_info->supported));
gl_info->supported[WINED3D_GL_EXT_NONE] = TRUE;
@ -2792,8 +2765,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
gl_info->supported[ARB_FRAMEBUFFER_SRGB] = FALSE;
}
ENTER_GL();
wined3d_adapter_init_limits(gl_info);
if (gl_info->supported[ARB_VERTEX_PROGRAM] && test_arb_vs_offset_limit(gl_info))
@ -2813,8 +2784,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
checkGLcall("extension detection");
LEAVE_GL();
adapter->fragment_pipe = select_fragment_implementation(gl_info);
adapter->shader_backend = select_shader_backend(gl_info);
adapter->blitter = select_blit_implementation(gl_info);

View File

@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw);
#include <stdio.h>
#include <math.h>
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void drawStridedFast(const struct wined3d_gl_info *gl_info, GLenum primitive_type, UINT count, UINT idx_size,
const void *idx_data, UINT start_idx, INT base_vertex_index, UINT start_instance, UINT instance_count)
{
@ -81,7 +81,7 @@ static void drawStridedFast(const struct wined3d_gl_info *gl_info, GLenum primit
* Slower GL version which extracts info about each vertex in turn
*/
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void drawStridedSlow(const struct wined3d_device *device, const struct wined3d_context *context,
const struct wined3d_stream_info *si, UINT NumVertexes, GLenum glPrimType,
const void *idxData, UINT idxSize, UINT startIdx)
@ -325,7 +325,7 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
checkGLcall("glEnd and previous calls");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static inline void send_attribute(const struct wined3d_gl_info *gl_info,
enum wined3d_format_id format, const UINT index, const void *ptr)
{
@ -435,7 +435,7 @@ static inline void send_attribute(const struct wined3d_gl_info *gl_info,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void drawStridedSlowVs(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
const struct wined3d_stream_info *si, UINT numberOfVertices, GLenum glPrimitiveType,
const void *idxData, UINT idxSize, UINT startIdx)
@ -491,7 +491,7 @@ static void drawStridedSlowVs(const struct wined3d_gl_info *gl_info, const struc
gl_info->gl_ops.gl.p_glEnd();
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void drawStridedInstanced(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
const struct wined3d_stream_info *si, UINT numberOfVertices, GLenum glPrimitiveType,
const void *idxData, UINT idxSize, UINT startIdx, UINT base_vertex_index, UINT instance_count)
@ -666,8 +666,6 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
FIXME("Point sprite coordinate origin switching not supported.\n");
}
/* Ok, we will be updating the screen from here onwards so grab the lock */
ENTER_GL();
{
GLenum glPrimType = state->gl_primitive_type;
INT base_vertex_index = state->base_vertex_index;
@ -769,9 +767,6 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
}
}
/* Finished updating the screen, restore lock */
LEAVE_GL();
if (ib_query)
wined3d_event_query_issue(ib_query, device);
for (i = 0; i < device->num_buffer_queries; ++i)
@ -895,8 +890,6 @@ HRESULT tesselate_rectpatch(struct wined3d_device *This, struct wined3d_rect_pat
patch->has_normals = TRUE;
patch->has_texcoords = FALSE;
ENTER_GL();
gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
checkGLcall("glMatrixMode(GL_PROJECTION)");
gl_info->gl_ops.gl.p_glLoadIdentity();
@ -1033,18 +1026,20 @@ HRESULT tesselate_rectpatch(struct wined3d_device *This, struct wined3d_rect_pat
i = gl_info->gl_ops.gl.p_glRenderMode(GL_RENDER);
if (i == -1)
{
LEAVE_GL();
ERR("Feedback failed. Expected %d elements back\n", buffer_size);
HeapFree(GetProcessHeap(), 0, feedbuffer);
context_release(context);
return WINED3DERR_DRIVERINTERNALERROR;
} else if(i != buffer_size) {
LEAVE_GL();
}
else if (i != buffer_size)
{
ERR("Unexpected amount of elements returned. Expected %d, got %d\n", buffer_size, i);
HeapFree(GetProcessHeap(), 0, feedbuffer);
context_release(context);
return WINED3DERR_DRIVERINTERNALERROR;
} else {
}
else
{
TRACE("Got %d elements as expected\n", i);
}
@ -1155,7 +1150,6 @@ HRESULT tesselate_rectpatch(struct wined3d_device *This, struct wined3d_rect_pat
gl_info->gl_ops.gl.p_glDisable(GL_MAP2_NORMAL);
gl_info->gl_ops.gl.p_glDisable(GL_MAP2_TEXTURE_COORD_4);
checkGLcall("glDisable vertex attrib generation");
LEAVE_GL();
context_release(context);

View File

@ -245,8 +245,7 @@ static char *get_info_log_line(char **ptr)
return p;
}
/** Prints the GLSL info log which will contain error messages if they exist */
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLhandleARB obj)
{
int infologLength = 0;
@ -288,7 +287,7 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLhandleA
}
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
static void shader_glsl_compile(const struct wined3d_gl_info *gl_info, GLhandleARB shader, const char *src)
{
TRACE("Compiling shader object %u.\n", shader);
@ -299,7 +298,7 @@ static void shader_glsl_compile(const struct wined3d_gl_info *gl_info, GLhandleA
print_glsl_info_log(gl_info, shader);
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_info, GLhandleARB program)
{
GLint i, object_count, source_size = -1;
@ -353,7 +352,7 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
HeapFree(GetProcessHeap(), 0, objects);
}
/* GL locking is done by the caller. */
/* Context activation is done by the caller. */
static void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLhandleARB program)
{
GLint tmp;
@ -374,10 +373,7 @@ static void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLh
print_glsl_info_log(gl_info, program);
}
/**
* Loads (pixel shader) samplers
*/
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_load_psamplers(const struct wined3d_gl_info *gl_info,
const DWORD *tex_unit_map, GLhandleARB programId)
{
@ -403,7 +399,7 @@ static void shader_glsl_load_psamplers(const struct wined3d_gl_info *gl_info,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_load_vsamplers(const struct wined3d_gl_info *gl_info,
const DWORD *tex_unit_map, GLhandleARB programId)
{
@ -429,7 +425,7 @@ static void shader_glsl_load_vsamplers(const struct wined3d_gl_info *gl_info,
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, const float *constants,
const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version)
{
@ -489,7 +485,7 @@ static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, con
checkGLcall("walk_constant_heap()");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info, GLint location, const GLfloat *data)
{
GLfloat clamped_constant[4];
@ -504,7 +500,7 @@ static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info,
GL_EXTCALL(glUniform4fvARB(location, 1, clamped_constant));
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info, const float *constants,
const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version)
{
@ -562,8 +558,7 @@ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_i
checkGLcall("walk_constant_heap_clamped()");
}
/* Loads floating point constants (aka uniforms) into the currently set GLSL program. */
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
const float *constants, const GLint *constant_locations, const struct constant_heap *heap,
unsigned char *stack, UINT version)
@ -593,8 +588,7 @@ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, con
checkGLcall("glUniform4fvARB()");
}
/* Loads integer constants (aka uniforms) into the currently set GLSL program. */
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
const GLint locations[MAX_CONST_I], const int *constants, WORD constants_set)
{
@ -631,8 +625,7 @@ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, con
}
}
/* Loads boolean constants (aka uniforms) into the currently set GLSL program. */
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
GLhandleARB programId, const BOOL *constants, WORD constants_set)
{
@ -690,10 +683,7 @@ static void reset_program_constant_version(struct wine_rb_entry *entry, void *co
WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry)->constant_version = 0;
}
/**
* Loads the texture dimensions for NP2 fixup into the currently set GLSL program.
*/
/* GL locking is done by the caller (state handler) */
/* Context activation is done by the caller (state handler). */
static void shader_glsl_load_np2fixup_constants(void *shader_priv,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
@ -741,10 +731,7 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv,
}
}
/**
* Loads the app-supplied constants into the currently set GLSL program.
*/
/* GL locking is done by the caller (state handler) */
/* Context activation is done by the caller (state handler). */
static void shader_glsl_load_constants(const struct wined3d_context *context,
BOOL usePixelShader, BOOL useVertexShader)
{
@ -4201,7 +4188,7 @@ static struct glsl_shader_prog_link *get_glsl_program_entry(const struct shader_
return entry ? WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry) : NULL;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info,
struct glsl_shader_prog_link *entry)
{
@ -4317,7 +4304,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
HeapFree(GetProcessHeap(), 0, set);
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer,
const struct wined3d_shader *vs, const struct wined3d_shader *ps,
const struct wined3d_gl_info *gl_info)
@ -4468,7 +4455,7 @@ static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer,
shader_addline(buffer, "gl_FragData[0].xyz = mix(gl_Fog.color.xyz, gl_FragData[0].xyz, clamp(Fog, 0.0, 1.0));\n");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void hardcode_local_constants(const struct wined3d_shader *shader,
const struct wined3d_gl_info *gl_info, GLhandleARB programId, const char *prefix)
{
@ -4487,7 +4474,7 @@ static void hardcode_local_constants(const struct wined3d_shader *shader,
checkGLcall("Hardcoding local constants");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context,
struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader,
const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info)
@ -4550,7 +4537,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
return shader_obj;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context,
struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader,
const struct vs_compile_args *args)
@ -4622,7 +4609,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
return shader_obj;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLhandleARB shader_glsl_generate_geometry_shader(const struct wined3d_context *context,
struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader)
{
@ -5531,16 +5518,7 @@ static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *
ps->ycorrection_location = GL_EXTCALL(glGetUniformLocationARB(program_id, "ycorrection"));
}
/** Sets the GLSL program ID for the given pixel and vertex shader combination.
* It sets the programId on the current StateBlock (because it should be called
* inside of the DrawPrimitive() part of the render loop).
*
* If a program for the given combination does not exist, create one, and store
* the program in the hash table. If it creates a program, it will link the
* given objects, too.
*/
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void set_glsl_shader_program(const struct wined3d_context *context, struct wined3d_device *device,
enum wined3d_shader_mode vertex_mode, enum wined3d_shader_mode fragment_mode)
{
@ -5740,7 +5718,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, struc
hardcode_local_constants(vshader, gl_info, programId, "vs");
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info, enum tex_types tex_type, BOOL masked)
{
GLhandleARB program_id;
@ -5850,7 +5828,7 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info,
return program_id;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_select(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode,
enum wined3d_shader_mode fragment_mode)
{
@ -5890,7 +5868,7 @@ static void shader_glsl_select(const struct wined3d_context *context, enum wined
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info,
enum tex_types tex_type, const SIZE *ds_mask_size)
{
@ -5919,7 +5897,7 @@ static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d
}
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void shader_glsl_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info)
{
struct shader_glsl_priv *priv = shader_priv;
@ -5958,8 +5936,6 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
struct glsl_shader_prog_link *entry, *entry2;
UINT i;
ENTER_GL();
switch (shader->reg_maps.shader_version.type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@ -6035,8 +6011,6 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
ERR("Unhandled shader type %#x.\n", shader->reg_maps.shader_version.type);
break;
}
LEAVE_GL();
}
HeapFree(GetProcessHeap(), 0, shader->backend_data);
@ -6165,7 +6139,6 @@ static void shader_glsl_free(struct wined3d_device *device)
struct shader_glsl_priv *priv = device->shader_priv;
int i;
ENTER_GL();
for (i = 0; i < tex_type_count; ++i)
{
if (priv->depth_blt_program_full[i])
@ -6177,7 +6150,6 @@ static void shader_glsl_free(struct wined3d_device *device)
GL_EXTCALL(glDeleteObjectARB(priv->depth_blt_program_masked[i]));
}
}
LEAVE_GL();
wine_rb_destroy(&priv->program_lookup, NULL, NULL);
constant_heap_free(&priv->pconst_heap);

View File

@ -29,7 +29,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* GL locking for state handlers is done by the caller. */
/* Context activation for state handlers is done by the caller. */
static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD stage, struct wined3d_context *context)
{
@ -652,7 +652,7 @@ static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
}
}
/* Context activation and GL locking are done by the caller. */
/* Context activation is done by the caller. */
static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
nvrc_enable(gl_info, enable);

View File

@ -61,8 +61,6 @@ static enum wined3d_event_query_result wined3d_event_query_test(const struct win
context = context_acquire(device, query->context->current_rt);
gl_info = context->gl_info;
ENTER_GL();
if (gl_info->supported[ARB_SYNC])
{
GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, 0, 0));
@ -105,8 +103,6 @@ static enum wined3d_event_query_result wined3d_event_query_test(const struct win
ret = WINED3D_EVENT_QUERY_ERROR;
}
LEAVE_GL();
context_release(context);
return ret;
}
@ -138,7 +134,6 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_
context = context_acquire(device, query->context->current_rt);
ENTER_GL();
if (gl_info->supported[ARB_SYNC])
{
/* Apple seems to be into arbitrary limits, and timeouts larger than
@ -177,7 +172,6 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_
ERR("Event query created without GL support\n");
ret = WINED3D_EVENT_QUERY_ERROR;
}
LEAVE_GL();
context_release(context);
return ret;
@ -209,8 +203,6 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, const struct w
gl_info = context->gl_info;
ENTER_GL();
if (gl_info->supported[ARB_SYNC])
{
if (query->object.sync) GL_EXTCALL(glDeleteSync(query->object.sync));
@ -229,8 +221,6 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, const struct w
checkGLcall("glSetFenceNV");
}
LEAVE_GL();
context_release(context);
}
@ -345,8 +335,6 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query,
context = context_acquire(query->device, oq->context->current_rt);
ENTER_GL();
GL_EXTCALL(glGetQueryObjectuivARB(oq->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)");
TRACE("available %#x.\n", available);
@ -367,8 +355,6 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query,
res = S_FALSE;
}
LEAVE_GL();
context_release(context);
return res;
@ -480,10 +466,8 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW
{
context = context_acquire(query->device, oq->context->current_rt);
ENTER_GL();
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
checkGLcall("glEndQuery()");
LEAVE_GL();
}
}
else
@ -493,10 +477,8 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW
context_alloc_occlusion_query(context, oq);
}
ENTER_GL();
GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, oq->id));
checkGLcall("glBeginQuery()");
LEAVE_GL();
context_release(context);
}
@ -516,10 +498,8 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW
{
context = context_acquire(query->device, oq->context->current_rt);
ENTER_GL();
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
checkGLcall("glEndQuery()");
LEAVE_GL();
context_release(context);
}

View File

@ -38,7 +38,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
/* GL locking for state handlers is done by the caller. */
/* Context activation for state handler is done by the caller. */
static void state_undefined(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
@ -5657,7 +5657,7 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
};
/* Context activation and GL locking are done by the caller. */
/* Context activation is done by the caller. */
static void ffp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)

View File

@ -57,8 +57,6 @@ static void surface_cleanup(struct wined3d_surface *surface)
context = context_acquire(surface->resource.device, NULL);
gl_info = context->gl_info;
ENTER_GL();
if (surface->texture_name)
{
TRACE("Deleting texture %u.\n", surface->texture_name);
@ -90,8 +88,6 @@ static void surface_cleanup(struct wined3d_surface *surface)
HeapFree(GetProcessHeap(), 0, entry);
}
LEAVE_GL();
context_release(context);
}
@ -313,7 +309,7 @@ static void surface_get_rect(const struct wined3d_surface *surface, const RECT *
}
}
/* GL locking and context activation is done by the caller */
/* Context activation is done by the caller. */
void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context,
const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter)
{
@ -532,7 +528,6 @@ static void surface_load_pbo(struct wined3d_surface *surface, const struct wined
GLenum error;
context = context_acquire(surface->resource.device, NULL);
ENTER_GL();
GL_EXTCALL(glGenBuffersARB(1, &surface->pbo));
error = gl_info->gl_ops.gl.p_glGetError();
@ -559,7 +554,6 @@ static void surface_load_pbo(struct wined3d_surface *surface, const struct wined
}
surface->resource.allocatedMemory = NULL;
surface->flags |= SFLAG_PBO;
LEAVE_GL();
context_release(context);
}
@ -622,8 +616,6 @@ static void surface_bind(struct wined3d_surface *surface, struct wined3d_context
if (srgb)
ERR("Trying to bind standalone surface %p as sRGB.\n", surface);
ENTER_GL();
if (!surface->texture_name)
{
gl_info->gl_ops.gl.p_glGenTextures(1, &surface->texture_name);
@ -643,8 +635,6 @@ static void surface_bind(struct wined3d_surface *surface, struct wined3d_context
{
context_bind_texture(context, surface->texture_target, surface->texture_name);
}
LEAVE_GL();
}
}
@ -681,7 +671,6 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
struct wined3d_context *context = context_acquire(surface->resource.device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
ENTER_GL();
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
if (surface->texture_name)
{
@ -696,7 +685,6 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
}
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
LEAVE_GL();
context_release(context);
@ -922,7 +910,6 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD
context = context_acquire(device, NULL);
gl_info = context->gl_info;
ENTER_GL();
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
@ -939,7 +926,6 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
checkGLcall("glBindBufferARB");
LEAVE_GL();
context_release(context);
}
@ -981,12 +967,10 @@ static void surface_unmap(struct wined3d_surface *surface)
context = context_acquire(device, NULL);
gl_info = context->gl_info;
ENTER_GL();
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo));
GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB));
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
checkGLcall("glUnmapBufferARB");
LEAVE_GL();
context_release(context);
surface->resource.allocatedMemory = NULL;
@ -1108,8 +1092,6 @@ static void wined3d_surface_depth_blt_fbo(const struct wined3d_device *device, s
gl_info = context->gl_info;
ENTER_GL();
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL, src_surface, SFLAG_INTEXTURE);
gl_info->gl_ops.gl.p_glReadBuffer(GL_NONE);
checkGLcall("glReadBuffer()");
@ -1143,8 +1125,6 @@ static void wined3d_surface_depth_blt_fbo(const struct wined3d_device *device, s
dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, gl_mask, GL_NEAREST);
checkGLcall("glBlitFramebuffer()");
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
@ -1226,12 +1206,10 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
buffer = GL_COLOR_ATTACHMENT0;
}
ENTER_GL();
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, src_surface, NULL, src_location);
gl_info->gl_ops.gl.p_glReadBuffer(buffer);
checkGLcall("glReadBuffer()");
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
LEAVE_GL();
if (dst_location == SFLAG_INDRAWABLE)
{
@ -1245,7 +1223,6 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
buffer = GL_COLOR_ATTACHMENT0;
}
ENTER_GL();
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location);
context_set_draw_buffer(context, buffer);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
@ -1264,8 +1241,6 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
dst_rect.left, dst_rect.top, dst_rect.right, dst_rect.bottom, GL_COLOR_BUFFER_BIT, gl_filter);
checkGLcall("glBlitFramebuffer()");
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering
|| (dst_location == SFLAG_INDRAWABLE
&& dst_surface->container.u.swapchain->front_buffer == dst_surface))
@ -1791,7 +1766,6 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win
+ (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
}
ENTER_GL();
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, surface->pbo)");
GL_EXTCALL(glGetBufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0,
@ -1799,7 +1773,6 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win
checkGLcall("glGetBufferSubDataARB");
GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo));
checkGLcall("glDeleteBuffersARB");
LEAVE_GL();
surface->pbo = 0;
surface->flags &= ~SFLAG_PBO;
@ -1891,17 +1864,13 @@ static void surface_unload(struct wined3d_resource *resource)
*/
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &surface->renderbuffers, struct wined3d_renderbuffer_entry, entry)
{
ENTER_GL();
gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id);
LEAVE_GL();
list_remove(&entry->entry);
HeapFree(GetProcessHeap(), 0, entry);
}
list_init(&surface->renderbuffers);
surface->current_renderbuffer = NULL;
ENTER_GL();
/* If we're in a texture, the texture name belongs to the texture.
* Otherwise, destroy it. */
if (surface->container.type != WINED3D_CONTAINER_TEXTURE)
@ -1922,8 +1891,6 @@ static void surface_unload(struct wined3d_resource *resource)
surface->rb_resolved = 0;
}
LEAVE_GL();
context_release(context);
resource_unload(resource);
@ -2138,8 +2105,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
return;
}
ENTER_GL();
if (format->flags & WINED3DFMT_FLAG_COMPRESSED)
{
TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n",
@ -2161,8 +2126,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
surface->texture_level, surface->resource.allocatedMemory));
checkGLcall("glGetCompressedTexImageARB");
}
LEAVE_GL();
}
else
{
@ -2213,7 +2176,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
gl_format, gl_type, mem);
checkGLcall("glGetTexImage");
}
LEAVE_GL();
if (surface->flags & SFLAG_NONPOW2)
{
@ -2314,8 +2276,6 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
update_h /= format->height_scale.denominator;
}
ENTER_GL();
if (data->buffer_object)
{
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, data->buffer_object));
@ -2388,8 +2348,6 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
checkGLcall("glBindBufferARB");
}
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush();
@ -2705,8 +2663,6 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
surface, surface->texture_target, surface->texture_level, debug_d3dformat(format->id),
internal, width, height, format->glFormat, format->glType);
ENTER_GL();
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
if (surface->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED)
@ -2753,13 +2709,12 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
LEAVE_GL();
}
/* In D3D the depth stencil dimensions have to be greater than or equal to the
* render target dimensions. With FBOs, the dimensions have to be an exact match. */
/* TODO: We should synchronize the renderbuffer's content with the texture's content. */
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const struct wined3d_surface *rt)
{
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
@ -4156,9 +4111,7 @@ void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB
/* Tell opengl to try and keep this texture in video ram (well mostly) */
GLclampf tmp;
tmp = 0.9f;
ENTER_GL();
context->gl_info->gl_ops.gl.p_glPrioritizeTextures(1, &surface->texture_name, &tmp);
LEAVE_GL();
}
context_release(context);
@ -4187,8 +4140,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r
context_apply_blit_state(context, device);
gl_info = context->gl_info;
ENTER_GL();
/* 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 of the code
* that reads sets the read buffer as desired.
@ -4255,7 +4206,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r
if (!mem)
{
ERR("Out of memory\n");
LEAVE_GL();
return;
}
bpp = surface->resource.format->byte_count * 3;
@ -4344,7 +4294,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r
ERR("Out of memory\n");
if (surface->resource.format->id == WINED3DFMT_P8_UINT)
HeapFree(GetProcessHeap(), 0, mem);
LEAVE_GL();
return;
}
@ -4367,7 +4316,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r
}
}
LEAVE_GL();
context_release(context);
/* For P8 textures we need to perform an inverse palette lookup. This is
@ -4432,8 +4380,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb)
TRACE("Reading back offscreen render target %p.\n", surface);
ENTER_GL();
if (surface_is_offscreen(surface))
gl_info->gl_ops.gl.p_glReadBuffer(device->offscreenBuffer);
else
@ -4444,8 +4390,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb)
0, 0, 0, 0, surface->resource.width, surface->resource.height);
checkGLcall("glCopyTexSubImage2D");
LEAVE_GL();
context_release(context);
}
@ -4539,8 +4483,6 @@ static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface,
context_apply_blit_state(context, device);
gl_info = context->gl_info;
ENTER_GL();
if (!surface_is_offscreen(surface))
{
GLenum buffer = surface_get_gl_buffer(surface);
@ -4583,8 +4525,6 @@ static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface,
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
checkGLcall("glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)");
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering
|| (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
&& surface->container.u.swapchain->front_buffer == surface))
@ -4923,7 +4863,6 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
gl_info = context->gl_info;
context_apply_blit_state(context, device);
surface_internal_preload(dst_surface, SRGB_RGB);
ENTER_GL();
/* Bind the target texture */
context_bind_texture(context, dst_target, dst_surface->texture_name);
@ -4999,7 +4938,6 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
}
checkGLcall("glCopyTexSubImage2D");
LEAVE_GL();
context_release(context);
/* The texture is now most up to date - If the surface is a render target and has a drawable, this
@ -5041,7 +4979,6 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
/* Get it a description */
surface_internal_preload(src_surface, SRGB_RGB);
}
ENTER_GL();
/* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring.
* This way we don't have to wait for the 2nd readback to finish to leave this function.
@ -5274,8 +5211,6 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
checkGLcall("glDeleteTextures(1, &backup)");
}
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
@ -5343,8 +5278,6 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
device->blitter->set_shader(device->blit_priv, context, src_surface);
ENTER_GL();
if (color_key)
{
gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
@ -5375,8 +5308,6 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
checkGLcall("glDisable(GL_ALPHA_TEST)");
}
LEAVE_GL();
/* Leave the opengl state valid for blitting */
device->blitter->unset_shader(context->gl_info);
@ -5597,7 +5528,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa
return WINED3DERR_INVALIDCALL;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void surface_depth_blt(const struct wined3d_surface *surface, struct wined3d_context *context,
GLuint texture, GLint x, GLint y, GLsizei w, GLsizei h, GLenum target)
{
@ -5766,8 +5697,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
TRACE("Copying onscreen depth buffer to depth texture.\n");
ENTER_GL();
if (!device->depth_blt_texture)
gl_info->gl_ops.gl.p_glGenTextures(1, &device->depth_blt_texture);
@ -5813,8 +5742,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
context_invalidate_state(context, STATE_FRAMEBUFFER);
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
}
@ -5822,8 +5749,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
{
TRACE("Copying depth texture to onscreen depth buffer.\n");
ENTER_GL();
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER,
context->swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
surface_depth_blt(surface, context, surface->texture_name,
@ -5832,8 +5757,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
context_invalidate_state(context, STATE_FRAMEBUFFER);
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
}
@ -6366,9 +6289,7 @@ static void ffp_blit_p8_upload_palette(const struct wined3d_surface *surface, co
d3dfmt_p8_init_palette(surface, table, colorkey_active);
TRACE("Using GL_EXT_PALETTED_TEXTURE for 8-bit paletted texture support\n");
ENTER_GL();
GL_EXTCALL(glColorTableEXT(target, GL_RGBA, 256, GL_RGBA, GL_UNSIGNED_BYTE, table));
LEAVE_GL();
}
/* Context activation is done by the caller. */
@ -6390,17 +6311,15 @@ static HRESULT ffp_blit_set(void *blit_priv, struct wined3d_context *context, co
&& gl_info->supported[EXT_PALETTED_TEXTURE])
ffp_blit_p8_upload_palette(surface, gl_info);
ENTER_GL();
gl_info->gl_ops.gl.p_glEnable(target);
checkGLcall("glEnable(target)");
LEAVE_GL();
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void ffp_blit_unset(const struct wined3d_gl_info *gl_info)
{
ENTER_GL();
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)");
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
@ -6413,7 +6332,6 @@ static void ffp_blit_unset(const struct wined3d_gl_info *gl_info)
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
}
LEAVE_GL();
}
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,

View File

@ -316,7 +316,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
surface_load_location(backbuffer, location, NULL);
}
ENTER_GL();
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, location);
gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
@ -339,7 +338,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
dst_rect->left, win_h - dst_rect->top, dst_rect->right, win_h - dst_rect->bottom,
GL_COLOR_BUFFER_BIT, gl_filter);
checkGLcall("Swapchain present blit(EXT_framebuffer_blit)\n");
LEAVE_GL();
}
else
{
@ -364,7 +362,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
if (is_complex_fixup(backbuffer->resource.format->color_fixup))
gl_filter = GL_NEAREST;
ENTER_GL();
context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
context_bind_texture(context2, backbuffer->texture_target, backbuffer->texture_name);
@ -414,7 +411,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
device->blitter->unset_shader(context->gl_info);
checkGLcall("Swapchain present blit(manual)\n");
LEAVE_GL();
context_release(context2);
}

View File

@ -77,9 +77,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
/* A GL context is provided by the caller */
static void gltexture_delete(const struct wined3d_gl_info *gl_info, struct gl_texture *tex)
{
ENTER_GL();
gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex->name);
LEAVE_GL();
tex->name = 0;
}
@ -153,7 +151,6 @@ static HRESULT wined3d_texture_bind(struct wined3d_texture *texture,
gl_tex = wined3d_texture_get_gl_texture(texture, context->gl_info, srgb);
target = texture->target;
ENTER_GL();
/* Generate a texture name if we don't already have one. */
if (!gl_tex->name)
{
@ -233,11 +230,10 @@ static HRESULT wined3d_texture_bind(struct wined3d_texture *texture,
hr = WINED3DERR_INVALIDCALL;
}
LEAVE_GL();
return hr;
}
/* GL locking is done by the caller */
/* Context activation is done by the caller. */
static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target,
enum wined3d_texture_address d3d_wrap, GLenum param, BOOL cond_np2)
{
@ -261,7 +257,7 @@ static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target,
checkGLcall("glTexParameteri(target, param, gl_wrap)");
}
/* GL locking is done by the caller (state handler) */
/* Context activation is done by the caller (state handler). */
void wined3d_texture_apply_state_changes(struct wined3d_texture *texture,
const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1],
const struct wined3d_gl_info *gl_info)
@ -628,7 +624,6 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture,
{
GLenum target = texture->target;
ENTER_GL();
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
@ -637,7 +632,6 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture,
checkGLcall("glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
checkGLcall("glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
LEAVE_GL();
gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3D_TADDRESS_CLAMP;
gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3D_TADDRESS_CLAMP;
gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3D_TEXF_POINT;

View File

@ -991,8 +991,6 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
GLenum status;
GLuint tex;
ENTER_GL();
while (gl_info->gl_ops.gl.p_glGetError());
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
@ -1194,8 +1192,6 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
format->flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
LEAVE_GL();
}
/* Context activation is done by the caller. */
@ -1206,14 +1202,10 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info)
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
ENTER_GL();
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);
LEAVE_GL();
}
for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i)
@ -1248,13 +1240,7 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info)
}
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
ENTER_GL();
gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
LEAVE_GL();
}
}
static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
@ -1345,7 +1331,6 @@ static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
* than Wine. The Linux binary <= r500 driver is not maintained any more anyway
*/
ENTER_GL();
while (gl_info->gl_ops.gl.p_glGetError());
gl_info->gl_ops.gl.p_glGenTextures(1, &buffer);
@ -1423,7 +1408,7 @@ static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
FIXME("Error during filtering test for format %x, returning no filtering\n", internal);
ret = FALSE;
}
LEAVE_GL();
return ret;
}
@ -2524,8 +2509,8 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage,
return FALSE;
}
/* Setup this textures matrix according to the texture flags*/
/* GL locking is done by the caller (state handler) */
/* Setup this textures matrix according to the texture flags. */
/* Context activation is done by the caller (state handler). */
void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags,
BOOL calculatedCoords, BOOL transformed, enum wined3d_format_id vtx_fmt, BOOL ffp_proj_control)
{
@ -3174,11 +3159,10 @@ void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *des
}
}
/* Activates the texture dimension according to the bound D3D texture.
* Does not care for the colorop or correct gl texture unit(when using nvrc)
* Requires the caller to activate the correct unit before
*/
/* GL locking is done by the caller (state handler) */
/* Activates the texture dimension according to the bound D3D texture. Does
* not care for the colorop or correct gl texture unit (when using nvrc).
* Requires the caller to activate the correct unit. */
/* Context activation is done by the caller (state handler). */
void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
{
if (texture)
@ -3265,7 +3249,7 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
}
}
/* GL locking is done by the caller (state handler) */
/* Context activation is done by the caller (state handler). */
void sampler_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD sampler = state_id - STATE_SAMPLER(0);

View File

@ -88,12 +88,10 @@ void volume_load(const struct wined3d_volume *volume, struct wined3d_context *co
volume_bind_and_dirtify(volume, context);
ENTER_GL();
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal,
volume->resource.width, volume->resource.height, volume->resource.depth,
0, format->glFormat, format->glType, volume->resource.allocatedMemory));
checkGLcall("glTexImage3D");
LEAVE_GL();
/* When adding code releasing volume->resource.allocatedMemory to save
* data keep in mind that GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by

View File

@ -822,15 +822,6 @@ extern const struct wined3d_shader_backend_ops glsl_shader_backend DECLSPEC_HIDD
extern const struct wined3d_shader_backend_ops arb_program_shader_backend DECLSPEC_HIDDEN;
extern const struct wined3d_shader_backend_ops none_shader_backend DECLSPEC_HIDDEN;
#define ENTER_GL() do {} while(0)
#define LEAVE_GL() do {} while(0)
/*****************************************************************************
* Defines
*/
/* GL related defines */
/* ------------------ */
#define GL_EXTCALL(f) (gl_info->gl_ops.ext.p_##f)
#define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xff)