Commit 894d1618 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Call core GL functions through gl_info.gl_ops as well.

parent af1ba676
......@@ -1095,11 +1095,14 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
/* Context activation and GL locking are done by the caller. */
static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
if(enable) {
glEnable(GL_FRAGMENT_SHADER_ATI);
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_SHADER_ATI);
checkGLcall("glEnable(GL_FRAGMENT_SHADER_ATI)");
} else {
glDisable(GL_FRAGMENT_SHADER_ATI);
}
else
{
gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_SHADER_ATI);
checkGLcall("glDisable(GL_FRAGMENT_SHADER_ATI)");
}
}
......
......@@ -127,7 +127,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
* if an error during VBO creation occurs we can fall back to non-vbo operation
* with full functionality(but performance loss)
*/
while (glGetError() != GL_NO_ERROR);
while (gl_info->gl_ops.gl.p_glGetError() != GL_NO_ERROR);
/* Basically the FVF parameter passed to CreateVertexBuffer is no good.
* The vertex declaration from the device determines how the data in the
......@@ -136,7 +136,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
* format. */
GL_EXTCALL(glGenBuffersARB(1, &This->buffer_object));
error = glGetError();
error = gl_info->gl_ops.gl.p_glGetError();
if (!This->buffer_object || error != GL_NO_ERROR)
{
ERR("Failed to create a VBO with error %s (%#x)\n", debug_glerror(error), error);
......@@ -147,7 +147,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
if (This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
device_invalidate_state(This->resource.device, STATE_INDEXBUFFER);
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
error = glGetError();
error = gl_info->gl_ops.gl.p_glGetError();
if (error != GL_NO_ERROR)
{
ERR("Failed to bind the VBO with error %s (%#x)\n", debug_glerror(error), error);
......@@ -187,7 +187,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
* we're not double buffering, so we can release the heap mem afterwards
*/
GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, This->resource.allocatedMemory, gl_usage));
error = glGetError();
error = gl_info->gl_ops.gl.p_glGetError();
LEAVE_GL();
if (error != GL_NO_ERROR)
{
......@@ -635,7 +635,7 @@ static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const st
}
/* Since we don't know about old draws a glFinish is needed once */
glFinish();
gl_info->gl_ops.gl.p_glFinish();
return;
}
TRACE("Synchronizing buffer %p\n", This);
......@@ -663,7 +663,7 @@ drop_query:
This->query = NULL;
}
glFinish();
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)");
......@@ -1195,7 +1195,8 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint));
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering) glFlush(); /* Flush to ensure ordering across contexts. */
if (wined3d_settings.strict_draw_ordering)
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
buffer->resource.allocatedMemory = NULL;
......
......@@ -33,6 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD stage, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
BOOL bumpmap = FALSE;
if (stage > 0
......@@ -50,24 +51,28 @@ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD st
switch (state->textures[stage]->target)
{
case GL_TEXTURE_2D:
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
break;
case GL_TEXTURE_RECTANGLE_ARB:
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
break;
case GL_TEXTURE_3D:
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D)");
break;
case GL_TEXTURE_CUBE_MAP_ARB:
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
break;
}
} else {
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
}
else
{
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE)");
}
}
......@@ -494,12 +499,12 @@ static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_s
if (state->lowest_disabled_stage > 0)
{
glEnable(GL_REGISTER_COMBINERS_NV);
gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, state->lowest_disabled_stage));
}
else
{
glDisable(GL_REGISTER_COMBINERS_NV);
gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
}
if (stage >= state->lowest_disabled_stage)
{
......@@ -507,23 +512,23 @@ static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_s
if (mapped_stage != WINED3D_UNMAPPED_STAGE)
{
/* Disable everything here */
glDisable(GL_TEXTURE_2D);
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)");
glDisable(GL_TEXTURE_3D);
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)");
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
}
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB);
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
}
if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->limits.textures)
{
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
}
}
/* All done */
......@@ -615,7 +620,7 @@ static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3
mat[1][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT01]);
mat[0][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT10]);
mat[1][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT11]);
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *)mat);
gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *)mat);
checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
}
}
......@@ -634,12 +639,12 @@ static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
if (enable)
{
glEnable(GL_REGISTER_COMBINERS_NV);
gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
checkGLcall("glEnable(GL_REGISTER_COMBINERS_NV)");
}
else
{
glDisable(GL_REGISTER_COMBINERS_NV);
gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
checkGLcall("glDisable(GL_REGISTER_COMBINERS_NV)");
}
}
......@@ -650,12 +655,12 @@ static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
nvrc_enable(gl_info, enable);
if (enable)
{
glEnable(GL_TEXTURE_SHADER_NV);
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
}
else
{
glDisable(GL_TEXTURE_SHADER_NV);
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_SHADER_NV);
checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -325,20 +325,20 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
ENTER_GL();
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, location);
glReadBuffer(GL_COLOR_ATTACHMENT0);
gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
context_set_draw_buffer(context, GL_BACK);
context_invalidate_state(context, STATE_FRAMEBUFFER);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE));
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1));
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2));
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3));
glDisable(GL_SCISSOR_TEST);
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE));
/* Note that the texture is upside down */
......@@ -377,8 +377,8 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
/* Set up the texture. The surface is not in a wined3d_texture
* container, so there are no D3D texture settings to dirtify. */
device->blitter->set_shader(device->blit_priv, context2, backbuffer);
glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MIN_FILTER, gl_filter);
glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MAG_FILTER, gl_filter);
gl_info->gl_ops.gl.p_glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MIN_FILTER, gl_filter);
gl_info->gl_ops.gl.p_glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MAG_FILTER, gl_filter);
context_set_draw_buffer(context, GL_BACK);
......@@ -390,32 +390,33 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
*
* Note that context_apply_blit_state() set up viewport and ortho to
* match the surface size - we want the GL drawable(=window) size. */
glPushAttrib(GL_VIEWPORT_BIT);
glViewport(dst_rect->left, win_h - dst_rect->bottom, dst_rect->right, win_h - dst_rect->top);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glBegin(GL_QUADS);
gl_info->gl_ops.gl.p_glPushAttrib(GL_VIEWPORT_BIT);
gl_info->gl_ops.gl.p_glViewport(dst_rect->left, win_h - dst_rect->bottom,
dst_rect->right, win_h - dst_rect->top);
gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
gl_info->gl_ops.gl.p_glPushMatrix();
gl_info->gl_ops.gl.p_glLoadIdentity();
gl_info->gl_ops.gl.p_glBegin(GL_QUADS);
/* bottom left */
glTexCoord2f(tex_left, tex_bottom);
glVertex2i(-1, -1);
gl_info->gl_ops.gl.p_glTexCoord2f(tex_left, tex_bottom);
gl_info->gl_ops.gl.p_glVertex2i(-1, -1);
/* top left */
glTexCoord2f(tex_left, tex_top);
glVertex2i(-1, 1);
gl_info->gl_ops.gl.p_glTexCoord2f(tex_left, tex_top);
gl_info->gl_ops.gl.p_glVertex2i(-1, 1);
/* top right */
glTexCoord2f(tex_right, tex_top);
glVertex2i(1, 1);
gl_info->gl_ops.gl.p_glTexCoord2f(tex_right, tex_top);
gl_info->gl_ops.gl.p_glVertex2i(1, 1);
/* bottom right */
glTexCoord2f(tex_right, tex_bottom);
glVertex2i(1, -1);
glEnd();
gl_info->gl_ops.gl.p_glTexCoord2f(tex_right, tex_bottom);
gl_info->gl_ops.gl.p_glVertex2i(1, -1);
gl_info->gl_ops.gl.p_glEnd();
glPopMatrix();
glPopAttrib();
gl_info->gl_ops.gl.p_glPopMatrix();
gl_info->gl_ops.gl.p_glPopAttrib();
device->blitter->unset_shader(context->gl_info);
checkGLcall("Swapchain present blit(manual)\n");
......@@ -564,7 +565,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
}
if (swapchain->num_contexts > 1)
glFinish();
gl_info->gl_ops.gl.p_glFinish();
SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */
TRACE("SwapBuffers called, Starting new frame\n");
......
......@@ -834,14 +834,14 @@ extern int num_lock DECLSPEC_HIDDEN;
do { \
GLint err; \
if (!__WINE_IS_DEBUG_ON(_ERR, __wine_dbch___default)) break; \
err = glGetError(); \
err = gl_info->gl_ops.gl.p_glGetError(); \
if (err == GL_NO_ERROR) { \
TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
\
} else do { \
ERR(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n", \
debug_glerror(err), err, A, __FILE__, __LINE__); \
err = glGetError(); \
err = gl_info->gl_ops.gl.p_glGetError(); \
} while (err != GL_NO_ERROR); \
} while(0)
#else
......@@ -2498,8 +2498,9 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage,
void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
BOOL is_alpha, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3,
INT texture_idx, DWORD dst) DECLSPEC_HIDDEN;
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords,
BOOL transformed, enum wined3d_format_id coordtype, BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN;
void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags,
BOOL calculatedCoords, BOOL transformed, enum wined3d_format_id coordtype,
BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN;
void texture_activate_dimensions(const struct wined3d_texture *texture,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
void sampler_texdim(struct wined3d_context *context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment