{
const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog;
- UINT rt_height = state->fb->render_targets[0]->resource.height;
+ UINT rt_height = state->fb->render_targets[0]->height;
/* Load DirectX 9 float constants for pixel shader */
priv->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
GLuint program_id = 0;
GLint pos;
- const char *blt_vprogram =
+ static const char blt_vprogram[] =
"!!ARBvp1.0\n"
"PARAM c[1] = { { 1, 0.5 } };\n"
"MOV result.position, vertex.position;\n"
}
else
{
- UINT rt_height = state->fb->render_targets[0]->resource.height;
+ UINT rt_height = state->fb->render_targets[0]->height;
shader_arb_ps_local_constants(compiled, context, state, rt_height);
}
/* WINED3DSIH_DEFB */ shader_hw_nop,
/* WINED3DSIH_DEFI */ shader_hw_nop,
/* WINED3DSIH_DIV */ NULL,
+ /* WINED3DSIH_DP2 */ NULL,
/* WINED3DSIH_DP2ADD */ pshader_hw_dp2add,
/* WINED3DSIH_DP3 */ shader_hw_map2gl,
/* WINED3DSIH_DP4 */ shader_hw_map2gl,
/* WINED3DSIH_IFC */ shader_hw_ifc,
/* WINED3DSIH_IGE */ NULL,
/* WINED3DSIH_IMUL */ NULL,
+ /* WINED3DSIH_ISHL */ NULL,
/* WINED3DSIH_ITOF */ NULL,
/* WINED3DSIH_LABEL */ shader_hw_label,
/* WINED3DSIH_LD */ NULL,
HeapFree(GetProcessHeap(), 0, entry_arb);
}
-const struct wine_rb_functions wined3d_arbfp_blit_rb_functions =
+static const struct wine_rb_functions wined3d_arbfp_blit_rb_functions =
{
wined3d_rb_alloc,
wined3d_rb_realloc,
}
/* Context activation is done by the caller. */
-static void upload_palette(const struct wined3d_surface *surface, struct wined3d_context *context)
+static void upload_palette(const struct wined3d_texture *texture, struct wined3d_context *context)
{
- BYTE table[256][4];
- struct wined3d_device *device = surface->resource.device;
+ const struct wined3d_palette *palette = texture->swapchain ? texture->swapchain->palette : NULL;
+ struct wined3d_device *device = texture->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct arbfp_blit_priv *priv = device->blit_priv;
- BOOL colorkey = !!(surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
-
- d3dfmt_p8_init_palette(surface, table, colorkey);
if (!priv->palette_texture)
gl_info->gl_ops.gl.p_glGenTextures(1, &priv->palette_texture);
/* Make sure we have discrete color levels. */
gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- /* Upload the palette */
/* TODO: avoid unneeded uploads in the future by adding some SFLAG_PALETTE_DIRTY mechanism */
- gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, table);
+ if (palette)
+ {
+ gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 256, 0, GL_BGRA,
+ GL_UNSIGNED_INT_8_8_8_8_REV, palette->colors);
+ }
+ else
+ {
+ static const DWORD black;
+ FIXME("P8 surface loaded without a palette.\n");
+ gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 1, 0, GL_BGRA,
+ GL_UNSIGNED_INT_8_8_8_8_REV, &black);
+ }
/* Switch back to unit 0 in which the 2D texture will be stored. */
context_active_texture(context, gl_info, 0);
}
if (fixup == COMPLEX_FIXUP_P8)
- upload_palette(surface, context);
+ upload_palette(surface->container, context);
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& (src_surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE))
== WINED3D_LOCATION_DRAWABLE
- && !surface_is_offscreen(src_surface))
+ && !wined3d_resource_is_offscreen(&src_surface->container->resource))
{
/* Without FBO blits transferring from the drawable to the texture is
* expensive, because we have to flip the data in sysmem. Since we can
context_apply_blit_state(context, device);
- if (!surface_is_offscreen(dst_surface))
+ if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
arbfp_blit_set(device->blit_priv, context, src_surface);
arbfp_blit_unset(context->gl_info);
if (wined3d_settings.strict_draw_ordering
- || (dst_surface->swapchain && (dst_surface->swapchain->front_buffer == dst_surface)))
+ || (dst_surface->container->swapchain
+ && (dst_surface->container->swapchain->front_buffer == dst_surface->container)))
context->gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
- surface_validate_location(dst_surface, dst_surface->draw_binding);
- surface_invalidate_location(dst_surface, ~dst_surface->draw_binding);
+ surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding);
+ surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding);
return WINED3D_OK;
}