Commit b233e7b3 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Rename the "format" field in wined3d_format_desc to "id".

parent 42b814c7
......@@ -245,7 +245,7 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This,
if (!attrib->stride)
{
FIXME("%s used with stride 0, let's hope we get the vertex stride from somewhere else\n",
debug_d3dformat(attrib->format_desc->format));
debug_d3dformat(attrib->format_desc->id));
}
else if(attrib->stride != *stride_this_run && *stride_this_run)
{
......@@ -302,7 +302,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
|| attrib->buffer_object != This->buffer_object)
return FALSE;
format = attrib->format_desc->format;
format = attrib->format_desc->id;
/* Look for newly appeared conversion */
if (!gl_info->supported[ARB_HALF_FLOAT_VERTEX]
&& (format == WINED3DFMT_R16G16_FLOAT || format == WINED3DFMT_R16G16B16A16_FLOAT))
......@@ -350,7 +350,7 @@ static UINT *find_conversion_shift(struct wined3d_buffer *This,
if (!(strided->use_map & (1 << i)) || strided->elements[i].buffer_object != This->buffer_object) continue;
format = strided->elements[i].format_desc->format;
format = strided->elements[i].format_desc->id;
if (format == WINED3DFMT_R16G16_FLOAT)
{
shift = 4;
......@@ -1473,7 +1473,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
buffer->buffer_type_hint = bind_hint;
TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage,
debug_d3dformat(buffer->resource.format_desc->format), buffer->resource.allocatedMemory, buffer);
debug_d3dformat(buffer->resource.format_desc->id), buffer->resource.allocatedMemory, buffer);
/* GL_ARB_map_buffer_range is disabled for now due to numerous bugs and no gains */
dynamic_buffer_ok = gl_info->supported[APPLE_FLUSH_BUFFER_RANGE];
......
......@@ -333,7 +333,7 @@ static void context_check_fbo_status(struct wined3d_context *context, GLenum tar
if (attachment)
{
FIXME("\tColor attachment %d: (%p) %s %ux%u\n",
i, attachment, debug_d3dformat(attachment->resource.format_desc->format),
i, attachment, debug_d3dformat(attachment->resource.format_desc->id),
attachment->pow2Width, attachment->pow2Height);
}
}
......@@ -341,7 +341,7 @@ static void context_check_fbo_status(struct wined3d_context *context, GLenum tar
if (attachment)
{
FIXME("\tDepth attachment: (%p) %s %ux%u\n",
attachment, debug_d3dformat(attachment->resource.format_desc->format),
attachment, debug_d3dformat(attachment->resource.format_desc->id),
attachment->pow2Width, attachment->pow2Height);
}
}
......@@ -1141,13 +1141,13 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
int nCfgs = This->adapter->nCfgs;
TRACE("ColorFormat=%s, DepthStencilFormat=%s, auxBuffers=%d, numSamples=%d, findCompatible=%d\n",
debug_d3dformat(color_format_desc->format), debug_d3dformat(ds_format_desc->format),
debug_d3dformat(color_format_desc->id), debug_d3dformat(ds_format_desc->id),
auxBuffers, numSamples, findCompatible);
if (!getColorBits(color_format_desc, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits))
{
ERR("Unable to get color bits for format %s (%#x)!\n",
debug_d3dformat(color_format_desc->format), color_format_desc->format);
debug_d3dformat(color_format_desc->id), color_format_desc->id);
return 0;
}
......@@ -1260,7 +1260,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
}
TRACE("Found iPixelFormat=%d for ColorFormat=%s, DepthStencilFormat=%s\n",
iPixelFormat, debug_d3dformat(color_format_desc->format), debug_d3dformat(ds_format_desc->format));
iPixelFormat, debug_d3dformat(color_format_desc->id), debug_d3dformat(ds_format_desc->id));
return iPixelFormat;
}
......@@ -1315,9 +1315,9 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
{
auxBuffers = TRUE;
if (color_format_desc->format == WINED3DFMT_B4G4R4X4_UNORM)
if (color_format_desc->id == WINED3DFMT_B4G4R4X4_UNORM)
color_format_desc = getFormatDescEntry(WINED3DFMT_B4G4R4A4_UNORM, gl_info);
else if (color_format_desc->format == WINED3DFMT_B8G8R8X8_UNORM)
else if (color_format_desc->id == WINED3DFMT_B8G8R8X8_UNORM)
color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
}
......@@ -1327,7 +1327,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
* conversion (ab)uses the alpha component for storing the palette index.
* For this reason we require a format with 8bit alpha, so request
* A8R8G8B8. */
if (color_format_desc->format == WINED3DFMT_P8_UINT)
if (color_format_desc->id == WINED3DFMT_P8_UINT)
color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
/* D3D only allows multisampling when SwapEffect is set to WINED3DSWAPEFFECT_DISCARD. */
......@@ -2296,7 +2296,7 @@ static void context_setup_target(IWineD3DDeviceImpl *device,
const struct wined3d_format_desc *old = context->current_rt->resource.format_desc;
const struct wined3d_format_desc *new = target->resource.format_desc;
if (old->format != new->format)
if (old->id != new->id)
{
/* Disable blending when the alpha mask has changed and when a format doesn't support blending. */
if ((old->alpha_mask && !new->alpha_mask) || (!old->alpha_mask && new->alpha_mask)
......
......@@ -70,8 +70,8 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
context = context_acquire(device, NULL);
}
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
|| This->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
for (i = 0; i < sub_count; ++i)
{
......
......@@ -274,7 +274,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
if (!element->ffp_valid)
{
WARN("Skipping unsupported fixed function element of format %s and usage %s\n",
debug_d3dformat(element->format_desc->format), debug_d3ddeclusage(element->usage));
debug_d3dformat(element->format_desc->id), debug_d3ddeclusage(element->usage));
stride_used = FALSE;
}
else
......@@ -289,7 +289,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
"input_slot %u, offset %u, stride %u, format %s, buffer_object %u]\n",
use_vshader ? "shader": "fixed function", idx,
debug_d3ddeclusage(element->usage), element->usage_idx, element->input_slot,
element->offset, stride, debug_d3dformat(element->format_desc->format), buffer_object);
element->offset, stride, debug_d3dformat(element->format_desc->id), buffer_object);
stream_info->elements[idx].format_desc = element->format_desc;
stream_info->elements[idx].stride = stride;
......@@ -298,7 +298,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
stream_info->elements[idx].buffer_object = buffer_object;
if (!This->adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA]
&& element->format_desc->format == WINED3DFMT_B8G8R8A8_UNORM)
&& element->format_desc->id == WINED3DFMT_B8G8R8A8_UNORM)
{
stream_info->swizzle_map |= 1 << idx;
}
......@@ -381,7 +381,7 @@ static void device_stream_info_from_strided(const struct wined3d_gl_info *gl_inf
if (!stream_info->elements[i].format_desc) continue;
if (!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
&& stream_info->elements[i].format_desc->format == WINED3DFMT_B8G8R8A8_UNORM)
&& stream_info->elements[i].format_desc->id == WINED3DFMT_B8G8R8A8_UNORM)
{
stream_info->swizzle_map |= 1 << i;
}
......@@ -5055,8 +5055,8 @@ static void dirtify_p8_texture_samplers(IWineD3DDeviceImpl *device)
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl*)device->stateBlock->textures[i];
if (texture && (texture->resource.format_desc->format == WINED3DFMT_P8_UINT
|| texture->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM))
if (texture && (texture->resource.format_desc->id == WINED3DFMT_P8_UINT
|| texture->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM))
{
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(i));
}
......@@ -5268,7 +5268,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
src_format = src_impl->resource.format_desc;
dst_format = dst_impl->resource.format_desc;
if (src_format->format != dst_format->format)
if (src_format->id != dst_format->id)
{
WARN("Source and destination surfaces should have the same format.\n");
return WINED3DERR_INVALIDCALL;
......@@ -5670,7 +5670,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetFrontBackBuffers(IWineD3DDevice *ifa
{
swapchain->presentParms.BackBufferWidth = back_impl->currentDesc.Width;
swapchain->presentParms.BackBufferHeight = back_impl->currentDesc.Height;
swapchain->presentParms.BackBufferFormat = back_impl->resource.format_desc->format;
swapchain->presentParms.BackBufferFormat = back_impl->resource.format_desc->id;
swapchain->presentParms.BackBufferCount = 1;
surface_set_container(back_impl, WINED3D_CONTAINER_SWAPCHAIN, (IWineD3DBase *)swapchain);
......@@ -5842,7 +5842,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
WINED3DLOCKED_RECT rect;
/* MSDN: Cursor must be A8R8G8B8 */
if (s->resource.format_desc->format != WINED3DFMT_B8G8R8A8_UNORM)
if (s->resource.format_desc->id != WINED3DFMT_B8G8R8A8_UNORM)
{
WARN("surface %p has an invalid format.\n", cursor_image);
return WINED3DERR_INVALIDCALL;
......
......@@ -2999,7 +2999,7 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined
if(cfg->iPixelType == WGL_TYPE_RGBA_ARB) { /* Integer RGBA formats */
if (!getColorBits(format_desc, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
{
ERR("Unable to check compatibility for Format=%s\n", debug_d3dformat(format_desc->format));
ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format_desc->id));
return FALSE;
}
......@@ -3033,14 +3033,14 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3
if (!getDepthStencilBits(format_desc, &depthSize, &stencilSize))
{
ERR("Unable to check compatibility for Format=%s\n", debug_d3dformat(format_desc->format));
ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format_desc->id));
return FALSE;
}
/* Float formats need FBOs. If FBOs are used this function isn't called */
if (format_desc->Flags & WINED3DFMT_FLAG_FLOAT) return FALSE;
if ((format_desc->format == WINED3DFMT_D16_LOCKABLE) || (format_desc->format == WINED3DFMT_D32_FLOAT))
if ((format_desc->id == WINED3DFMT_D16_LOCKABLE) || (format_desc->id == WINED3DFMT_D32_FLOAT))
lockable = TRUE;
/* On some modern cards like the Geforce8/9 GLX doesn't offer some dephthstencil formats which D3D9 reports.
......@@ -3375,8 +3375,8 @@ static BOOL CheckRenderTargetCapability(struct wined3d_adapter *adapter,
if (cfgs[it].windowDrawable && IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info,
&cfgs[it], check_format_desc))
{
TRACE_(d3d_caps)("iPixelFormat=%d is compatible with CheckFormat=%s\n",
cfgs[it].iPixelFormat, debug_d3dformat(check_format_desc->format));
TRACE_(d3d_caps)("Pixel format %d is compatible with format %s.\n",
cfgs[it].iPixelFormat, debug_d3dformat(check_format_desc->id));
return TRUE;
}
}
......@@ -3413,7 +3413,7 @@ static BOOL CheckSrgbWriteCapability(struct wined3d_adapter *adapter, const stru
}
}
TRACE_(d3d_caps)("[FAILED] - no SRGB writing support on format=%s\n", debug_d3dformat(format_desc->format));
TRACE_(d3d_caps)("[FAILED] - sRGB writes not supported by format %s.\n", debug_d3dformat(format_desc->id));
return FALSE;
}
......@@ -3446,7 +3446,7 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct
{
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
switch (format_desc->format)
switch (format_desc->id)
{
/*****
* supported: RGB(A) formats
......@@ -3666,7 +3666,7 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct
return FALSE;
default:
ERR("Unhandled format=%s\n", debug_d3dformat(format_desc->format));
ERR("Unhandled format %s.\n", debug_d3dformat(format_desc->id));
break;
}
return FALSE;
......@@ -3677,8 +3677,9 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter,
const struct wined3d_format_desc *check_format_desc,
WINED3DSURFTYPE SurfaceType)
{
if(SurfaceType == SURFACE_GDI) {
switch(check_format_desc->format)
if (SurfaceType == SURFACE_GDI)
{
switch (check_format_desc->id)
{
case WINED3DFMT_B8G8R8_UNORM:
case WINED3DFMT_B8G8R8A8_UNORM:
......
......@@ -125,8 +125,8 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
element = &si->elements[WINED3D_FFP_DIFFUSE];
diffuse = element->data + streamOffset[element->stream_idx];
if (num_untracked_materials && element->format_desc->format != WINED3DFMT_B8G8R8A8_UNORM)
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format_desc->format));
if (num_untracked_materials && element->format_desc->id != WINED3DFMT_B8G8R8A8_UNORM)
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format_desc->id));
}
else
{
......@@ -141,13 +141,13 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
/* special case where the fog density is stored in the specular alpha channel */
if (This->stateBlock->renderState[WINED3DRS_FOGENABLE]
&& (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE
|| si->elements[WINED3D_FFP_POSITION].format_desc->format == WINED3DFMT_R32G32B32A32_FLOAT)
|| si->elements[WINED3D_FFP_POSITION].format_desc->id == WINED3DFMT_R32G32B32A32_FLOAT)
&& This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
{
if (gl_info->supported[EXT_FOG_COORD])
{
if (element->format_desc->format == WINED3DFMT_B8G8R8A8_UNORM) specular_fog = TRUE;
else FIXME("Implement fog coordinates from %s\n", debug_d3dformat(element->format_desc->format));
if (element->format_desc->id == WINED3DFMT_B8G8R8A8_UNORM) specular_fog = TRUE;
else FIXME("Implement fog coordinates from %s\n", debug_d3dformat(element->format_desc->id));
}
else
{
......@@ -468,7 +468,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream
si->elements[i].stride * SkipnStrides +
stateblock->streamOffset[si->elements[i].stream_idx];
send_attribute(This, si->elements[i].format_desc->format, i, ptr);
send_attribute(This, si->elements[i].format_desc->id, i, ptr);
}
SkipnStrides++;
}
......@@ -539,7 +539,7 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine
ptr += (ULONG_PTR)buffer_get_sysmem(vb, &This->adapter->gl_info);
}
send_attribute(This, si->elements[instancedData[j]].format_desc->format, instancedData[j], ptr);
send_attribute(This, si->elements[instancedData[j]].format_desc->id, instancedData[j], ptr);
}
glDrawElements(glPrimitiveType, numberOfVertices, idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
......
......@@ -3200,7 +3200,7 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, s
set_texture_matrix(&stateblock->transforms[WINED3DTS_TEXTURE0 + texUnit].u.m[0][0],
stateblock->textureState[texUnit][WINED3DTSS_TEXTURETRANSFORMFLAGS], generated, context->last_was_rhw,
stateblock->device->strided_streams.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))
? stateblock->device->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format_desc->format
? stateblock->device->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format_desc->id
: WINED3DFMT_UNKNOWN,
stateblock->device->frag_pipe->ffp_proj_control);
......@@ -4115,7 +4115,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i);
switch (stream_info->elements[i].format_desc->format)
switch (stream_info->elements[i].format_desc->id)
{
case WINED3DFMT_R32_FLOAT:
GL_EXTCALL(glVertexAttrib1fvARB(i, (const GLfloat *)ptr));
......
......@@ -554,7 +554,7 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device)
{
IWineD3DSurfaceImpl *render_target = device->render_targets[0];
if ((render_target->resource.usage & WINED3DUSAGE_RENDERTARGET)
&& (render_target->resource.format_desc->format == WINED3DFMT_P8_UINT))
&& (render_target->resource.format_desc->id == WINED3DFMT_P8_UINT))
return TRUE;
}
return FALSE;
......@@ -568,9 +568,9 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
const struct wined3d_format_desc *format_desc = This->resource.format_desc;
/* Only support read back of converted P8 surfaces */
if (This->Flags & SFLAG_CONVERTED && format_desc->format != WINED3DFMT_P8_UINT)
if (This->Flags & SFLAG_CONVERTED && format_desc->id != WINED3DFMT_P8_UINT)
{
FIXME("Read back converted textures unsupported, format=%s\n", debug_d3dformat(format_desc->format));
FIXME("Readback conversion not supported for format %s.\n", debug_d3dformat(format_desc->id));
return;
}
......@@ -607,7 +607,7 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
int dst_pitch = 0;
/* In case of P8 the index is stored in the alpha component if the primary render target uses P8 */
if (format_desc->format == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device))
if (format_desc->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device))
{
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
......@@ -819,7 +819,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
if (format_desc->heightscale != 1.0f && format_desc->heightscale != 0.0f) height *= format_desc->heightscale;
TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n",
This, This->texture_target, This->texture_level, debug_d3dformat(format_desc->format),
This, This->texture_target, This->texture_level, debug_d3dformat(format_desc->id),
internal, width, height, format_desc->glFormat, format_desc->glType);
ENTER_GL();
......@@ -992,7 +992,7 @@ static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD c
const struct wined3d_format_desc *format = surface->resource.format_desc;
IWineD3DDeviceImpl *device = surface->resource.device;
switch (format->format)
switch (format->id)
{
case WINED3DFMT_P8_UINT:
if (surface->palette)
......@@ -1033,7 +1033,7 @@ static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD c
break;
default:
ERR("Unhandled conversion from %s to floating point.\n", debug_d3dformat(format->format));
ERR("Unhandled conversion from %s to floating point.\n", debug_d3dformat(format->id));
return FALSE;
}
......@@ -1083,8 +1083,8 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg
if (!device->isInDraw) context = context_acquire(device, NULL);
if (surface->resource.format_desc->format == WINED3DFMT_P8_UINT
|| surface->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
if (surface->resource.format_desc->id == WINED3DFMT_P8_UINT
|| surface->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
if (palette9_changed(surface))
{
......@@ -1308,7 +1308,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
}
/* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */
switch(This->resource.format_desc->format)
switch (This->resource.format_desc->id)
{
case WINED3DFMT_P8_UINT:
{
......@@ -1417,7 +1417,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
row = HeapAlloc(GetProcessHeap(), 0, len);
if(!row) {
ERR("Out of memory\n");
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT) HeapFree(GetProcessHeap(), 0, mem);
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT) HeapFree(GetProcessHeap(), 0, mem);
LEAVE_GL();
return;
}
......@@ -1448,7 +1448,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
* the same color but we have no choice.
* In case of P8 render targets, the index is stored in the alpha component so no conversion is needed.
*/
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device))
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device))
{
const PALETTEENTRY *pal = NULL;
DWORD width = pitch / 3;
......@@ -2043,8 +2043,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
return hr;
}
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
|| This->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
/* GetDC on palettized formats is unsupported in D3D9, and the method is missing in
D3D8, so this should only be used for DX <=7 surfaces (with non-device palettes) */
......@@ -2124,7 +2124,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
*convert = NO_CONVERSION;
/* Ok, now look if we have to do any conversion */
switch(This->resource.format_desc->format)
switch (This->resource.format_desc->id)
{
case WINED3DFMT_P8_UINT:
/* ****************
......@@ -2462,8 +2462,8 @@ BOOL palette9_changed(IWineD3DSurfaceImpl *This)
{
IWineD3DDeviceImpl *device = This->resource.device;
if (This->palette || (This->resource.format_desc->format != WINED3DFMT_P8_UINT
&& This->resource.format_desc->format != WINED3DFMT_P8_UINT_A8_UNORM))
if (This->palette || (This->resource.format_desc->id != WINED3DFMT_P8_UINT
&& This->resource.format_desc->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
......@@ -3531,8 +3531,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
BOOL stretchx;
/* P8 read back is not implemented */
if (src_surface->resource.format_desc->format == WINED3DFMT_P8_UINT
|| dst_surface->resource.format_desc->format == WINED3DFMT_P8_UINT)
if (src_surface->resource.format_desc->id == WINED3DFMT_P8_UINT
|| dst_surface->resource.format_desc->id == WINED3DFMT_P8_UINT)
{
TRACE("P8 read back not supported by frame buffer to texture blit\n");
return WINED3DERR_INVALIDCALL;
......@@ -3766,8 +3766,9 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D
IWineD3DDeviceImpl *device = This->resource.device;
float depth;
if (Flags & WINEDDBLT_DEPTHFILL) {
switch(This->resource.format_desc->format)
if (Flags & WINEDDBLT_DEPTHFILL)
{
switch (This->resource.format_desc->id)
{
case WINED3DFMT_D16_UNORM:
depth = (float) DDBltFx->u5.dwFillDepth / (float) 0x0000ffff;
......@@ -3784,7 +3785,7 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D
break;
default:
depth = 0.0f;
ERR("Unexpected format for depth fill: %s\n", debug_d3dformat(This->resource.format_desc->format));
ERR("Unexpected format for depth fill: %s.\n", debug_d3dformat(This->resource.format_desc->id));
}
return IWineD3DDevice_Clear((IWineD3DDevice *)device, DestRect ? 1 : 0, (const WINED3DRECT *)DestRect,
......@@ -3910,8 +3911,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)
if (!pal) return WINED3D_OK;
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
|| This->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
if (This->resource.usage & WINED3DUSAGE_RENDERTARGET)
{
......@@ -4018,7 +4019,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
doesn't work in combination with ARB_TEXTURE_RECTANGLE.
*/
if (This->Flags & SFLAG_NONPOW2 && gl_info->supported[ARB_TEXTURE_RECTANGLE]
&& !(This->resource.format_desc->format == WINED3DFMT_P8_UINT
&& !(This->resource.format_desc->id == WINED3DFMT_P8_UINT
&& gl_info->supported[EXT_PALETTED_TEXTURE]
&& wined3d_settings.rendertargetlock_mode == RTL_READTEX))
{
......@@ -4970,7 +4971,7 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
!is_identity_fixup(dst_format_desc->color_fixup))
return FALSE;
if (!(src_format_desc->format == dst_format_desc->format
if (!(src_format_desc->id == dst_format_desc->id
|| (is_identity_fixup(src_format_desc->color_fixup)
&& is_identity_fixup(dst_format_desc->color_fixup))))
return FALSE;
......
......@@ -153,7 +153,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU
TRACE("(%p) : copying into %p\n", This, pDesc);
pDesc->format = This->resource.format_desc->format;
pDesc->format = This->resource.format_desc->id;
pDesc->resource_type = This->resource.resourceType;
pDesc->usage = This->resource.usage;
pDesc->pool = This->resource.pool;
......@@ -473,7 +473,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wi
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id,
&This->resource.device->adapter->gl_info);
if (This->resource.format_desc->format != WINED3DFMT_UNKNOWN)
if (This->resource.format_desc->id != WINED3DFMT_UNKNOWN)
{
FIXME("(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN\n", This);
return WINED3DERR_INVALIDCALL;
......@@ -505,7 +505,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
if(!(format_desc->Flags & WINED3DFMT_FLAG_GETDC))
{
WARN("Cannot use GetDC on a %s surface\n", debug_d3dformat(format_desc->format));
WARN("Cannot use GetDC on a %s surface\n", debug_d3dformat(format_desc->id));
return WINED3DERR_INVALIDCALL;
}
......@@ -557,7 +557,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
/* Get the bit masks */
masks = (DWORD *)b_info->bmiColors;
switch (This->resource.format_desc->format)
switch (This->resource.format_desc->id)
{
case WINED3DFMT_B8G8R8_UNORM:
usage = DIB_RGB_COLORS;
......@@ -802,10 +802,11 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
WINED3DLOCKED_RECT lock_src, lock_dst;
HRESULT hr;
conv = find_convertor(source->resource.format_desc->format, to_fmt);
if(!conv) {
FIXME("Cannot find a conversion function from format %s to %s\n",
debug_d3dformat(source->resource.format_desc->format), debug_d3dformat(to_fmt));
conv = find_convertor(source->resource.format_desc->id, to_fmt);
if (!conv)
{
FIXME("Cannot find a conversion function from format %s to %s.\n",
debug_d3dformat(source->resource.format_desc->id), debug_d3dformat(to_fmt));
return NULL;
}
......@@ -1102,9 +1103,9 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
dEntry = This->resource.format_desc;
if (src)
{
if (This->resource.format_desc->format != src->resource.format_desc->format)
if (This->resource.format_desc->id != src->resource.format_desc->id)
{
src = surface_convert_format(src, dEntry->format);
src = surface_convert_format(src, dEntry->id);
if (!src)
{
/* The conv function writes a FIXME */
......@@ -1660,7 +1661,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
FIXME("trans arg not supported when a compressed surface is involved\n");
if (dstx || dsty)
FIXME("offset for destination surface is not supported\n");
if (src->resource.format_desc->format != This->resource.format_desc->format)
if (src->resource.format_desc->id != This->resource.format_desc->id)
{
FIXME("compressed -> compressed copy only supported for the same type of surface\n");
ret = WINED3DERR_WRONGTEXTUREFORMAT;
......
......@@ -289,8 +289,8 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
return hr;
}
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
|| This->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
unsigned int n;
const PALETTEENTRY *pal = NULL;
......
......@@ -810,7 +810,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
}
if (!present_parameters->EnableAutoDepthStencil
|| swapchain->presentParms.AutoDepthStencilFormat != swapchain->ds_format->format)
|| swapchain->presentParms.AutoDepthStencilFormat != swapchain->ds_format->id)
{
FIXME("Add OpenGL context recreation support to context_validate_onscreen_formats\n");
}
......
......@@ -66,8 +66,8 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
context = context_acquire(device, NULL);
}
if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
|| This->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
for (i = 0; i < This->baseTexture.level_count; ++i)
{
......@@ -552,7 +552,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
texture->baseTexture.minMipLookup = minMipLookup_noFilter;
}
else if (gl_info->supported[ARB_TEXTURE_RECTANGLE] && (width != pow2_width || height != pow2_height)
&& !(format_desc->format == WINED3DFMT_P8_UINT && gl_info->supported[EXT_PALETTED_TEXTURE]
&& !(format_desc->id == WINED3DFMT_P8_UINT && gl_info->supported[EXT_PALETTED_TEXTURE]
&& wined3d_settings.rendertargetlock_mode == RTL_READTEX))
{
if ((width != 1) || (height != 1)) texture->baseTexture.pow2Matrix_identity = FALSE;
......@@ -602,8 +602,8 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
IWineD3DSurface *surface;
/* Use the callback to create the texture surface. */
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
usage, pool, i, 0, &surface);
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h,
format_desc->id, usage, pool, i, 0, &surface);
if (FAILED(hr))
{
FIXME("Failed to create surface %p, hr %#x\n", texture, hr);
......
......@@ -892,7 +892,7 @@ static BOOL init_format_base_info(struct wined3d_gl_info *gl_info)
for (i = 0; i < format_count; ++i)
{
struct wined3d_format_desc *desc = &gl_info->gl_formats[i];
desc->format = formats[i].id;
desc->id = formats[i].id;
desc->red_mask = formats[i].redMask;
desc->green_mask = formats[i].greenMask;
desc->blue_mask = formats[i].blueMask;
......@@ -976,7 +976,7 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("Format %s is supported as FBO color attachment\n", debug_d3dformat(format_desc->format));
TRACE("Format %s is supported as FBO color attachment.\n", debug_d3dformat(format_desc->id));
format_desc->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
format_desc->rtInternal = format_desc->glInternal;
}
......@@ -987,19 +987,19 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
if (format_desc->Flags & WINED3DFMT_FLAG_RENDERTARGET)
{
FIXME("Format %s with rendertarget flag is not supported as FBO color attachment,"
" and no fallback specified.\n", debug_d3dformat(format_desc->format));
" and no fallback specified.\n", debug_d3dformat(format_desc->id));
format_desc->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
else
{
TRACE("Format %s is not supported as FBO color attachment.\n", debug_d3dformat(format_desc->format));
TRACE("Format %s is not supported as FBO color attachment.\n", debug_d3dformat(format_desc->id));
}
format_desc->rtInternal = format_desc->glInternal;
}
else
{
TRACE("Format %s is not supported as FBO color attachment, trying rtInternal format as fallback.\n",
debug_d3dformat(format_desc->format));
debug_d3dformat(format_desc->id));
while(glGetError());
......@@ -1017,13 +1017,13 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("Format %s rtInternal format is supported as FBO color attachment\n",
debug_d3dformat(format_desc->format));
TRACE("Format %s rtInternal format is supported as FBO color attachment.\n",
debug_d3dformat(format_desc->id));
}
else
{
FIXME("Format %s rtInternal format is not supported as FBO color attachment.\n",
debug_d3dformat(format_desc->format));
debug_d3dformat(format_desc->id));
format_desc->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
}
......@@ -1074,12 +1074,12 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("Format %s's sRGB format is FBO attachable.\n", debug_d3dformat(format_desc->format));
TRACE("Format %s's sRGB format is FBO attachable.\n", debug_d3dformat(format_desc->id));
format_desc->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
}
else
{
WARN("Format %s's sRGB format is not FBO attachable.\n", debug_d3dformat(format_desc->format));
WARN("Format %s's sRGB format is not FBO attachable.\n", debug_d3dformat(format_desc->id));
}
}
......@@ -1113,20 +1113,20 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info)
if (desc->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
{
TRACE("Skipping format %s because it's a depth/stencil format.\n",
debug_d3dformat(desc->format));
debug_d3dformat(desc->id));
continue;
}
if (desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
{
TRACE("Skipping format %s because it's a compressed format.\n",
debug_d3dformat(desc->format));
debug_d3dformat(desc->id));
continue;
}
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(desc->format));
TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(desc->id));
check_fbo_compat(gl_info, desc);
}
else
......@@ -1562,7 +1562,7 @@ UINT wined3d_format_calculate_size(const struct wined3d_format_desc *format, UIN
{
UINT size;
if (format->format == WINED3DFMT_UNKNOWN)
if (format->id == WINED3DFMT_UNKNOWN)
{
size = 0;
}
......@@ -2479,8 +2479,9 @@ unsigned int count_bits(unsigned int mask)
BOOL getColorBits(const struct wined3d_format_desc *format_desc,
short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize)
{
TRACE("fmt: %s\n", debug_d3dformat(format_desc->format));
switch(format_desc->format)
TRACE("format %s.\n", debug_d3dformat(format_desc->id));
switch (format_desc->id)
{
case WINED3DFMT_B8G8R8X8_UNORM:
case WINED3DFMT_B8G8R8_UNORM:
......@@ -2497,7 +2498,7 @@ BOOL getColorBits(const struct wined3d_format_desc *format_desc,
case WINED3DFMT_P8_UINT:
break;
default:
ERR("Unsupported format: %s\n", debug_d3dformat(format_desc->format));
FIXME("Unsupported format %s.\n", debug_d3dformat(format_desc->id));
return FALSE;
}
......@@ -2507,16 +2508,17 @@ BOOL getColorBits(const struct wined3d_format_desc *format_desc,
*alphaSize = count_bits(format_desc->alpha_mask);
*totalSize = *redSize + *greenSize + *blueSize + *alphaSize;
TRACE("Returning red: %d, green: %d, blue: %d, alpha: %d, total: %d for fmt=%s\n",
*redSize, *greenSize, *blueSize, *alphaSize, *totalSize, debug_d3dformat(format_desc->format));
TRACE("Returning red: %d, green: %d, blue: %d, alpha: %d, total: %d for format %s.\n",
*redSize, *greenSize, *blueSize, *alphaSize, *totalSize, debug_d3dformat(format_desc->id));
return TRUE;
}
/* Helper function for retrieving depth/stencil info for ChoosePixelFormat and wglChoosePixelFormatARB */
BOOL getDepthStencilBits(const struct wined3d_format_desc *format_desc, short *depthSize, short *stencilSize)
{
TRACE("fmt: %s\n", debug_d3dformat(format_desc->format));
switch(format_desc->format)
TRACE("format %s.\n", debug_d3dformat(format_desc->id));
switch (format_desc->id)
{
case WINED3DFMT_D16_LOCKABLE:
case WINED3DFMT_D16_UNORM:
......@@ -2529,21 +2531,21 @@ BOOL getDepthStencilBits(const struct wined3d_format_desc *format_desc, short *d
case WINED3DFMT_D32_FLOAT:
break;
default:
FIXME("Unsupported stencil format: %s\n", debug_d3dformat(format_desc->format));
FIXME("Unsupported depth/stencil format %s.\n", debug_d3dformat(format_desc->id));
return FALSE;
}
*depthSize = format_desc->depth_size;
*stencilSize = format_desc->stencil_size;
TRACE("Returning depthSize: %d and stencilSize: %d for fmt=%s\n",
*depthSize, *stencilSize, debug_d3dformat(format_desc->format));
TRACE("Returning depthSize: %d and stencilSize: %d for format %s.\n",
*depthSize, *stencilSize, debug_d3dformat(format_desc->id));
return TRUE;
}
DWORD wined3d_format_convert_from_float(const struct wined3d_format_desc *format, const WINED3DCOLORVALUE *color)
{
enum wined3d_format_id destfmt = format->format;
enum wined3d_format_id destfmt = format->id;
unsigned int r, g, b, a;
DWORD ret;
......
......@@ -189,7 +189,7 @@ static HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DV
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc);
pDesc->Format = This->resource.format_desc->format;
pDesc->Format = This->resource.format_desc->id;
pDesc->Type = This->resource.resourceType;
pDesc->Usage = This->resource.usage;
pDesc->Pool = This->resource.pool;
......@@ -275,7 +275,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
const struct wined3d_format_desc *glDesc = This->resource.format_desc;
TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(glDesc->format), glDesc->format);
TRACE("iface %p, level %u, srgb %#x, format %s (%#x).\n",
iface, gl_level, srgb_mode, debug_d3dformat(glDesc->id), glDesc->id);
volume_bind_and_dirtify(iface);
......
......@@ -806,7 +806,7 @@ do {
/* Trace vector and strided data information */
#define TRACE_STRIDED(si, name) do { if (si->use_map & (1 << name)) \
TRACE( #name "=(data:%p, stride:%d, format:%#x, vbo %d, stream %u)\n", \
si->elements[name].data, si->elements[name].stride, si->elements[name].format_desc->format, \
si->elements[name].data, si->elements[name].stride, si->elements[name].format_desc->id, \
si->elements[name].buffer_object, si->elements[name].stream_idx); } while(0)
/* Advance declaration of structures to satisfy compiler */
......@@ -2959,7 +2959,8 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
struct wined3d_format_desc
{
enum wined3d_format_id format;
enum wined3d_format_id id;
DWORD red_mask;
DWORD green_mask;
DWORD blue_mask;
......
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