wined3d: Remove d3d8/9 palette support.
This commit is contained in:
parent
4365d2905c
commit
496b438ede
|
@ -5387,7 +5387,7 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
|||
ddraw->orig_width = GetSystemMetrics(SM_CXSCREEN);
|
||||
ddraw->orig_height = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
ddraw->wineD3D = wined3d_create(7, WINED3D_PALETTE_PER_SURFACE | WINED3D_LEGACY_DEPTH_BIAS,
|
||||
ddraw->wineD3D = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS,
|
||||
&ddraw->IDirectDraw7_iface);
|
||||
if (!ddraw->wineD3D)
|
||||
{
|
||||
|
|
|
@ -1231,32 +1231,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
|
|||
device->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(*device->fb.render_targets) * gl_info->limits.buffers);
|
||||
|
||||
device->palette_count = 1;
|
||||
device->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*));
|
||||
if (!device->palettes || !device->fb.render_targets)
|
||||
{
|
||||
ERR("Out of memory!\n");
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
device->palettes[0] = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256);
|
||||
if (!device->palettes[0])
|
||||
{
|
||||
ERR("Out of memory!\n");
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
device->palettes[0][i].peRed = 0xff;
|
||||
device->palettes[0][i].peGreen = 0xff;
|
||||
device->palettes[0][i].peBlue = 0xff;
|
||||
device->palettes[0][i].peFlags = 0xff;
|
||||
}
|
||||
device->currentPalette = 0;
|
||||
|
||||
/* Initialize the texture unit mapping to a 1:1 mapping */
|
||||
for (state = 0; state < MAX_COMBINED_SAMPLERS; ++state)
|
||||
{
|
||||
|
@ -1385,12 +1359,6 @@ err_out:
|
|||
HeapFree(GetProcessHeap(), 0, device->fb.render_targets);
|
||||
HeapFree(GetProcessHeap(), 0, device->swapchains);
|
||||
device->swapchain_count = 0;
|
||||
if (device->palettes)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, device->palettes[0]);
|
||||
HeapFree(GetProcessHeap(), 0, device->palettes);
|
||||
}
|
||||
device->palette_count = 0;
|
||||
if (swapchain)
|
||||
wined3d_swapchain_decref(swapchain);
|
||||
if (device->stateBlock)
|
||||
|
@ -1579,12 +1547,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
|
|||
device->swapchains = NULL;
|
||||
device->swapchain_count = 0;
|
||||
|
||||
for (i = 0; i < device->palette_count; ++i)
|
||||
HeapFree(GetProcessHeap(), 0, device->palettes[i]);
|
||||
HeapFree(GetProcessHeap(), 0, device->palettes);
|
||||
device->palettes = NULL;
|
||||
device->palette_count = 0;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, device->fb.render_targets);
|
||||
device->fb.render_targets = NULL;
|
||||
|
||||
|
@ -4574,135 +4536,6 @@ HRESULT CDECL wined3d_device_validate_device(struct wined3d_device *device, DWOR
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static void dirtify_p8_texture_samplers(struct wined3d_device *device)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
|
||||
{
|
||||
struct wined3d_texture *texture = device->stateBlock->state.textures[i];
|
||||
if (texture && (texture->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| texture->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM))
|
||||
device_invalidate_state(device, STATE_SAMPLER(i));
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_set_palette_entries(struct wined3d_device *device,
|
||||
UINT palette_idx, const PALETTEENTRY *entries)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
TRACE("device %p, palette_idx %u, entries %p.\n", device, palette_idx, entries);
|
||||
|
||||
if (palette_idx >= MAX_PALETTES)
|
||||
{
|
||||
WARN("Invalid palette index %u.\n", palette_idx);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (palette_idx >= device->palette_count)
|
||||
{
|
||||
UINT new_size = device->palette_count;
|
||||
PALETTEENTRY **palettes;
|
||||
|
||||
do
|
||||
{
|
||||
new_size *= 2;
|
||||
} while (palette_idx >= new_size);
|
||||
palettes = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, device->palettes, sizeof(*palettes) * new_size);
|
||||
if (!palettes)
|
||||
{
|
||||
ERR("Out of memory!\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
device->palettes = palettes;
|
||||
device->palette_count = new_size;
|
||||
}
|
||||
|
||||
if (!device->palettes[palette_idx])
|
||||
{
|
||||
device->palettes[palette_idx] = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256);
|
||||
if (!device->palettes[palette_idx])
|
||||
{
|
||||
ERR("Out of memory!\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
device->palettes[palette_idx][i].peRed = entries[i].peRed;
|
||||
device->palettes[palette_idx][i].peGreen = entries[i].peGreen;
|
||||
device->palettes[palette_idx][i].peBlue = entries[i].peBlue;
|
||||
device->palettes[palette_idx][i].peFlags = entries[i].peFlags;
|
||||
}
|
||||
|
||||
if (palette_idx == device->currentPalette)
|
||||
dirtify_p8_texture_samplers(device);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_get_palette_entries(struct wined3d_device *device,
|
||||
UINT palette_idx, PALETTEENTRY *entries)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
TRACE("device %p, palette_idx %u, entries %p.\n", device, palette_idx, entries);
|
||||
|
||||
if (palette_idx >= device->palette_count || !device->palettes[palette_idx])
|
||||
{
|
||||
/* What happens in such situation isn't documented; Native seems to
|
||||
* silently abort on such conditions. */
|
||||
WARN("Invalid palette index %u.\n", palette_idx);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
entries[i].peRed = device->palettes[palette_idx][i].peRed;
|
||||
entries[i].peGreen = device->palettes[palette_idx][i].peGreen;
|
||||
entries[i].peBlue = device->palettes[palette_idx][i].peBlue;
|
||||
entries[i].peFlags = device->palettes[palette_idx][i].peFlags;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_set_current_texture_palette(struct wined3d_device *device, UINT palette_idx)
|
||||
{
|
||||
TRACE("device %p, palette_idx %u.\n", device, palette_idx);
|
||||
|
||||
/* Native appears to silently abort on attempt to make an uninitialized
|
||||
* palette current and render. (tested with reference rasterizer). */
|
||||
if (palette_idx >= device->palette_count || !device->palettes[palette_idx])
|
||||
{
|
||||
WARN("Invalid palette index %u.\n", palette_idx);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* TODO: stateblocks? */
|
||||
if (device->currentPalette != palette_idx)
|
||||
{
|
||||
device->currentPalette = palette_idx;
|
||||
dirtify_p8_texture_samplers(device);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_get_current_texture_palette(struct wined3d_device *device, UINT *palette_idx)
|
||||
{
|
||||
TRACE("device %p, palette_idx %p.\n", device, palette_idx);
|
||||
|
||||
if (!palette_idx)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
*palette_idx = device->currentPalette;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software)
|
||||
{
|
||||
static BOOL warned;
|
||||
|
|
|
@ -3869,19 +3869,6 @@ void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB
|
|||
/* TODO: Use already acquired context when possible. */
|
||||
context = context_acquire(device, NULL);
|
||||
|
||||
if (surface->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
{
|
||||
if (palette9_changed(surface))
|
||||
{
|
||||
TRACE("Reloading surface because the d3d8/9 palette was changed\n");
|
||||
/* TODO: This is not necessarily needed with hw palettized texture support */
|
||||
surface_load_location(surface, SFLAG_INSYSMEM, NULL);
|
||||
/* Make sure the texture is reloaded because of the palette change, this kills performance though :( */
|
||||
surface_modify_location(surface, SFLAG_INTEXTURE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
surface_load(surface, srgb == SRGB_SRGB ? TRUE : FALSE);
|
||||
|
||||
if (surface->resource.pool == WINED3DPOOL_DEFAULT)
|
||||
|
@ -4493,29 +4480,12 @@ void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[25
|
|||
|
||||
if (!pal)
|
||||
{
|
||||
/* In DirectDraw the palette is a property of the surface, there are no such things as device palettes. */
|
||||
if (device->wined3d->flags & WINED3D_PALETTE_PER_SURFACE)
|
||||
ERR("This code should never get entered for DirectDraw!, expect problems\n");
|
||||
if (index_in_alpha)
|
||||
{
|
||||
ERR("This code should never get entered for DirectDraw!, expect problems\n");
|
||||
if (index_in_alpha)
|
||||
{
|
||||
/* Guarantees that memory representation remains correct after sysmem<->texture transfers even if
|
||||
* there's no palette at this time. */
|
||||
for (i = 0; i < 256; i++) table[i][3] = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Direct3D >= 8 palette usage style: P8 textures use device palettes, palette entry format is A8R8G8B8,
|
||||
* alpha is stored in peFlags and may be used by the app if D3DPTEXTURECAPS_ALPHAPALETTE device
|
||||
* capability flag is present (wine does advertise this capability) */
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
table[i][0] = device->palettes[device->currentPalette][i].peRed;
|
||||
table[i][1] = device->palettes[device->currentPalette][i].peGreen;
|
||||
table[i][2] = device->palettes[device->currentPalette][i].peBlue;
|
||||
table[i][3] = device->palettes[device->currentPalette][i].peFlags;
|
||||
}
|
||||
/* Guarantees that memory representation remains correct after sysmem<->texture transfers even if
|
||||
* there's no palette at this time. */
|
||||
for (i = 0; i < 256; i++) table[i][3] = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4699,35 +4669,6 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
BOOL palette9_changed(struct wined3d_surface *surface)
|
||||
{
|
||||
struct wined3d_device *device = surface->resource.device;
|
||||
|
||||
if (surface->palette || (surface->resource.format->id != WINED3DFMT_P8_UINT
|
||||
&& surface->resource.format->id != WINED3DFMT_P8_UINT_A8_UNORM))
|
||||
{
|
||||
/* If a ddraw-style palette is attached assume no d3d9 palette change.
|
||||
* Also the palette isn't interesting if the surface format isn't P8 or A8P8
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (surface->palette9)
|
||||
{
|
||||
if (!memcmp(surface->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->palette9 = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256);
|
||||
}
|
||||
memcpy(surface->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
|
||||
{
|
||||
/* Flip the surface contents */
|
||||
|
|
|
@ -683,25 +683,6 @@ static void texture2d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
|
|||
context = context_acquire(device, NULL);
|
||||
}
|
||||
|
||||
if (texture->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| texture->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
{
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]);
|
||||
|
||||
if (palette9_changed(surface))
|
||||
{
|
||||
TRACE("Reloading surface %p because the d3d8/9 palette was changed.\n", surface);
|
||||
/* TODO: This is not necessarily needed with hw palettized texture support. */
|
||||
surface_load_location(surface, SFLAG_INSYSMEM, NULL);
|
||||
/* Make sure the texture is reloaded because of the palette
|
||||
* change, this kills performance though :( */
|
||||
surface_modify_location(surface, SFLAG_INTEXTURE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_tex->dirty)
|
||||
{
|
||||
/* Reload the surfaces if the texture is marked dirty. */
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
@ cdecl wined3d_device_get_clip_plane(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_clip_status(ptr ptr)
|
||||
@ cdecl wined3d_device_get_creation_parameters(ptr ptr)
|
||||
@ cdecl wined3d_device_get_current_texture_palette(ptr ptr)
|
||||
@ cdecl wined3d_device_get_depth_stencil(ptr ptr)
|
||||
@ cdecl wined3d_device_get_device_caps(ptr ptr)
|
||||
@ cdecl wined3d_device_get_display_mode(ptr long ptr)
|
||||
|
@ -78,7 +77,6 @@
|
|||
@ cdecl wined3d_device_get_light_enable(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_material(ptr ptr)
|
||||
@ cdecl wined3d_device_get_npatch_mode(ptr)
|
||||
@ cdecl wined3d_device_get_palette_entries(ptr long ptr)
|
||||
@ cdecl wined3d_device_get_pixel_shader(ptr)
|
||||
@ cdecl wined3d_device_get_primitive_type(ptr ptr)
|
||||
@ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long)
|
||||
|
@ -117,7 +115,6 @@
|
|||
@ cdecl wined3d_device_set_base_vertex_index(ptr long)
|
||||
@ cdecl wined3d_device_set_clip_plane(ptr long ptr)
|
||||
@ cdecl wined3d_device_set_clip_status(ptr ptr)
|
||||
@ cdecl wined3d_device_set_current_texture_palette(ptr long)
|
||||
@ cdecl wined3d_device_set_cursor_position(ptr long long long)
|
||||
@ cdecl wined3d_device_set_cursor_properties(ptr long long ptr)
|
||||
@ cdecl wined3d_device_set_depth_stencil(ptr ptr)
|
||||
|
@ -130,7 +127,6 @@
|
|||
@ cdecl wined3d_device_set_material(ptr ptr)
|
||||
@ cdecl wined3d_device_set_multithreaded(ptr)
|
||||
@ cdecl wined3d_device_set_npatch_mode(ptr float)
|
||||
@ cdecl wined3d_device_set_palette_entries(ptr long ptr)
|
||||
@ cdecl wined3d_device_set_pixel_shader(ptr ptr)
|
||||
@ cdecl wined3d_device_set_primitive_type(ptr long)
|
||||
@ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long)
|
||||
|
|
|
@ -1712,11 +1712,6 @@ struct wined3d_device
|
|||
struct wined3d_surface *onscreen_depth_stencil;
|
||||
struct wined3d_surface *auto_depth_stencil;
|
||||
|
||||
/* palettes texture management */
|
||||
PALETTEENTRY **palettes;
|
||||
UINT palette_count;
|
||||
UINT currentPalette;
|
||||
|
||||
/* For rendering to a texture using glCopyTexImage */
|
||||
GLuint depth_blt_texture;
|
||||
|
||||
|
@ -2180,8 +2175,6 @@ HRESULT d3dfmt_get_conv(const struct wined3d_surface *surface, BOOL need_alpha_c
|
|||
struct wined3d_format *format, CONVERT_TYPES *convert) DECLSPEC_HIDDEN;
|
||||
void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL palette9_changed(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_vertex_declaration_element
|
||||
{
|
||||
const struct wined3d_format *format;
|
||||
|
|
|
@ -1234,8 +1234,7 @@ enum wined3d_sysval_semantic
|
|||
#define WINED3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000
|
||||
#define WINED3DDEVCAPS_NPATCHES 0x01000000
|
||||
|
||||
#define WINED3D_PALETTE_PER_SURFACE 0x00000001
|
||||
#define WINED3D_LEGACY_DEPTH_BIAS 0x00000002
|
||||
#define WINED3D_LEGACY_DEPTH_BIAS 0x00000001
|
||||
|
||||
/* dwDDFX */
|
||||
/* arithmetic stretching along y axis */
|
||||
|
@ -2212,7 +2211,6 @@ HRESULT __cdecl wined3d_device_get_clip_plane(const struct wined3d_device *devic
|
|||
HRESULT __cdecl wined3d_device_get_clip_status(const struct wined3d_device *device, WINED3DCLIPSTATUS *clip_status);
|
||||
HRESULT __cdecl wined3d_device_get_creation_parameters(struct wined3d_device *device,
|
||||
WINED3DDEVICE_CREATION_PARAMETERS *creation_parameters);
|
||||
HRESULT __cdecl wined3d_device_get_current_texture_palette(struct wined3d_device *device, UINT *palette_idx);
|
||||
HRESULT __cdecl wined3d_device_get_depth_stencil(struct wined3d_device *device,
|
||||
struct wined3d_surface **depth_stencil);
|
||||
HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps);
|
||||
|
@ -2227,8 +2225,6 @@ HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device, UI
|
|||
HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable);
|
||||
HRESULT __cdecl wined3d_device_get_material(const struct wined3d_device *device, WINED3DMATERIAL *material);
|
||||
float __cdecl wined3d_device_get_npatch_mode(struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_get_palette_entries(struct wined3d_device *device,
|
||||
UINT palette_idx, PALETTEENTRY *entries);
|
||||
struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device);
|
||||
void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device,
|
||||
WINED3DPRIMITIVETYPE *primitive_topology);
|
||||
|
@ -2291,7 +2287,6 @@ void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *dev
|
|||
HRESULT __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index);
|
||||
HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const float *plane);
|
||||
HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device, const WINED3DCLIPSTATUS *clip_status);
|
||||
HRESULT __cdecl wined3d_device_set_current_texture_palette(struct wined3d_device *device, UINT palette_idx);
|
||||
void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device,
|
||||
int x_screen_space, int y_screen_space, DWORD flags);
|
||||
HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device,
|
||||
|
@ -2309,8 +2304,6 @@ HRESULT __cdecl wined3d_device_set_light_enable(struct wined3d_device *device, U
|
|||
HRESULT __cdecl wined3d_device_set_material(struct wined3d_device *device, const WINED3DMATERIAL *material);
|
||||
void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments);
|
||||
HRESULT __cdecl wined3d_device_set_palette_entries(struct wined3d_device *device,
|
||||
UINT palette_idx, const PALETTEENTRY *entries);
|
||||
HRESULT __cdecl wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader);
|
||||
void __cdecl wined3d_device_set_primitive_type(struct wined3d_device *device, WINED3DPRIMITIVETYPE primitive_topology);
|
||||
HRESULT __cdecl wined3d_device_set_ps_consts_b(struct wined3d_device *device,
|
||||
|
|
Loading…
Reference in New Issue