wined3d: Rename wined3d_format_desc to wined3d_format.
This commit is contained in:
parent
c568916f9e
commit
3a7f08a56f
|
@ -6987,10 +6987,10 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surfac
|
|||
enum complex_fixup fixup;
|
||||
GLenum textype = surface->texture_target;
|
||||
|
||||
if (!is_complex_fixup(surface->resource.format_desc->color_fixup))
|
||||
if (!is_complex_fixup(surface->resource.format->color_fixup))
|
||||
{
|
||||
TRACE("Fixup:\n");
|
||||
dump_color_fixup_desc(surface->resource.format_desc->color_fixup);
|
||||
dump_color_fixup_desc(surface->resource.format->color_fixup);
|
||||
/* Don't bother setting up a shader for unconverted formats */
|
||||
ENTER_GL();
|
||||
glEnable(textype);
|
||||
|
@ -6999,7 +6999,7 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surfac
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
fixup = get_complex_fixup(surface->resource.format_desc->color_fixup);
|
||||
fixup = get_complex_fixup(surface->resource.format->color_fixup);
|
||||
|
||||
switch(fixup)
|
||||
{
|
||||
|
@ -7069,10 +7069,8 @@ static void arbfp_blit_unset(IWineD3DDevice *iface) {
|
|||
}
|
||||
|
||||
static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool,
|
||||
const struct wined3d_format_desc *src_format_desc,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool,
|
||||
const struct wined3d_format_desc *dst_format_desc)
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format)
|
||||
{
|
||||
enum complex_fixup src_fixup;
|
||||
|
||||
|
@ -7082,27 +7080,27 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum bli
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
src_fixup = get_complex_fixup(src_format_desc->color_fixup);
|
||||
src_fixup = get_complex_fixup(src_format->color_fixup);
|
||||
if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
|
||||
{
|
||||
TRACE("Checking support for fixup:\n");
|
||||
dump_color_fixup_desc(src_format_desc->color_fixup);
|
||||
dump_color_fixup_desc(src_format->color_fixup);
|
||||
}
|
||||
|
||||
if (!is_identity_fixup(dst_format_desc->color_fixup))
|
||||
if (!is_identity_fixup(dst_format->color_fixup))
|
||||
{
|
||||
TRACE("Destination fixups are not supported\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (is_identity_fixup(src_format_desc->color_fixup))
|
||||
if (is_identity_fixup(src_format->color_fixup))
|
||||
{
|
||||
TRACE("[OK]\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* We only support YUV conversions. */
|
||||
if (!is_complex_fixup(src_format_desc->color_fixup))
|
||||
if (!is_complex_fixup(src_format->color_fixup))
|
||||
{
|
||||
TRACE("[FAILED]\n");
|
||||
return FALSE;
|
||||
|
|
|
@ -29,13 +29,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
|||
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
|
||||
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
|
||||
const struct wined3d_format_desc *format_desc, WINED3DPOOL pool, IUnknown *parent,
|
||||
const struct wined3d_format *format, WINED3DPOOL pool, IUnknown *parent,
|
||||
const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = resource_init((IWineD3DResource *)texture, resource_type, device,
|
||||
size, usage, format_desc, pool, parent, parent_ops);
|
||||
size, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x\n", hr);
|
||||
|
@ -60,7 +60,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UIN
|
|||
texture->baseTexture.is_srgb = FALSE;
|
||||
texture->baseTexture.pow2Matrix_identity = TRUE;
|
||||
|
||||
if (texture->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING)
|
||||
if (texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING)
|
||||
{
|
||||
texture->baseTexture.minMipLookup = minMipLookup;
|
||||
texture->baseTexture.magLookup = magLookup;
|
||||
|
@ -520,10 +520,10 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
|
|||
gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = aniso;
|
||||
}
|
||||
|
||||
if (!(This->resource.format_desc->Flags & WINED3DFMT_FLAG_SHADOW)
|
||||
if (!(This->resource.format->Flags & WINED3DFMT_FLAG_SHADOW)
|
||||
!= !gl_tex->states[WINED3DTEXSTA_SHADOW])
|
||||
{
|
||||
if (This->resource.format_desc->Flags & WINED3DFMT_FLAG_SHADOW)
|
||||
if (This->resource.format->Flags & WINED3DFMT_FLAG_SHADOW)
|
||||
{
|
||||
glTexParameteri(textureDimensions, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
|
|
|
@ -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->id));
|
||||
debug_d3dformat(attrib->format->id));
|
||||
}
|
||||
else if(attrib->stride != *stride_this_run && *stride_this_run)
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This,
|
|||
}
|
||||
|
||||
data = (((DWORD_PTR)attrib->data) + offset) % This->stride;
|
||||
attrib_size = attrib->format_desc->component_count * attrib->format_desc->component_size;
|
||||
attrib_size = attrib->format->component_count * attrib->format->component_size;
|
||||
for (i = 0; i < attrib_size; ++i)
|
||||
{
|
||||
DWORD_PTR idx = (data + i) % This->stride;
|
||||
|
@ -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->id;
|
||||
format = attrib->format->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->id;
|
||||
format = strided->elements[i].format->id;
|
||||
if (format == WINED3DFMT_R16G16_FLOAT)
|
||||
{
|
||||
shift = 4;
|
||||
|
@ -374,8 +374,8 @@ static UINT *find_conversion_shift(struct wined3d_buffer *This,
|
|||
|
||||
if (shift)
|
||||
{
|
||||
orig_type_size = strided->elements[i].format_desc->component_count
|
||||
* strided->elements[i].format_desc->component_size;
|
||||
orig_type_size = strided->elements[i].format->component_count
|
||||
* strided->elements[i].format->component_size;
|
||||
for (j = (DWORD_PTR)strided->elements[i].data + orig_type_size; j < stride; ++j)
|
||||
{
|
||||
ret[j] += shift;
|
||||
|
@ -1450,9 +1450,9 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
|
|||
UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint,
|
||||
const char *data, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, &device->adapter->gl_info);
|
||||
HRESULT hr;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
HRESULT hr;
|
||||
BOOL dynamic_buffer_ok;
|
||||
|
||||
if (!size)
|
||||
|
@ -1464,7 +1464,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
|
|||
buffer->vtbl = &wined3d_buffer_vtbl;
|
||||
|
||||
hr = resource_init((IWineD3DResource *)buffer, WINED3DRTYPE_BUFFER,
|
||||
device, size, usage, format_desc, pool, parent, parent_ops);
|
||||
device, size, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, hr %#x\n", hr);
|
||||
|
@ -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->id), buffer->resource.allocatedMemory, buffer);
|
||||
debug_d3dformat(buffer->resource.format->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];
|
||||
|
|
|
@ -201,7 +201,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
|
|||
|
||||
if (depth_stencil)
|
||||
{
|
||||
DWORD format_flags = depth_stencil->resource.format_desc->Flags;
|
||||
DWORD format_flags = depth_stencil->resource.format->Flags;
|
||||
|
||||
if (use_render_buffer && depth_stencil->current_renderbuffer)
|
||||
{
|
||||
|
@ -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->id),
|
||||
i, attachment, debug_d3dformat(attachment->resource.format->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->id),
|
||||
attachment, debug_d3dformat(attachment->resource.format->id),
|
||||
attachment->pow2Width, attachment->pow2Height);
|
||||
}
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state,
|
|||
|
||||
/* This function takes care of WineD3D pixel format selection. */
|
||||
static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
|
||||
const struct wined3d_format_desc *color_format_desc, const struct wined3d_format_desc *ds_format_desc,
|
||||
const struct wined3d_format *color_format, const struct wined3d_format *ds_format,
|
||||
BOOL auxBuffers, int numSamples, BOOL findCompatible)
|
||||
{
|
||||
int iPixelFormat=0;
|
||||
|
@ -1141,17 +1141,17 @@ 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->id), debug_d3dformat(ds_format_desc->id),
|
||||
debug_d3dformat(color_format->id), debug_d3dformat(ds_format->id),
|
||||
auxBuffers, numSamples, findCompatible);
|
||||
|
||||
if (!getColorBits(color_format_desc, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits))
|
||||
if (!getColorBits(color_format, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits))
|
||||
{
|
||||
ERR("Unable to get color bits for format %s (%#x)!\n",
|
||||
debug_d3dformat(color_format_desc->id), color_format_desc->id);
|
||||
debug_d3dformat(color_format->id), color_format->id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
getDepthStencilBits(ds_format_desc, &depthBits, &stencilBits);
|
||||
getDepthStencilBits(ds_format, &depthBits, &stencilBits);
|
||||
|
||||
for(matchtry = 0; matchtry < (sizeof(matches) / sizeof(matches[0])) && !iPixelFormat; matchtry++) {
|
||||
for(i=0; i<nCfgs; i++) {
|
||||
|
@ -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->id), debug_d3dformat(ds_format_desc->id));
|
||||
iPixelFormat, debug_d3dformat(color_format->id), debug_d3dformat(ds_format->id));
|
||||
return iPixelFormat;
|
||||
}
|
||||
|
||||
|
@ -1276,12 +1276,12 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
|
|||
* pPresentParameters: contains the pixelformats to use for onscreen rendering
|
||||
*
|
||||
*****************************************************************************/
|
||||
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
|
||||
const struct wined3d_format_desc *ds_format_desc)
|
||||
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain,
|
||||
IWineD3DSurfaceImpl *target, const struct wined3d_format *ds_format)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = swapchain->device;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *color_format_desc;
|
||||
const struct wined3d_format *color_format;
|
||||
struct wined3d_context *ret;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
BOOL auxBuffers = FALSE;
|
||||
|
@ -1307,7 +1307,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
|
|||
goto out;
|
||||
}
|
||||
|
||||
color_format_desc = target->resource.format_desc;
|
||||
color_format = target->resource.format;
|
||||
|
||||
/* In case of ORM_BACKBUFFER, make sure to request an alpha component for
|
||||
* X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */
|
||||
|
@ -1315,10 +1315,10 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
|
|||
{
|
||||
auxBuffers = TRUE;
|
||||
|
||||
if (color_format_desc->id == WINED3DFMT_B4G4R4X4_UNORM)
|
||||
color_format_desc = getFormatDescEntry(WINED3DFMT_B4G4R4A4_UNORM, gl_info);
|
||||
else if (color_format_desc->id == WINED3DFMT_B8G8R8X8_UNORM)
|
||||
color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
|
||||
if (color_format->id == WINED3DFMT_B4G4R4X4_UNORM)
|
||||
color_format = wined3d_get_format(gl_info, WINED3DFMT_B4G4R4A4_UNORM);
|
||||
else if (color_format->id == WINED3DFMT_B8G8R8X8_UNORM)
|
||||
color_format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
|
||||
}
|
||||
|
||||
/* DirectDraw supports 8bit paletted render targets and these are used by
|
||||
|
@ -1327,8 +1327,8 @@ 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->id == WINED3DFMT_P8_UINT)
|
||||
color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
|
||||
if (color_format->id == WINED3DFMT_P8_UINT)
|
||||
color_format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
|
||||
|
||||
/* D3D only allows multisampling when SwapEffect is set to WINED3DSWAPEFFECT_DISCARD. */
|
||||
if (swapchain->presentParms.MultiSampleType && (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD))
|
||||
|
@ -1343,14 +1343,14 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
|
|||
}
|
||||
|
||||
/* Try to find a pixel format which matches our requirements. */
|
||||
pixel_format = WineD3D_ChoosePixelFormat(device, hdc, color_format_desc, ds_format_desc,
|
||||
pixel_format = WineD3D_ChoosePixelFormat(device, hdc, color_format, ds_format,
|
||||
auxBuffers, numSamples, FALSE /* findCompatible */);
|
||||
|
||||
/* Try to locate a compatible format if we weren't able to find anything. */
|
||||
if (!pixel_format)
|
||||
{
|
||||
TRACE("Trying to locate a compatible pixel format because an exact match failed.\n");
|
||||
pixel_format = WineD3D_ChoosePixelFormat(device, hdc, color_format_desc, ds_format_desc,
|
||||
pixel_format = WineD3D_ChoosePixelFormat(device, hdc, color_format, ds_format,
|
||||
auxBuffers, 0 /* numSamples */, TRUE /* findCompatible */);
|
||||
}
|
||||
|
||||
|
@ -2046,8 +2046,8 @@ static inline void context_set_render_offscreen(struct wined3d_context *context,
|
|||
context->render_offscreen = offscreen;
|
||||
}
|
||||
|
||||
static BOOL match_depth_stencil_format(const struct wined3d_format_desc *existing,
|
||||
const struct wined3d_format_desc *required)
|
||||
static BOOL match_depth_stencil_format(const struct wined3d_format *existing,
|
||||
const struct wined3d_format *required)
|
||||
{
|
||||
short existing_depth, existing_stencil, required_depth, required_stencil;
|
||||
|
||||
|
@ -2071,7 +2071,7 @@ static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device,
|
|||
IWineD3DSwapChainImpl *swapchain = context->current_rt->container.u.swapchain;
|
||||
|
||||
if (context->render_offscreen || !depth_stencil) return;
|
||||
if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format_desc)) return;
|
||||
if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format)) return;
|
||||
|
||||
/* TODO: If the requested format would satisfy the needs of the existing one(reverse match),
|
||||
* or no onscreen depth buffer was created, the OpenGL drawable could be changed to the new
|
||||
|
@ -2253,8 +2253,8 @@ static void context_setup_target(IWineD3DDeviceImpl *device,
|
|||
}
|
||||
else
|
||||
{
|
||||
const struct wined3d_format_desc *old = context->current_rt->resource.format_desc;
|
||||
const struct wined3d_format_desc *new = target->resource.format_desc;
|
||||
const struct wined3d_format *old = context->current_rt->resource.format;
|
||||
const struct wined3d_format *new = target->resource.format;
|
||||
|
||||
if (old->id != new->id)
|
||||
{
|
||||
|
|
|
@ -70,8 +70,8 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
|
|||
context = context_acquire(device, NULL);
|
||||
}
|
||||
|
||||
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
if (This->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
{
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
|
|||
IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
UINT pow2_edge_length;
|
||||
unsigned int i, j;
|
||||
UINT tmp_w;
|
||||
|
@ -501,7 +501,7 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
|
|||
texture->lpVtbl = &IWineD3DCubeTexture_Vtbl;
|
||||
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 6, levels,
|
||||
WINED3DRTYPE_CUBETEXTURE, device, 0, usage, format_desc, pool, parent, parent_ops);
|
||||
WINED3DRTYPE_CUBETEXTURE, device, 0, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize basetexture, returning %#x\n", hr);
|
||||
|
|
|
@ -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->id), debug_d3ddeclusage(element->usage));
|
||||
debug_d3dformat(element->format->id), debug_d3ddeclusage(element->usage));
|
||||
stride_used = FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -289,16 +289,16 @@ 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->id), buffer_object);
|
||||
element->offset, stride, debug_d3dformat(element->format->id), buffer_object);
|
||||
|
||||
stream_info->elements[idx].format_desc = element->format_desc;
|
||||
stream_info->elements[idx].format = element->format;
|
||||
stream_info->elements[idx].stride = stride;
|
||||
stream_info->elements[idx].data = data;
|
||||
stream_info->elements[idx].stream_idx = element->input_slot;
|
||||
stream_info->elements[idx].buffer_object = buffer_object;
|
||||
|
||||
if (!This->adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA]
|
||||
&& element->format_desc->id == WINED3DFMT_B8G8R8A8_UNORM)
|
||||
&& element->format->id == WINED3DFMT_B8G8R8A8_UNORM)
|
||||
{
|
||||
stream_info->swizzle_map |= 1 << idx;
|
||||
}
|
||||
|
@ -343,8 +343,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
|
|||
static void stream_info_element_from_strided(const struct wined3d_gl_info *gl_info,
|
||||
const struct WineDirect3DStridedData *strided, struct wined3d_stream_info_element *e)
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(strided->format, gl_info);
|
||||
e->format_desc = format_desc;
|
||||
e->format = wined3d_get_format(gl_info, strided->format);
|
||||
e->stride = strided->dwStride;
|
||||
e->data = strided->lpData;
|
||||
e->stream_idx = 0;
|
||||
|
@ -378,10 +377,10 @@ static void device_stream_info_from_strided(const struct wined3d_gl_info *gl_inf
|
|||
|
||||
for (i = 0; i < sizeof(stream_info->elements) / sizeof(*stream_info->elements); ++i)
|
||||
{
|
||||
if (!stream_info->elements[i].format_desc) continue;
|
||||
if (!stream_info->elements[i].format) continue;
|
||||
|
||||
if (!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
|
||||
&& stream_info->elements[i].format_desc->id == WINED3DFMT_B8G8R8A8_UNORM)
|
||||
&& stream_info->elements[i].format->id == WINED3DFMT_B8G8R8A8_UNORM)
|
||||
{
|
||||
stream_info->swizzle_map |= 1 << i;
|
||||
}
|
||||
|
@ -1365,14 +1364,14 @@ struct wined3d_fvf_convert_state
|
|||
};
|
||||
|
||||
static void append_decl_element(struct wined3d_fvf_convert_state *state,
|
||||
enum wined3d_format_id format, WINED3DDECLUSAGE usage, UINT usage_idx)
|
||||
enum wined3d_format_id format_id, WINED3DDECLUSAGE usage, UINT usage_idx)
|
||||
{
|
||||
WINED3DVERTEXELEMENT *elements = state->elements;
|
||||
const struct wined3d_format_desc *format_desc;
|
||||
const struct wined3d_format *format;
|
||||
UINT offset = state->offset;
|
||||
UINT idx = state->idx;
|
||||
|
||||
elements[idx].format = format;
|
||||
elements[idx].format = format_id;
|
||||
elements[idx].input_slot = 0;
|
||||
elements[idx].offset = offset;
|
||||
elements[idx].output_slot = 0;
|
||||
|
@ -1380,8 +1379,8 @@ static void append_decl_element(struct wined3d_fvf_convert_state *state,
|
|||
elements[idx].usage = usage;
|
||||
elements[idx].usage_idx = usage_idx;
|
||||
|
||||
format_desc = getFormatDescEntry(format, state->gl_info);
|
||||
state->offset += format_desc->component_count * format_desc->component_size;
|
||||
format = wined3d_get_format(state->gl_info, format_id);
|
||||
state->offset += format->component_count * format->component_size;
|
||||
++state->idx;
|
||||
}
|
||||
|
||||
|
@ -2190,7 +2189,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
|
|||
const WINED3DDISPLAYMODE* pMode) {
|
||||
DEVMODEW devmode;
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(pMode->Format, &This->adapter->gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(&This->adapter->gl_info, pMode->Format);
|
||||
LONG ret;
|
||||
RECT clip_rc;
|
||||
|
||||
|
@ -2205,7 +2204,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
|
|||
memset(&devmode, 0, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(devmode);
|
||||
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
devmode.dmBitsPerPel = format_desc->byte_count * 8;
|
||||
devmode.dmBitsPerPel = format->byte_count * CHAR_BIT;
|
||||
devmode.dmPelsWidth = pMode->Width;
|
||||
devmode.dmPelsHeight = pMode->Height;
|
||||
|
||||
|
@ -5023,7 +5022,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ValidateDevice(IWineD3DDevice *iface,
|
|||
}
|
||||
|
||||
texture = (IWineD3DBaseTextureImpl *) This->stateBlock->textures[i];
|
||||
if (!texture || texture->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING) continue;
|
||||
if (!texture || texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING) continue;
|
||||
|
||||
if(This->stateBlock->samplerState[i][WINED3DSAMP_MAGFILTER] != WINED3DTEXF_POINT) {
|
||||
WARN("Non-filterable texture and mag filter enabled on samper %u, returning E_FAIL\n", i);
|
||||
|
@ -5054,8 +5053,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->id == WINED3DFMT_P8_UINT
|
||||
|| texture->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM))
|
||||
if (texture && (texture->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| texture->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM))
|
||||
{
|
||||
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(i));
|
||||
}
|
||||
|
@ -5241,8 +5240,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
|
|||
IWineD3DSurfaceImpl *src_impl = (IWineD3DSurfaceImpl *)src_surface;
|
||||
IWineD3DSurfaceImpl *dst_impl = (IWineD3DSurfaceImpl *)dst_surface;
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
const struct wined3d_format_desc *src_format;
|
||||
const struct wined3d_format_desc *dst_format;
|
||||
const struct wined3d_format *src_format;
|
||||
const struct wined3d_format *dst_format;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
const unsigned char *data;
|
||||
|
@ -5251,7 +5250,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
|
|||
UINT src_w, src_h;
|
||||
UINT dst_x, dst_y;
|
||||
DWORD sampler;
|
||||
struct wined3d_format_desc desc;
|
||||
struct wined3d_format format;
|
||||
|
||||
TRACE("iface %p, src_surface %p, src_rect %s, dst_surface %p, dst_point %s.\n",
|
||||
iface, src_surface, wine_dbgstr_rect(src_rect),
|
||||
|
@ -5264,8 +5263,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
src_format = src_impl->resource.format_desc;
|
||||
dst_format = dst_impl->resource.format_desc;
|
||||
src_format = src_impl->resource.format;
|
||||
dst_format = dst_impl->resource.format;
|
||||
|
||||
if (src_format->id != dst_format->id)
|
||||
{
|
||||
|
@ -5280,8 +5279,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
|
|||
* surface to the destination's sysmem copy. If surface conversion is
|
||||
* needed, use BltFast instead to copy in sysmem and use regular surface
|
||||
* loading. */
|
||||
d3dfmt_get_conv(dst_impl, FALSE, TRUE, &desc, &convert);
|
||||
if (convert != NO_CONVERSION || desc.convert)
|
||||
d3dfmt_get_conv(dst_impl, FALSE, TRUE, &format, &convert);
|
||||
if (convert != NO_CONVERSION || format.convert)
|
||||
return IWineD3DSurface_BltFast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0);
|
||||
|
||||
context = context_acquire(This, NULL);
|
||||
|
@ -5630,7 +5629,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->id;
|
||||
swapchain->presentParms.BackBufferFormat = back_impl->resource.format->id;
|
||||
swapchain->presentParms.BackBufferCount = 1;
|
||||
|
||||
surface_set_container(back_impl, WINED3D_CONTAINER_SWAPCHAIN, (IWineD3DBase *)swapchain);
|
||||
|
@ -5802,7 +5801,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
|
|||
WINED3DLOCKED_RECT rect;
|
||||
|
||||
/* MSDN: Cursor must be A8R8G8B8 */
|
||||
if (s->resource.format_desc->id != WINED3DFMT_B8G8R8A8_UNORM)
|
||||
if (s->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM)
|
||||
{
|
||||
WARN("surface %p has an invalid format.\n", cursor_image);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -5831,15 +5830,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
|
|||
if (SUCCEEDED(IWineD3DSurface_LockRect(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
|
||||
struct wined3d_context *context;
|
||||
char *mem, *bits = rect.pBits;
|
||||
GLint intfmt = format_desc->glInternal;
|
||||
GLint format = format_desc->glFormat;
|
||||
GLint type = format_desc->glType;
|
||||
GLint intfmt = format->glInternal;
|
||||
GLint gl_format = format->glFormat;
|
||||
GLint type = format->glType;
|
||||
INT height = This->cursorHeight;
|
||||
INT width = This->cursorWidth;
|
||||
INT bpp = format_desc->byte_count;
|
||||
INT bpp = format->byte_count;
|
||||
DWORD sampler;
|
||||
INT i;
|
||||
|
||||
|
@ -5874,7 +5873,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
|
|||
glBindTexture(GL_TEXTURE_2D, This->cursorTexture);
|
||||
checkGLcall("glBindTexture");
|
||||
/* Copy the bitmap memory into the cursor texture */
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, format, type, mem);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, gl_format, type, mem);
|
||||
HeapFree(GetProcessHeap(), 0, mem);
|
||||
checkGLcall("glTexImage2D");
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ unsigned int WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *device, unsigned int
|
|||
|
||||
static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, adapter->gl_info.gl_formats);
|
||||
HeapFree(GetProcessHeap(), 0, adapter->gl_info.formats);
|
||||
HeapFree(GetProcessHeap(), 0, adapter->cfgs);
|
||||
}
|
||||
|
||||
|
@ -2771,9 +2771,10 @@ static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Adapte
|
|||
}
|
||||
|
||||
/* TODO: Store modes per adapter and read it from the adapter structure */
|
||||
if (Adapter == 0) { /* Display */
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, &This->adapters[Adapter].gl_info);
|
||||
UINT format_bits = format_desc->byte_count * CHAR_BIT;
|
||||
if (Adapter == 0)
|
||||
{
|
||||
const struct wined3d_format *format = wined3d_get_format(&This->adapters[Adapter].gl_info, format_id);
|
||||
UINT format_bits = format->byte_count * CHAR_BIT;
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
DEVMODEW mode;
|
||||
|
@ -2823,8 +2824,8 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte
|
|||
/* TODO: Store modes per adapter and read it from the adapter structure */
|
||||
if (Adapter == 0)
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, &This->adapters[Adapter].gl_info);
|
||||
UINT format_bits = format_desc->byte_count * CHAR_BIT;
|
||||
const struct wined3d_format *format = wined3d_get_format(&This->adapters[Adapter].gl_info, format_id);
|
||||
UINT format_bits = format->byte_count * CHAR_BIT;
|
||||
DEVMODEW DevModeW;
|
||||
int ModeIdx = 0;
|
||||
UINT i = 0;
|
||||
|
@ -2990,7 +2991,7 @@ static HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Ad
|
|||
}
|
||||
|
||||
static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined3d_gl_info *gl_info,
|
||||
const WineD3D_PixelFormat *cfg, const struct wined3d_format_desc *format_desc)
|
||||
const WineD3D_PixelFormat *cfg, const struct wined3d_format *format)
|
||||
{
|
||||
short redSize, greenSize, blueSize, alphaSize, colorBits;
|
||||
|
||||
|
@ -2998,12 +2999,12 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined
|
|||
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->Flags & WINED3DFMT_FLAG_FLOAT) return FALSE;
|
||||
|
||||
if(cfg->iPixelType == WGL_TYPE_RGBA_ARB) { /* Integer RGBA formats */
|
||||
if (!getColorBits(format_desc, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
|
||||
if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
|
||||
{
|
||||
ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format_desc->id));
|
||||
ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format->id));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -3027,7 +3028,7 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined
|
|||
}
|
||||
|
||||
static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3d_gl_info *gl_info,
|
||||
const WineD3D_PixelFormat *cfg, const struct wined3d_format_desc *format_desc)
|
||||
const WineD3D_PixelFormat *cfg, const struct wined3d_format *format)
|
||||
{
|
||||
short depthSize, stencilSize;
|
||||
BOOL lockable = FALSE;
|
||||
|
@ -3035,16 +3036,16 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3
|
|||
if(!cfg)
|
||||
return FALSE;
|
||||
|
||||
if (!getDepthStencilBits(format_desc, &depthSize, &stencilSize))
|
||||
if (!getDepthStencilBits(format, &depthSize, &stencilSize))
|
||||
{
|
||||
ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format_desc->id));
|
||||
ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format->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->Flags & WINED3DFMT_FLAG_FLOAT) return FALSE;
|
||||
|
||||
if ((format_desc->id == WINED3DFMT_D16_LOCKABLE) || (format_desc->id == WINED3DFMT_D32_FLOAT))
|
||||
if ((format->id == WINED3DFMT_D16_LOCKABLE) || (format->id == WINED3DFMT_D32_FLOAT))
|
||||
lockable = TRUE;
|
||||
|
||||
/* On some modern cards like the Geforce8/9 GLX doesn't offer some dephthstencil formats which D3D9 reports.
|
||||
|
@ -3069,8 +3070,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface,
|
|||
int nCfgs;
|
||||
const WineD3D_PixelFormat *cfgs;
|
||||
const struct wined3d_adapter *adapter;
|
||||
const struct wined3d_format_desc *rt_format_desc;
|
||||
const struct wined3d_format_desc *ds_format_desc;
|
||||
const struct wined3d_format *rt_format;
|
||||
const struct wined3d_format *ds_format;
|
||||
int it;
|
||||
|
||||
WARN_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n",
|
||||
|
@ -3086,12 +3087,13 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface,
|
|||
}
|
||||
|
||||
adapter = &This->adapters[Adapter];
|
||||
rt_format_desc = getFormatDescEntry(RenderTargetFormat, &adapter->gl_info);
|
||||
ds_format_desc = getFormatDescEntry(DepthStencilFormat, &adapter->gl_info);
|
||||
rt_format = wined3d_get_format(&adapter->gl_info, RenderTargetFormat);
|
||||
ds_format = wined3d_get_format(&adapter->gl_info, DepthStencilFormat);
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
|
||||
{
|
||||
if ((rt_format_desc->Flags & WINED3DFMT_FLAG_RENDERTARGET) &&
|
||||
(ds_format_desc->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) {
|
||||
if ((rt_format->Flags & WINED3DFMT_FLAG_RENDERTARGET)
|
||||
&& (ds_format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
{
|
||||
TRACE_(d3d_caps)("(%p) : Formats matched\n", This);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -3100,10 +3102,11 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface,
|
|||
{
|
||||
cfgs = adapter->cfgs;
|
||||
nCfgs = adapter->nCfgs;
|
||||
for (it = 0; it < nCfgs; ++it) {
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, &cfgs[it], rt_format_desc))
|
||||
for (it = 0; it < nCfgs; ++it)
|
||||
{
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[it], ds_format_desc))
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, &cfgs[it], rt_format))
|
||||
{
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[it], ds_format))
|
||||
{
|
||||
TRACE_(d3d_caps)("(%p) : Formats matched\n", This);
|
||||
return WINED3D_OK;
|
||||
|
@ -3121,8 +3124,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
WINED3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels)
|
||||
{
|
||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
const struct wined3d_format_desc *glDesc;
|
||||
const struct wined3d_adapter *adapter;
|
||||
const struct wined3d_format *format;
|
||||
|
||||
TRACE_(d3d_caps)("(%p)-> (Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x, pQual:%p)\n",
|
||||
This,
|
||||
|
@ -3151,10 +3154,11 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
||||
adapter = &This->adapters[Adapter];
|
||||
glDesc = getFormatDescEntry(SurfaceFormat, &adapter->gl_info);
|
||||
if (!glDesc) return WINED3DERR_INVALIDCALL;
|
||||
format = wined3d_get_format(&adapter->gl_info, SurfaceFormat);
|
||||
if (!format) return WINED3DERR_INVALIDCALL;
|
||||
|
||||
if(glDesc->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) {
|
||||
if (format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
{
|
||||
int i, nCfgs;
|
||||
const WineD3D_PixelFormat *cfgs;
|
||||
|
||||
|
@ -3164,7 +3168,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
if(cfgs[i].numSamples != MultiSampleType)
|
||||
continue;
|
||||
|
||||
if (!IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[i], glDesc))
|
||||
if (!IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[i], format))
|
||||
continue;
|
||||
|
||||
TRACE("Found iPixelFormat=%d to support MultiSampleType=%d for format %s\n", cfgs[i].iPixelFormat, MultiSampleType, debug_d3dformat(SurfaceFormat));
|
||||
|
@ -3174,12 +3178,13 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
return WINED3D_OK;
|
||||
}
|
||||
}
|
||||
else if(glDesc->Flags & WINED3DFMT_FLAG_RENDERTARGET) {
|
||||
else if (format->Flags & WINED3DFMT_FLAG_RENDERTARGET)
|
||||
{
|
||||
short redSize, greenSize, blueSize, alphaSize, colorBits;
|
||||
int i, nCfgs;
|
||||
const WineD3D_PixelFormat *cfgs;
|
||||
|
||||
if (!getColorBits(glDesc, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
|
||||
if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
|
||||
{
|
||||
ERR("Unable to color bits for format %#x, can't check multisampling capability!\n", SurfaceFormat);
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3199,7 +3204,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
/* Not all drivers report alpha-less formats since they use 32-bit anyway, so accept alpha even if we didn't ask for it. */
|
||||
if(alphaSize && cfgs[i].alphaSize != alphaSize)
|
||||
continue;
|
||||
if(cfgs[i].colorSize != (glDesc->byte_count << 3))
|
||||
if (cfgs[i].colorSize != (format->byte_count << 3))
|
||||
continue;
|
||||
|
||||
TRACE("Found iPixelFormat=%d to support MultiSampleType=%d for format %s\n", cfgs[i].iPixelFormat, MultiSampleType, debug_d3dformat(SurfaceFormat));
|
||||
|
@ -3300,28 +3305,28 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter
|
|||
|
||||
|
||||
/* Check if we support bumpmapping for a format */
|
||||
static BOOL CheckBumpMapCapability(struct wined3d_adapter *adapter, const struct wined3d_format_desc *format_desc)
|
||||
static BOOL CheckBumpMapCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format)
|
||||
{
|
||||
/* Ask the fixed function pipeline implementation if it can deal
|
||||
* with the conversion. If we've got a GL extension giving native
|
||||
* support this will be an identity conversion. */
|
||||
return (format_desc->Flags & WINED3DFMT_FLAG_BUMPMAP)
|
||||
&& adapter->fragment_pipe->color_fixup_supported(format_desc->color_fixup);
|
||||
return (format->Flags & WINED3DFMT_FLAG_BUMPMAP)
|
||||
&& adapter->fragment_pipe->color_fixup_supported(format->color_fixup);
|
||||
}
|
||||
|
||||
/* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
|
||||
static BOOL CheckDepthStencilCapability(struct wined3d_adapter *adapter,
|
||||
const struct wined3d_format_desc *display_format_desc, const struct wined3d_format_desc *ds_format_desc)
|
||||
const struct wined3d_format *display_format, const struct wined3d_format *ds_format)
|
||||
{
|
||||
int it=0;
|
||||
|
||||
/* Only allow depth/stencil formats */
|
||||
if (!(ds_format_desc->depth_size || ds_format_desc->stencil_size)) return FALSE;
|
||||
if (!(ds_format->depth_size || ds_format->stencil_size)) return FALSE;
|
||||
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
|
||||
{
|
||||
/* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
|
||||
if (ds_format_desc->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) return TRUE;
|
||||
if (ds_format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3329,9 +3334,9 @@ static BOOL CheckDepthStencilCapability(struct wined3d_adapter *adapter,
|
|||
for (it = 0; it < adapter->nCfgs; ++it)
|
||||
{
|
||||
WineD3D_PixelFormat *cfg = &adapter->cfgs[it];
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, cfg, display_format_desc))
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, cfg, display_format))
|
||||
{
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, cfg, ds_format_desc))
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, cfg, ds_format))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3342,28 +3347,29 @@ static BOOL CheckDepthStencilCapability(struct wined3d_adapter *adapter,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckFilterCapability(struct wined3d_adapter *adapter, const struct wined3d_format_desc *format_desc)
|
||||
static BOOL CheckFilterCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format)
|
||||
{
|
||||
/* The flags entry of a format contains the filtering capability */
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_FILTERING) return TRUE;
|
||||
if (format->Flags & WINED3DFMT_FLAG_FILTERING) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check the render target capabilities of a format */
|
||||
static BOOL CheckRenderTargetCapability(struct wined3d_adapter *adapter,
|
||||
const struct wined3d_format_desc *adapter_format_desc, const struct wined3d_format_desc *check_format_desc)
|
||||
const struct wined3d_format *adapter_format, const struct wined3d_format *check_format)
|
||||
{
|
||||
/* Filter out non-RT formats */
|
||||
if (!(check_format_desc->Flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE;
|
||||
if(wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) {
|
||||
if (!(check_format->Flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE;
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
|
||||
{
|
||||
WineD3D_PixelFormat *cfgs = adapter->cfgs;
|
||||
int it;
|
||||
short AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize;
|
||||
short CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize;
|
||||
|
||||
getColorBits(adapter_format_desc, &AdapterRed, &AdapterGreen, &AdapterBlue, &AdapterAlpha, &AdapterTotalSize);
|
||||
getColorBits(check_format_desc, &CheckRed, &CheckGreen, &CheckBlue, &CheckAlpha, &CheckTotalSize);
|
||||
getColorBits(adapter_format, &AdapterRed, &AdapterGreen, &AdapterBlue, &AdapterAlpha, &AdapterTotalSize);
|
||||
getColorBits(check_format, &CheckRed, &CheckGreen, &CheckBlue, &CheckAlpha, &CheckTotalSize);
|
||||
|
||||
/* In backbuffer mode the front and backbuffer share the same WGL pixelformat.
|
||||
* The format must match in RGB, alpha is allowed to be different. (Only the backbuffer can have alpha) */
|
||||
|
@ -3377,10 +3383,10 @@ static BOOL CheckRenderTargetCapability(struct wined3d_adapter *adapter,
|
|||
for (it = 0; it < adapter->nCfgs; ++it)
|
||||
{
|
||||
if (cfgs[it].windowDrawable && IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info,
|
||||
&cfgs[it], check_format_desc))
|
||||
&cfgs[it], check_format))
|
||||
{
|
||||
TRACE_(d3d_caps)("Pixel format %d is compatible with format %s.\n",
|
||||
cfgs[it].iPixelFormat, debug_d3dformat(check_format_desc->id));
|
||||
cfgs[it].iPixelFormat, debug_d3dformat(check_format->id));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -3394,18 +3400,17 @@ static BOOL CheckRenderTargetCapability(struct wined3d_adapter *adapter,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckSrgbReadCapability(struct wined3d_adapter *adapter, const struct wined3d_format_desc *format_desc)
|
||||
static BOOL CheckSrgbReadCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format)
|
||||
{
|
||||
return adapter->gl_info.supported[EXT_TEXTURE_SRGB]
|
||||
&& (format_desc->Flags & WINED3DFMT_FLAG_SRGB_READ);
|
||||
return adapter->gl_info.supported[EXT_TEXTURE_SRGB] && (format->Flags & WINED3DFMT_FLAG_SRGB_READ);
|
||||
}
|
||||
|
||||
static BOOL CheckSrgbWriteCapability(struct wined3d_adapter *adapter, const struct wined3d_format_desc *format_desc)
|
||||
static BOOL CheckSrgbWriteCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format)
|
||||
{
|
||||
/* Only offer SRGB writing on X8R8G8B8/A8R8G8B8 when we use ARB or GLSL shaders as we are
|
||||
* doing the color fixup in shaders.
|
||||
* Note Windows drivers (at least on the Geforce 8800) also offer this on R5G6B5. */
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_SRGB_WRITE)
|
||||
if (format->Flags & WINED3DFMT_FLAG_SRGB_WRITE)
|
||||
{
|
||||
int vs_selected_mode;
|
||||
int ps_selected_mode;
|
||||
|
@ -3417,21 +3422,21 @@ static BOOL CheckSrgbWriteCapability(struct wined3d_adapter *adapter, const stru
|
|||
}
|
||||
}
|
||||
|
||||
TRACE_(d3d_caps)("[FAILED] - sRGB writes not supported by format %s.\n", debug_d3dformat(format_desc->id));
|
||||
TRACE_(d3d_caps)("[FAILED] - sRGB writes not supported by format %s.\n", debug_d3dformat(format->id));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if a format support blending in combination with pixel shaders */
|
||||
static BOOL CheckPostPixelShaderBlendingCapability(struct wined3d_adapter *adapter,
|
||||
const struct wined3d_format_desc *format_desc)
|
||||
const struct wined3d_format *format)
|
||||
{
|
||||
/* The flags entry of a format contains the post pixel shader blending capability */
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) return TRUE;
|
||||
if (format->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckWrapAndMipCapability(struct wined3d_adapter *adapter, const struct wined3d_format_desc *format_desc)
|
||||
static BOOL CheckWrapAndMipCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format)
|
||||
{
|
||||
/* OpenGL supports mipmapping on all formats basically. Wrapping is unsupported,
|
||||
* but we have to report mipmapping so we cannot reject this flag. Tests show that
|
||||
|
@ -3446,11 +3451,11 @@ static BOOL CheckWrapAndMipCapability(struct wined3d_adapter *adapter, const str
|
|||
}
|
||||
|
||||
/* Check if a texture format is supported on the given adapter */
|
||||
static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct wined3d_format_desc *format_desc)
|
||||
static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
|
||||
|
||||
switch (format_desc->id)
|
||||
switch (format->id)
|
||||
{
|
||||
/*****
|
||||
* supported: RGB(A) formats
|
||||
|
@ -3526,7 +3531,7 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct
|
|||
/* Ask the shader backend if it can deal with the conversion. If
|
||||
* we've got a GL extension giving native support this will be an
|
||||
* identity conversion. */
|
||||
if (adapter->shader_backend->shader_color_fixup_supported(format_desc->color_fixup))
|
||||
if (adapter->shader_backend->shader_color_fixup_supported(format->color_fixup))
|
||||
{
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
return TRUE;
|
||||
|
@ -3642,8 +3647,8 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct
|
|||
if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC]
|
||||
|| gl_info->supported[ARB_TEXTURE_COMPRESSION_RGTC])
|
||||
{
|
||||
if (adapter->shader_backend->shader_color_fixup_supported(format_desc->color_fixup)
|
||||
&& adapter->fragment_pipe->color_fixup_supported(format_desc->color_fixup))
|
||||
if (adapter->shader_backend->shader_color_fixup_supported(format->color_fixup)
|
||||
&& adapter->fragment_pipe->color_fixup_supported(format->color_fixup))
|
||||
{
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
return TRUE;
|
||||
|
@ -3670,20 +3675,20 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct
|
|||
return FALSE;
|
||||
|
||||
default:
|
||||
ERR("Unhandled format %s.\n", debug_d3dformat(format_desc->id));
|
||||
ERR("Unhandled format %s.\n", debug_d3dformat(format->id));
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter,
|
||||
const struct wined3d_format_desc *adapter_format_desc,
|
||||
const struct wined3d_format_desc *check_format_desc,
|
||||
const struct wined3d_format *adapter_format,
|
||||
const struct wined3d_format *check_format,
|
||||
WINED3DSURFTYPE SurfaceType)
|
||||
{
|
||||
if (SurfaceType == SURFACE_GDI)
|
||||
{
|
||||
switch (check_format_desc->id)
|
||||
switch (check_format->id)
|
||||
{
|
||||
case WINED3DFMT_B8G8R8_UNORM:
|
||||
case WINED3DFMT_B8G8R8A8_UNORM:
|
||||
|
@ -3712,14 +3717,14 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter,
|
|||
}
|
||||
|
||||
/* All format that are supported for textures are supported for surfaces as well */
|
||||
if (CheckTextureCapability(adapter, check_format_desc)) return TRUE;
|
||||
if (CheckTextureCapability(adapter, check_format)) return TRUE;
|
||||
/* All depth stencil formats are supported on surfaces */
|
||||
if (CheckDepthStencilCapability(adapter, adapter_format_desc, check_format_desc)) return TRUE;
|
||||
if (CheckDepthStencilCapability(adapter, adapter_format, check_format)) return TRUE;
|
||||
|
||||
/* If opengl can't process the format natively, the blitter may be able to convert it */
|
||||
if (adapter->blitter->blit_supported(&adapter->gl_info, BLIT_OP_BLIT,
|
||||
NULL, WINED3DPOOL_DEFAULT, 0, check_format_desc,
|
||||
NULL, WINED3DPOOL_DEFAULT, 0, adapter_format_desc))
|
||||
NULL, WINED3DPOOL_DEFAULT, 0, check_format,
|
||||
NULL, WINED3DPOOL_DEFAULT, 0, adapter_format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
return TRUE;
|
||||
|
@ -3731,10 +3736,9 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter,
|
|||
}
|
||||
|
||||
static BOOL CheckVertexTextureCapability(struct wined3d_adapter *adapter,
|
||||
const struct wined3d_format_desc *format_desc)
|
||||
const struct wined3d_format *format)
|
||||
{
|
||||
return adapter->gl_info.limits.vertex_samplers
|
||||
&& (format_desc->Flags & WINED3DFMT_FLAG_VTF);
|
||||
return adapter->gl_info.limits.vertex_samplers && (format->Flags & WINED3DFMT_FLAG_VTF);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType,
|
||||
|
@ -3744,8 +3748,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
struct wined3d_adapter *adapter = &This->adapters[Adapter];
|
||||
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(CheckFormat, gl_info);
|
||||
const struct wined3d_format_desc *adapter_format_desc = getFormatDescEntry(AdapterFormat, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, CheckFormat);
|
||||
const struct wined3d_format *adapter_format = wined3d_get_format(gl_info, AdapterFormat);
|
||||
DWORD UsageCaps = 0;
|
||||
|
||||
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%u,%s,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s))\n",
|
||||
|
@ -3785,7 +3789,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
if (!CheckTextureCapability(adapter, format_desc))
|
||||
if (!CheckTextureCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - Cube texture format not supported\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3807,7 +3811,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
if (!CheckRenderTargetCapability(adapter, adapter_format_desc, format_desc))
|
||||
if (!CheckRenderTargetCapability(adapter, adapter_format, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3821,7 +3825,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_FILTER)
|
||||
{
|
||||
if (!CheckFilterCapability(adapter, format_desc))
|
||||
if (!CheckFilterCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query filter support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3831,7 +3835,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
|
||||
{
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format_desc))
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3841,7 +3845,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_SRGBREAD)
|
||||
{
|
||||
if (!CheckSrgbReadCapability(adapter, format_desc))
|
||||
if (!CheckSrgbReadCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3851,7 +3855,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_SRGBWRITE)
|
||||
{
|
||||
if (!CheckSrgbWriteCapability(adapter, format_desc))
|
||||
if (!CheckSrgbWriteCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3861,7 +3865,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE)
|
||||
{
|
||||
if (!CheckVertexTextureCapability(adapter, format_desc))
|
||||
if (!CheckVertexTextureCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3871,7 +3875,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_WRAPANDMIP)
|
||||
{
|
||||
if (!CheckWrapAndMipCapability(adapter, format_desc))
|
||||
if (!CheckWrapAndMipCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3886,7 +3890,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
* - WINED3DUSAGE_NONSECURE (d3d9ex)
|
||||
* - WINED3DUSAGE_RENDERTARGET
|
||||
*/
|
||||
if (!CheckSurfaceCapability(adapter, adapter_format_desc, format_desc, SurfaceType))
|
||||
if (!CheckSurfaceCapability(adapter, adapter_format, format, SurfaceType))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - Not supported for plain surfaces\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3894,7 +3898,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
{
|
||||
if (!CheckDepthStencilCapability(adapter, adapter_format_desc, format_desc))
|
||||
if (!CheckDepthStencilCapability(adapter, adapter_format, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No depthstencil support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3904,7 +3908,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
if (!CheckRenderTargetCapability(adapter, adapter_format_desc, format_desc))
|
||||
if (!CheckRenderTargetCapability(adapter, adapter_format, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3914,7 +3918,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
|
||||
{
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format_desc))
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3941,7 +3945,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
if (!CheckTextureCapability(adapter, format_desc))
|
||||
if (!CheckTextureCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - Texture format not supported\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3963,7 +3967,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
if (!CheckRenderTargetCapability(adapter, adapter_format_desc, format_desc))
|
||||
if (!CheckRenderTargetCapability(adapter, adapter_format, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3977,7 +3981,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_FILTER)
|
||||
{
|
||||
if (!CheckFilterCapability(adapter, format_desc))
|
||||
if (!CheckFilterCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query filter support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3987,7 +3991,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP)
|
||||
{
|
||||
if (!CheckBumpMapCapability(adapter, format_desc))
|
||||
if (!CheckBumpMapCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No legacy bumpmap support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -3997,7 +4001,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
|
||||
{
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format_desc))
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4007,7 +4011,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_SRGBREAD)
|
||||
{
|
||||
if (!CheckSrgbReadCapability(adapter, format_desc))
|
||||
if (!CheckSrgbReadCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4017,7 +4021,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_SRGBWRITE)
|
||||
{
|
||||
if (!CheckSrgbWriteCapability(adapter, format_desc))
|
||||
if (!CheckSrgbWriteCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4027,7 +4031,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE)
|
||||
{
|
||||
if (!CheckVertexTextureCapability(adapter, format_desc))
|
||||
if (!CheckVertexTextureCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4037,7 +4041,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_WRAPANDMIP)
|
||||
{
|
||||
if (!CheckWrapAndMipCapability(adapter, format_desc))
|
||||
if (!CheckWrapAndMipCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4047,12 +4051,12 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
{
|
||||
if (!CheckDepthStencilCapability(adapter, adapter_format_desc, format_desc))
|
||||
if (!CheckDepthStencilCapability(adapter, adapter_format, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No depth stencil support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
if ((format_desc->Flags & WINED3DFMT_FLAG_SHADOW) && !gl_info->supported[ARB_SHADOW])
|
||||
if ((format->Flags & WINED3DFMT_FLAG_SHADOW) && !gl_info->supported[ARB_SHADOW])
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No shadow sampler support.\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4085,7 +4089,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
if (!CheckTextureCapability(adapter, format_desc))
|
||||
if (!CheckTextureCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - Format not supported\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4155,7 +4159,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_FILTER)
|
||||
{
|
||||
if (!CheckFilterCapability(adapter, format_desc))
|
||||
if (!CheckFilterCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query filter support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4165,7 +4169,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
|
||||
{
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format_desc))
|
||||
if (!CheckPostPixelShaderBlendingCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4175,7 +4179,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_SRGBREAD)
|
||||
{
|
||||
if (!CheckSrgbReadCapability(adapter, format_desc))
|
||||
if (!CheckSrgbReadCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4185,7 +4189,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_SRGBWRITE)
|
||||
{
|
||||
if (!CheckSrgbWriteCapability(adapter, format_desc))
|
||||
if (!CheckSrgbWriteCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4195,7 +4199,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE)
|
||||
{
|
||||
if (!CheckVertexTextureCapability(adapter, format_desc))
|
||||
if (!CheckVertexTextureCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -4205,7 +4209,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
if (Usage & WINED3DUSAGE_QUERY_WRAPANDMIP)
|
||||
{
|
||||
if (!CheckWrapAndMipCapability(adapter, format_desc))
|
||||
if (!CheckWrapAndMipCapability(adapter, format))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
|
|
@ -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->id != WINED3DFMT_B8G8R8A8_UNORM)
|
||||
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format_desc->id));
|
||||
if (num_untracked_materials && element->format->id != WINED3DFMT_B8G8R8A8_UNORM)
|
||||
FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format->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->id == WINED3DFMT_R32G32B32A32_FLOAT)
|
||||
|| si->elements[WINED3D_FFP_POSITION].format->id == WINED3DFMT_R32G32B32A32_FLOAT)
|
||||
&& This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
|
||||
{
|
||||
if (gl_info->supported[EXT_FOG_COORD])
|
||||
{
|
||||
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));
|
||||
if (element->format->id == WINED3DFMT_B8G8R8A8_UNORM) specular_fog = TRUE;
|
||||
else FIXME("Implement fog coordinates from %s\n", debug_d3dformat(element->format->id));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
ptr = texCoords[coord_idx] + (SkipnStrides * si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].stride);
|
||||
|
||||
texture_idx = This->texUnitMap[texture];
|
||||
multi_texcoord_funcs[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format_desc->emit_idx](
|
||||
multi_texcoord_funcs[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->emit_idx](
|
||||
GL_TEXTURE0_ARB + texture_idx, ptr);
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
if (diffuse) {
|
||||
const void *ptrToCoords = diffuse + SkipnStrides * si->elements[WINED3D_FFP_DIFFUSE].stride;
|
||||
|
||||
diffuse_funcs[si->elements[WINED3D_FFP_DIFFUSE].format_desc->emit_idx](ptrToCoords);
|
||||
diffuse_funcs[si->elements[WINED3D_FFP_DIFFUSE].format->emit_idx](ptrToCoords);
|
||||
if (num_untracked_materials)
|
||||
{
|
||||
DWORD diffuseColor = ((const DWORD *)ptrToCoords)[0];
|
||||
|
@ -274,7 +274,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
if (specular) {
|
||||
const void *ptrToCoords = specular + SkipnStrides * si->elements[WINED3D_FFP_SPECULAR].stride;
|
||||
|
||||
specular_funcs[si->elements[WINED3D_FFP_SPECULAR].format_desc->emit_idx](ptrToCoords);
|
||||
specular_funcs[si->elements[WINED3D_FFP_SPECULAR].format->emit_idx](ptrToCoords);
|
||||
|
||||
if (specular_fog)
|
||||
{
|
||||
|
@ -286,13 +286,13 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
/* Normal -------------------------------- */
|
||||
if (normal != NULL) {
|
||||
const void *ptrToCoords = normal + SkipnStrides * si->elements[WINED3D_FFP_NORMAL].stride;
|
||||
normal_funcs[si->elements[WINED3D_FFP_NORMAL].format_desc->emit_idx](ptrToCoords);
|
||||
normal_funcs[si->elements[WINED3D_FFP_NORMAL].format->emit_idx](ptrToCoords);
|
||||
}
|
||||
|
||||
/* Position -------------------------------- */
|
||||
if (position) {
|
||||
const void *ptrToCoords = position + SkipnStrides * si->elements[WINED3D_FFP_POSITION].stride;
|
||||
position_funcs[si->elements[WINED3D_FFP_POSITION].format_desc->emit_idx](ptrToCoords);
|
||||
position_funcs[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptrToCoords);
|
||||
}
|
||||
|
||||
/* For non indexed mode, step onto next parts */
|
||||
|
@ -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->id, i, ptr);
|
||||
send_attribute(This, si->elements[i].format->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->id, instancedData[j], ptr);
|
||||
send_attribute(This, si->elements[instancedData[j]].format->id, instancedData[j], ptr);
|
||||
}
|
||||
|
||||
glDrawElements(glPrimitiveType, numberOfVertices, idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
|
||||
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format_desc *format_desc,
|
||||
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
|
||||
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource;
|
||||
|
@ -38,7 +38,7 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
|
|||
resource->resourceType = resource_type;
|
||||
resource->ref = 1;
|
||||
resource->pool = pool;
|
||||
resource->format_desc = format_desc;
|
||||
resource->format = format;
|
||||
resource->usage = usage;
|
||||
resource->size = size;
|
||||
resource->priority = 0;
|
||||
|
|
|
@ -2087,7 +2087,7 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader,
|
|||
if (stateblock->renderState[WINED3DRS_SRGBWRITEENABLE])
|
||||
{
|
||||
IWineD3DSurfaceImpl *rt = device->render_targets[0];
|
||||
if(rt->resource.format_desc->Flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1;
|
||||
if(rt->resource.format->Flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1;
|
||||
}
|
||||
|
||||
args->np2_fixup = 0;
|
||||
|
@ -2101,9 +2101,9 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader,
|
|||
args->color_fixup[i] = COLOR_FIXUP_IDENTITY;
|
||||
continue;
|
||||
}
|
||||
args->color_fixup[i] = texture->resource.format_desc->color_fixup;
|
||||
args->color_fixup[i] = texture->resource.format->color_fixup;
|
||||
|
||||
if (texture->resource.format_desc->Flags & WINED3DFMT_FLAG_SHADOW)
|
||||
if (texture->resource.format->Flags & WINED3DFMT_FLAG_SHADOW)
|
||||
args->shadow |= 1 << i;
|
||||
|
||||
/* Flag samplers that need NP2 texcoord fixup. */
|
||||
|
|
|
@ -244,7 +244,7 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||
/* Disable blending in all cases even without pixelshaders. With blending on we could face a big performance penalty.
|
||||
* The d3d9 visual test confirms the behavior. */
|
||||
if (context->render_offscreen
|
||||
&& !(target->resource.format_desc->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
|
||||
&& !(target->resource.format->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
checkGLcall("glDisable GL_BLEND");
|
||||
|
@ -276,10 +276,10 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||
* returns 1.0, so D3DBLEND_DESTALPHA is GL_ONE, and D3DBLEND_INVDESTALPHA is GL_ZERO
|
||||
*/
|
||||
case WINED3DBLEND_DESTALPHA :
|
||||
dstBlend = target->resource.format_desc->alpha_mask ? GL_DST_ALPHA : GL_ONE;
|
||||
dstBlend = target->resource.format->alpha_mask ? GL_DST_ALPHA : GL_ONE;
|
||||
break;
|
||||
case WINED3DBLEND_INVDESTALPHA :
|
||||
dstBlend = target->resource.format_desc->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
||||
dstBlend = target->resource.format->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
||||
break;
|
||||
|
||||
case WINED3DBLEND_SRCALPHASAT :
|
||||
|
@ -318,10 +318,10 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||
case WINED3DBLEND_SRCALPHASAT : srcBlend = GL_SRC_ALPHA_SATURATE; break;
|
||||
|
||||
case WINED3DBLEND_DESTALPHA :
|
||||
srcBlend = target->resource.format_desc->alpha_mask ? GL_DST_ALPHA : GL_ONE;
|
||||
srcBlend = target->resource.format->alpha_mask ? GL_DST_ALPHA : GL_ONE;
|
||||
break;
|
||||
case WINED3DBLEND_INVDESTALPHA :
|
||||
srcBlend = target->resource.format_desc->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
||||
srcBlend = target->resource.format->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
||||
break;
|
||||
|
||||
case WINED3DBLEND_BOTHSRCALPHA : srcBlend = GL_SRC_ALPHA;
|
||||
|
@ -487,7 +487,7 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||
/* The surface conversion does not do color keying conversion for surfaces that have an alpha
|
||||
* channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the
|
||||
* surface has alpha bits */
|
||||
if (!surf->resource.format_desc->alpha_mask) enable_ckey = TRUE;
|
||||
if (!surf->resource.format->alpha_mask) enable_ckey = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3108,7 +3108,7 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d
|
|||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)stateblock->textures[0];
|
||||
IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0];
|
||||
|
||||
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format_desc->alpha_mask)
|
||||
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
|
||||
{
|
||||
/* Color keying needs to pass alpha values from the texture through to have the alpha test work
|
||||
* properly. On the other hand applications can still use texture combiners apparently. This code
|
||||
|
@ -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->id
|
||||
? stateblock->device->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format->id
|
||||
: WINED3DFMT_UNKNOWN,
|
||||
stateblock->device->frag_pipe->ffp_proj_control);
|
||||
|
||||
|
@ -3262,7 +3262,7 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBl
|
|||
checkGLcall("glClientActiveTextureARB");
|
||||
|
||||
/* The coords to supply depend completely on the fvf / vertex shader */
|
||||
glTexCoordPointer(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
||||
glTexCoordPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
} else {
|
||||
|
@ -4078,20 +4078,20 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
|||
i, stream_info->elements[i].stride, vb->conversion_stride);
|
||||
TRACE("Original offset %p, additional offset 0x%08x\n",
|
||||
stream_info->elements[i].data, vb->conversion_shift[(DWORD_PTR)stream_info->elements[i].data]);
|
||||
TRACE("Opengl type %#x\n", stream_info->elements[i].format_desc->gl_vtx_type);
|
||||
TRACE("Opengl type %#x\n", stream_info->elements[i].format->gl_vtx_type);
|
||||
shift_index = ((DWORD_PTR)stream_info->elements[i].data + offset[stream_info->elements[i].stream_idx]);
|
||||
shift_index = shift_index % stream_info->elements[i].stride;
|
||||
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format_desc->gl_vtx_format,
|
||||
stream_info->elements[i].format_desc->gl_vtx_type,
|
||||
stream_info->elements[i].format_desc->gl_normalized,
|
||||
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
||||
stream_info->elements[i].format->gl_vtx_type,
|
||||
stream_info->elements[i].format->gl_normalized,
|
||||
vb->conversion_stride, stream_info->elements[i].data + vb->conversion_shift[shift_index]
|
||||
+ stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
||||
+ offset[stream_info->elements[i].stream_idx]));
|
||||
|
||||
} else {
|
||||
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format_desc->gl_vtx_format,
|
||||
stream_info->elements[i].format_desc->gl_vtx_type,
|
||||
stream_info->elements[i].format_desc->gl_normalized,
|
||||
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
||||
stream_info->elements[i].format->gl_vtx_type,
|
||||
stream_info->elements[i].format->gl_normalized,
|
||||
stream_info->elements[i].stride, stream_info->elements[i].data
|
||||
+ stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
||||
+ offset[stream_info->elements[i].stream_idx]));
|
||||
|
@ -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->id)
|
||||
switch (stream_info->elements[i].format->id)
|
||||
{
|
||||
case WINED3DFMT_R32_FLOAT:
|
||||
GL_EXTCALL(glVertexAttrib1fvARB(i, (const GLfloat *)ptr));
|
||||
|
@ -4225,13 +4225,13 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
|||
|
||||
if (gl_info->supported[ARB_VERTEX_BLEND])
|
||||
{
|
||||
TRACE("Blend %d %p %d\n", e->format_desc->component_count,
|
||||
TRACE("Blend %u %p %u\n", e->format->component_count,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride, e->stride + offset[e->stream_idx]);
|
||||
|
||||
glEnableClientState(GL_WEIGHT_ARRAY_ARB);
|
||||
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
|
||||
|
||||
GL_EXTCALL(glVertexBlendARB(e->format_desc->component_count + 1));
|
||||
GL_EXTCALL(glVertexBlendARB(e->format->component_count + 1));
|
||||
|
||||
if (curVBO != e->buffer_object)
|
||||
{
|
||||
|
@ -4241,11 +4241,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
|||
}
|
||||
|
||||
TRACE("glWeightPointerARB(%#x, %#x, %#x, %p);\n",
|
||||
e->format_desc->gl_vtx_format,
|
||||
e->format_desc->gl_vtx_type,
|
||||
e->format->gl_vtx_format,
|
||||
e->format->gl_vtx_type,
|
||||
e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
GL_EXTCALL(glWeightPointerARB(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
||||
GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
||||
|
||||
checkGLcall("glWeightPointerARB");
|
||||
|
@ -4305,17 +4305,17 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
|||
*/
|
||||
if (!e->buffer_object)
|
||||
{
|
||||
TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format_desc->gl_vtx_type, e->stride,
|
||||
TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
glVertexPointer(3 /* min(e->format_desc->gl_vtx_format, 3) */, e->format_desc->gl_vtx_type, e->stride,
|
||||
glVertexPointer(3 /* min(e->format->gl_vtx_format, 3) */, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n",
|
||||
e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
||||
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
glVertexPointer(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
||||
glVertexPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
}
|
||||
checkGLcall("glVertexPointer(...)");
|
||||
|
@ -4334,9 +4334,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
|||
curVBO = e->buffer_object;
|
||||
}
|
||||
|
||||
TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format_desc->gl_vtx_type, e->stride,
|
||||
TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
glNormalPointer(e->format_desc->gl_vtx_type, e->stride,
|
||||
glNormalPointer(e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
checkGLcall("glNormalPointer(...)");
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
|
@ -4367,9 +4367,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
|||
}
|
||||
|
||||
TRACE("glColorPointer(%#x, %#x %#x, %p);\n",
|
||||
e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
||||
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
glColorPointer(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
||||
glColorPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
||||
e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
||||
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
@ -4388,8 +4388,8 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
|
|||
e = &si->elements[WINED3D_FFP_SPECULAR];
|
||||
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
||||
{
|
||||
GLenum type = e->format_desc->gl_vtx_type;
|
||||
GLint format = e->format_desc->gl_vtx_format;
|
||||
GLenum type = e->format->gl_vtx_type;
|
||||
GLint format = e->format->gl_vtx_format;
|
||||
|
||||
if (curVBO != e->buffer_object)
|
||||
{
|
||||
|
|
|
@ -350,7 +350,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
|
|||
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
void (*cleanup)(IWineD3DSurfaceImpl *This);
|
||||
unsigned int resource_size;
|
||||
HRESULT hr;
|
||||
|
@ -363,7 +363,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
|
|||
|
||||
/* FIXME: Check that the format is supported by the device. */
|
||||
|
||||
resource_size = wined3d_format_calculate_size(format_desc, alignment, width, height);
|
||||
resource_size = wined3d_format_calculate_size(format, alignment, width, height);
|
||||
|
||||
/* Look at the implementation and set the correct Vtable. */
|
||||
switch (surface_type)
|
||||
|
@ -384,7 +384,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
|
|||
}
|
||||
|
||||
hr = resource_init((IWineD3DResource *)surface, WINED3DRTYPE_SURFACE,
|
||||
device, resource_size, usage, format_desc, pool, parent, parent_ops);
|
||||
device, resource_size, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x.\n", hr);
|
||||
|
@ -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->id == WINED3DFMT_P8_UINT))
|
||||
&& (render_target->resource.format->id == WINED3DFMT_P8_UINT))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -565,21 +565,21 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device)
|
|||
/* Context activation is done by the caller. */
|
||||
static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info)
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc = This->resource.format_desc;
|
||||
const struct wined3d_format *format = This->resource.format;
|
||||
|
||||
/* Only support read back of converted P8 surfaces */
|
||||
if (This->Flags & SFLAG_CONVERTED && format_desc->id != WINED3DFMT_P8_UINT)
|
||||
if (This->Flags & SFLAG_CONVERTED && format->id != WINED3DFMT_P8_UINT)
|
||||
{
|
||||
FIXME("Readback conversion not supported for format %s.\n", debug_d3dformat(format_desc->id));
|
||||
FIXME("Readback conversion not supported for format %s.\n", debug_d3dformat(format->id));
|
||||
return;
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
if (format->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n",
|
||||
This, This->texture_level, format_desc->glFormat, format_desc->glType,
|
||||
This, This->texture_level, format->glFormat, format->glType,
|
||||
This->resource.allocatedMemory);
|
||||
|
||||
if (This->Flags & SFLAG_PBO)
|
||||
|
@ -601,21 +601,21 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
|
|||
LEAVE_GL();
|
||||
} else {
|
||||
void *mem;
|
||||
GLenum format = format_desc->glFormat;
|
||||
GLenum type = format_desc->glType;
|
||||
GLenum gl_format = format->glFormat;
|
||||
GLenum gl_type = format->glType;
|
||||
int src_pitch = 0;
|
||||
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->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device))
|
||||
if (format->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device))
|
||||
{
|
||||
format = GL_ALPHA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
gl_format = GL_ALPHA;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
if (This->Flags & SFLAG_NONPOW2) {
|
||||
unsigned char alignment = This->resource.device->surface_alignment;
|
||||
src_pitch = format_desc->byte_count * This->pow2Width;
|
||||
src_pitch = format->byte_count * This->pow2Width;
|
||||
dst_pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This);
|
||||
src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1);
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * This->pow2Height);
|
||||
|
@ -624,19 +624,19 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
|
|||
}
|
||||
|
||||
TRACE("(%p) : Calling glGetTexImage level %d, format %#x, type %#x, data %p\n",
|
||||
This, This->texture_level, format, type, mem);
|
||||
This, This->texture_level, gl_format, gl_type, mem);
|
||||
|
||||
if(This->Flags & SFLAG_PBO) {
|
||||
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
|
||||
checkGLcall("glBindBufferARB");
|
||||
|
||||
glGetTexImage(This->texture_target, This->texture_level, format, type, NULL);
|
||||
glGetTexImage(This->texture_target, This->texture_level, gl_format, gl_type, NULL);
|
||||
checkGLcall("glGetTexImage");
|
||||
|
||||
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
|
||||
checkGLcall("glBindBufferARB");
|
||||
} else {
|
||||
glGetTexImage(This->texture_target, This->texture_level, format, type, mem);
|
||||
glGetTexImage(This->texture_target, This->texture_level, gl_format, gl_type, mem);
|
||||
checkGLcall("glGetTexImage");
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
@ -717,7 +717,7 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
|
|||
* correct texture. */
|
||||
/* Context activation is done by the caller. */
|
||||
static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
|
||||
const struct wined3d_format_desc *format_desc, BOOL srgb, const GLvoid *data)
|
||||
const struct wined3d_format *format, BOOL srgb, const GLvoid *data)
|
||||
{
|
||||
GLsizei width = This->currentDesc.Width;
|
||||
GLsizei height = This->currentDesc.Height;
|
||||
|
@ -725,23 +725,23 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
|
|||
|
||||
if (srgb)
|
||||
{
|
||||
internal = format_desc->glGammaInternal;
|
||||
internal = format->glGammaInternal;
|
||||
}
|
||||
else if (This->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(This))
|
||||
{
|
||||
internal = format_desc->rtInternal;
|
||||
internal = format->rtInternal;
|
||||
}
|
||||
else
|
||||
{
|
||||
internal = format_desc->glInternal;
|
||||
internal = format->glInternal;
|
||||
}
|
||||
|
||||
TRACE("This %p, internal %#x, width %d, height %d, format %#x, type %#x, data %p.\n",
|
||||
This, internal, width, height, format_desc->glFormat, format_desc->glType, data);
|
||||
This, internal, width, height, format->glFormat, format->glType, data);
|
||||
TRACE("target %#x, level %u, resource size %u.\n",
|
||||
This->texture_target, This->texture_level, This->resource.size);
|
||||
|
||||
if (format_desc->heightscale != 1.0f && format_desc->heightscale != 0.0f) height *= format_desc->heightscale;
|
||||
if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->heightscale;
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
|
@ -754,7 +754,7 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
|
|||
data = NULL;
|
||||
}
|
||||
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
if (format->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
TRACE("Calling glCompressedTexSubImage2DARB.\n");
|
||||
|
||||
|
@ -767,7 +767,7 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
|
|||
TRACE("Calling glTexSubImage2D.\n");
|
||||
|
||||
glTexSubImage2D(This->texture_target, This->texture_level,
|
||||
0, 0, width, height, format_desc->glFormat, format_desc->glType, data);
|
||||
0, 0, width, height, format->glFormat, format->glType, data);
|
||||
checkGLcall("glTexSubImage2D");
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,7 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
|
|||
* the correct texture. */
|
||||
/* Context activation is done by the caller. */
|
||||
static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
|
||||
const struct wined3d_format_desc *format_desc, BOOL srgb)
|
||||
const struct wined3d_format *format, BOOL srgb)
|
||||
{
|
||||
BOOL enable_client_storage = FALSE;
|
||||
GLsizei width = This->pow2Width;
|
||||
|
@ -805,22 +805,22 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
|
|||
|
||||
if (srgb)
|
||||
{
|
||||
internal = format_desc->glGammaInternal;
|
||||
internal = format->glGammaInternal;
|
||||
}
|
||||
else if (This->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(This))
|
||||
{
|
||||
internal = format_desc->rtInternal;
|
||||
internal = format->rtInternal;
|
||||
}
|
||||
else
|
||||
{
|
||||
internal = format_desc->glInternal;
|
||||
internal = format->glInternal;
|
||||
}
|
||||
|
||||
if (format_desc->heightscale != 1.0f && format_desc->heightscale != 0.0f) height *= format_desc->heightscale;
|
||||
if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->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->id),
|
||||
internal, width, height, format_desc->glFormat, format_desc->glType);
|
||||
This, This->texture_target, This->texture_level, debug_d3dformat(format->id),
|
||||
internal, width, height, format->glFormat, format->glType);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
|
@ -847,7 +847,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
|
|||
}
|
||||
}
|
||||
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED && mem)
|
||||
if (format->Flags & WINED3DFMT_FLAG_COMPRESSED && mem)
|
||||
{
|
||||
GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level,
|
||||
internal, width, height, 0, This->resource.size, mem));
|
||||
|
@ -856,7 +856,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
|
|||
else
|
||||
{
|
||||
glTexImage2D(This->texture_target, This->texture_level,
|
||||
internal, width, height, 0, format_desc->glFormat, format_desc->glType, mem);
|
||||
internal, width, height, 0, format->glFormat, format->glType, mem);
|
||||
checkGLcall("glTexImage2D");
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,7 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned
|
|||
gl_info->fbo_ops.glGenRenderbuffers(1, &renderbuffer);
|
||||
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
|
||||
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER,
|
||||
surface->resource.format_desc->glInternal, width, height);
|
||||
surface->resource.format->glInternal, width, height);
|
||||
|
||||
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(renderbuffer_entry_t));
|
||||
entry->width = width;
|
||||
|
@ -989,7 +989,7 @@ void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect
|
|||
|
||||
static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD color, WINED3DCOLORVALUE *float_color)
|
||||
{
|
||||
const struct wined3d_format_desc *format = surface->resource.format_desc;
|
||||
const struct wined3d_format *format = surface->resource.format;
|
||||
IWineD3DDeviceImpl *device = surface->resource.device;
|
||||
|
||||
switch (format->id)
|
||||
|
@ -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->id == WINED3DFMT_P8_UINT
|
||||
|| surface->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
if (surface->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| surface->resource.format->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->id)
|
||||
switch (This->resource.format->id)
|
||||
{
|
||||
case WINED3DFMT_P8_UINT:
|
||||
{
|
||||
|
@ -1318,7 +1318,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
|
|||
fmt = GL_ALPHA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
mem = dest;
|
||||
bpp = This->resource.format_desc->byte_count;
|
||||
bpp = This->resource.format->byte_count;
|
||||
} else {
|
||||
/* GL can't return palettized data, so read ARGB pixels into a
|
||||
* separate block of memory and convert them into palettized format
|
||||
|
@ -1338,16 +1338,16 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
|
|||
LEAVE_GL();
|
||||
return;
|
||||
}
|
||||
bpp = This->resource.format_desc->byte_count * 3;
|
||||
bpp = This->resource.format->byte_count * 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
mem = dest;
|
||||
fmt = This->resource.format_desc->glFormat;
|
||||
type = This->resource.format_desc->glType;
|
||||
bpp = This->resource.format_desc->byte_count;
|
||||
fmt = This->resource.format->glFormat;
|
||||
type = This->resource.format->glType;
|
||||
bpp = This->resource.format->byte_count;
|
||||
}
|
||||
|
||||
if(This->Flags & SFLAG_PBO) {
|
||||
|
@ -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->id == WINED3DFMT_P8_UINT) HeapFree(GetProcessHeap(), 0, mem);
|
||||
if (This->resource.format->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->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device))
|
||||
if (This->resource.format->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device))
|
||||
{
|
||||
const PALETTEENTRY *pal = NULL;
|
||||
DWORD width = pitch / 3;
|
||||
|
@ -1532,16 +1532,16 @@ static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface,
|
|||
{
|
||||
DWORD alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED;
|
||||
CONVERT_TYPES convert;
|
||||
struct wined3d_format_desc desc;
|
||||
struct wined3d_format format;
|
||||
|
||||
if (surface->Flags & alloc_flag) return;
|
||||
|
||||
d3dfmt_get_conv(surface, TRUE, TRUE, &desc, &convert);
|
||||
if(convert != NO_CONVERSION || desc.convert) surface->Flags |= SFLAG_CONVERTED;
|
||||
d3dfmt_get_conv(surface, TRUE, TRUE, &format, &convert);
|
||||
if (convert != NO_CONVERSION || format.convert) surface->Flags |= SFLAG_CONVERTED;
|
||||
else surface->Flags &= ~SFLAG_CONVERTED;
|
||||
|
||||
surface_bind_and_dirtify(surface, srgb);
|
||||
surface_allocate_surface(surface, gl_info, &desc, srgb);
|
||||
surface_allocate_surface(surface, gl_info, &format, srgb);
|
||||
surface->Flags |= alloc_flag;
|
||||
}
|
||||
|
||||
|
@ -2043,8 +2043,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
|
|||
return hr;
|
||||
}
|
||||
|
||||
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
if (This->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format->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) */
|
||||
|
@ -2111,7 +2111,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC
|
|||
IWineD3DSurface Internal (No mapping to directx api) parts follow
|
||||
****************************************************** */
|
||||
|
||||
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, struct wined3d_format_desc *desc, CONVERT_TYPES *convert)
|
||||
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck,
|
||||
BOOL use_texturing, struct wined3d_format *format, CONVERT_TYPES *convert)
|
||||
{
|
||||
BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT);
|
||||
IWineD3DDeviceImpl *device = This->resource.device;
|
||||
|
@ -2120,28 +2121,25 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
|||
|
||||
/* Copy the default values from the surface. Below we might perform fixups */
|
||||
/* TODO: get rid of color keying desc fixups by using e.g. a table. */
|
||||
*desc = *This->resource.format_desc;
|
||||
*format = *This->resource.format;
|
||||
*convert = NO_CONVERSION;
|
||||
|
||||
/* Ok, now look if we have to do any conversion */
|
||||
switch (This->resource.format_desc->id)
|
||||
switch (This->resource.format->id)
|
||||
{
|
||||
case WINED3DFMT_P8_UINT:
|
||||
/* ****************
|
||||
Paletted Texture
|
||||
**************** */
|
||||
|
||||
/* Below the call to blit_supported is disabled for Wine 1.2 because the function isn't operating correctly yet.
|
||||
* At the moment 8-bit blits are handled in software and if certain GL extensions are around, surface conversion
|
||||
* is performed at upload time. The blit_supported call recognizes it as a destination fixup. This type of upload 'fixup'
|
||||
* and 8-bit to 8-bit blits need to be handled by the blit_shader.
|
||||
* TODO: get rid of this #if 0
|
||||
*/
|
||||
/* Below the call to blit_supported is disabled for Wine 1.2
|
||||
* because the function isn't operating correctly yet. At the
|
||||
* moment 8-bit blits are handled in software and if certain GL
|
||||
* extensions are around, surface conversion is performed at
|
||||
* upload time. The blit_supported call recognizes it as a
|
||||
* destination fixup. This type of upload 'fixup' and 8-bit to
|
||||
* 8-bit blits need to be handled by the blit_shader.
|
||||
* TODO: get rid of this #if 0. */
|
||||
#if 0
|
||||
blit_supported = device->blitter->blit_supported(&device->adapter->gl_info, BLIT_OP_BLIT,
|
||||
&rect, This->resource.usage, This->resource.pool,
|
||||
This->resource.format_desc, &rect, This->resource.usage,
|
||||
This->resource.pool, This->resource.format_desc);
|
||||
&rect, This->resource.usage, This->resource.pool, This->resource.format,
|
||||
&rect, This->resource.usage, This->resource.pool, This->resource.format);
|
||||
#endif
|
||||
blit_supported = gl_info->supported[EXT_PALETTED_TEXTURE] || gl_info->supported[ARB_FRAGMENT_PROGRAM];
|
||||
|
||||
|
@ -2154,16 +2152,15 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
|||
if (!((blit_supported && device->render_targets && This == device->render_targets[0]))
|
||||
|| colorkey_active || !use_texturing)
|
||||
{
|
||||
desc->glFormat = GL_RGBA;
|
||||
desc->glInternal = GL_RGBA;
|
||||
desc->glType = GL_UNSIGNED_BYTE;
|
||||
desc->conv_byte_count = 4;
|
||||
if(colorkey_active) {
|
||||
format->glFormat = GL_RGBA;
|
||||
format->glInternal = GL_RGBA;
|
||||
format->glType = GL_UNSIGNED_BYTE;
|
||||
format->conv_byte_count = 4;
|
||||
if (colorkey_active)
|
||||
*convert = CONVERT_PALETTED_CK;
|
||||
} else {
|
||||
else
|
||||
*convert = CONVERT_PALETTED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DFMT_B2G3R3_UNORM:
|
||||
|
@ -2178,42 +2175,46 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
|||
break;
|
||||
|
||||
case WINED3DFMT_B5G6R5_UNORM:
|
||||
if (colorkey_active) {
|
||||
if (colorkey_active)
|
||||
{
|
||||
*convert = CONVERT_CK_565;
|
||||
desc->glFormat = GL_RGBA;
|
||||
desc->glInternal = GL_RGB5_A1;
|
||||
desc->glType = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
desc->conv_byte_count = 2;
|
||||
format->glFormat = GL_RGBA;
|
||||
format->glInternal = GL_RGB5_A1;
|
||||
format->glType = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
format->conv_byte_count = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DFMT_B5G5R5X1_UNORM:
|
||||
if (colorkey_active) {
|
||||
if (colorkey_active)
|
||||
{
|
||||
*convert = CONVERT_CK_5551;
|
||||
desc->glFormat = GL_BGRA;
|
||||
desc->glInternal = GL_RGB5_A1;
|
||||
desc->glType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
desc->conv_byte_count = 2;
|
||||
format->glFormat = GL_BGRA;
|
||||
format->glInternal = GL_RGB5_A1;
|
||||
format->glType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
format->conv_byte_count = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DFMT_B8G8R8_UNORM:
|
||||
if (colorkey_active) {
|
||||
if (colorkey_active)
|
||||
{
|
||||
*convert = CONVERT_CK_RGB24;
|
||||
desc->glFormat = GL_RGBA;
|
||||
desc->glInternal = GL_RGBA8;
|
||||
desc->glType = GL_UNSIGNED_INT_8_8_8_8;
|
||||
desc->conv_byte_count = 4;
|
||||
format->glFormat = GL_RGBA;
|
||||
format->glInternal = GL_RGBA8;
|
||||
format->glType = GL_UNSIGNED_INT_8_8_8_8;
|
||||
format->conv_byte_count = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DFMT_B8G8R8X8_UNORM:
|
||||
if (colorkey_active) {
|
||||
if (colorkey_active)
|
||||
{
|
||||
*convert = CONVERT_RGB32_888;
|
||||
desc->glFormat = GL_RGBA;
|
||||
desc->glInternal = GL_RGBA8;
|
||||
desc->glType = GL_UNSIGNED_INT_8_8_8_8;
|
||||
desc->conv_byte_count = 4;
|
||||
format->glFormat = GL_RGBA;
|
||||
format->glInternal = GL_RGBA8;
|
||||
format->glType = GL_UNSIGNED_INT_8_8_8_8;
|
||||
format->conv_byte_count = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2462,8 +2463,8 @@ BOOL palette9_changed(IWineD3DSurfaceImpl *This)
|
|||
{
|
||||
IWineD3DDeviceImpl *device = This->resource.device;
|
||||
|
||||
if (This->palette || (This->resource.format_desc->id != WINED3DFMT_P8_UINT
|
||||
&& This->resource.format_desc->id != WINED3DFMT_P8_UINT_A8_UNORM))
|
||||
if (This->palette || (This->resource.format->id != WINED3DFMT_P8_UINT
|
||||
&& This->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
|
||||
|
@ -2601,8 +2602,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum
|
|||
hr = IWineD3DBaseSurfaceImpl_SetFormat(iface, format);
|
||||
if(SUCCEEDED(hr)) {
|
||||
This->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED);
|
||||
TRACE("(%p) : glFormat %d, glFormatInternal %d, glType %d\n", This, This->resource.format_desc->glFormat,
|
||||
This->resource.format_desc->glInternal, This->resource.format_desc->glType);
|
||||
TRACE("(%p) : glFormat %d, glFormatInternal %d, glType %d\n", This, This->resource.format->glFormat,
|
||||
This->resource.format->glInternal, This->resource.format->glType);
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -3193,10 +3194,8 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
|
|||
|
||||
/* Until the blit_shader is ready, define some prototypes here. */
|
||||
static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool,
|
||||
const struct wined3d_format_desc *src_format_desc,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool,
|
||||
const struct wined3d_format_desc *dst_format_desc);
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format);
|
||||
|
||||
/* Front buffer coordinates are always full screen coordinates, but our GL
|
||||
* drawable is limited to the window's client area. The sysmem and texture
|
||||
|
@ -3360,7 +3359,7 @@ HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED
|
|||
const struct blit_shader *blitter;
|
||||
|
||||
blitter = wined3d_select_blitter(&device->adapter->gl_info, BLIT_OP_COLOR_FILL,
|
||||
NULL, 0, 0, NULL, rect, s->resource.usage, s->resource.pool, s->resource.format_desc);
|
||||
NULL, 0, 0, NULL, rect, s->resource.usage, s->resource.pool, s->resource.format);
|
||||
if (!blitter)
|
||||
{
|
||||
FIXME("No blitter is capable of performing the requested color fill operation.\n");
|
||||
|
@ -3547,8 +3546,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
|
|||
BOOL stretchx;
|
||||
|
||||
/* P8 read back is not implemented */
|
||||
if (src_surface->resource.format_desc->id == WINED3DFMT_P8_UINT
|
||||
|| dst_surface->resource.format_desc->id == WINED3DFMT_P8_UINT)
|
||||
if (src_surface->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| dst_surface->resource.format->id == WINED3DFMT_P8_UINT)
|
||||
{
|
||||
TRACE("P8 read back not supported by frame buffer to texture blit\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -3582,8 +3581,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
|
|||
* backends.
|
||||
*/
|
||||
if (fbo_blit_supported(gl_info, BLIT_OP_BLIT,
|
||||
&src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format_desc,
|
||||
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format_desc))
|
||||
&src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
|
||||
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
|
||||
{
|
||||
surface_blt_fbo(device, Filter,
|
||||
src_surface, SFLAG_INDRAWABLE, &src_rect,
|
||||
|
@ -3625,9 +3624,9 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
|
|||
if (!(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE))
|
||||
&& fbo_blit_supported(gl_info, BLIT_OP_BLIT,
|
||||
&src_rect, src_surface->resource.usage, src_surface->resource.pool,
|
||||
src_surface->resource.format_desc,
|
||||
src_surface->resource.format,
|
||||
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool,
|
||||
dst_surface->resource.format_desc))
|
||||
dst_surface->resource.format))
|
||||
{
|
||||
TRACE("Using surface_blt_fbo.\n");
|
||||
/* The source is always a texture, but never the currently active render target, and the texture
|
||||
|
@ -3642,9 +3641,9 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
|
|||
if (!(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE))
|
||||
&& arbfp_blit.blit_supported(gl_info, BLIT_OP_BLIT,
|
||||
&src_rect, src_surface->resource.usage, src_surface->resource.pool,
|
||||
src_surface->resource.format_desc,
|
||||
src_surface->resource.format,
|
||||
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool,
|
||||
dst_surface->resource.format_desc))
|
||||
dst_surface->resource.format))
|
||||
{
|
||||
return arbfp_blit_surface(device, src_surface, &src_rect, dst_surface, &dst_rect, BLIT_OP_BLIT, Filter);
|
||||
}
|
||||
|
@ -3678,8 +3677,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
|
|||
surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect);
|
||||
|
||||
if (!device->blitter->blit_supported(gl_info, BLIT_OP_BLIT,
|
||||
&src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format_desc,
|
||||
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format_desc))
|
||||
&src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
|
||||
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
|
||||
{
|
||||
FIXME("Unsupported blit operation falling back to software\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -3770,7 +3769,7 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D
|
|||
|
||||
if (Flags & WINEDDBLT_DEPTHFILL)
|
||||
{
|
||||
switch (This->resource.format_desc->id)
|
||||
switch (This->resource.format->id)
|
||||
{
|
||||
case WINED3DFMT_D16_UNORM:
|
||||
depth = (float) DDBltFx->u5.dwFillDepth / (float) 0x0000ffff;
|
||||
|
@ -3787,7 +3786,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->id));
|
||||
ERR("Unexpected format for depth fill: %s.\n", debug_d3dformat(This->resource.format->id));
|
||||
}
|
||||
|
||||
return IWineD3DDevice_Clear((IWineD3DDevice *)device, DestRect ? 1 : 0, DestRect,
|
||||
|
@ -3913,8 +3912,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)
|
|||
|
||||
if (!pal) return WINED3D_OK;
|
||||
|
||||
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
if (This->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
{
|
||||
if (This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
|
@ -3980,9 +3979,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
|
|||
This->pow2Width = pow2Width;
|
||||
This->pow2Height = pow2Height;
|
||||
|
||||
if (pow2Width > This->currentDesc.Width || pow2Height > This->currentDesc.Height) {
|
||||
/** TODO: add support for non power two compressed textures **/
|
||||
if (This->resource.format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
if (pow2Width > This->currentDesc.Width || pow2Height > This->currentDesc.Height)
|
||||
{
|
||||
/* TODO: Add support for non power two compressed textures. */
|
||||
if (This->resource.format->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n",
|
||||
This, This->currentDesc.Width, This->currentDesc.Height);
|
||||
|
@ -4021,7 +4021,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->id == WINED3DFMT_P8_UINT
|
||||
&& !(This->resource.format->id == WINED3DFMT_P8_UINT
|
||||
&& gl_info->supported[EXT_PALETTED_TEXTURE]
|
||||
&& wined3d_settings.rendertargetlock_mode == RTL_READTEX))
|
||||
{
|
||||
|
@ -4185,7 +4185,7 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte
|
|||
bind_target = GL_TEXTURE_2D;
|
||||
}
|
||||
glBindTexture(bind_target, device->depth_blt_texture);
|
||||
glCopyTexImage2D(bind_target, surface->texture_level, surface->resource.format_desc->glInternal,
|
||||
glCopyTexImage2D(bind_target, surface->texture_level, surface->resource.format->glInternal,
|
||||
0, 0, surface->currentDesc.Width, surface->currentDesc.Height, 0);
|
||||
glTexParameteri(bind_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(bind_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -4367,7 +4367,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
IWineD3DDeviceImpl *device = surface->resource.device;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
BOOL drawable_read_ok = surface_is_offscreen(surface);
|
||||
struct wined3d_format_desc desc;
|
||||
struct wined3d_format format;
|
||||
CONVERT_TYPES convert;
|
||||
int width, pitch, outpitch;
|
||||
BYTE *mem;
|
||||
|
@ -4462,7 +4462,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
}
|
||||
|
||||
d3dfmt_get_conv(surface, FALSE /* We need color keying */,
|
||||
FALSE /* We won't use textures */, &desc, &convert);
|
||||
FALSE /* We won't use textures */, &format, &convert);
|
||||
|
||||
/* The width is in 'length' not in bytes */
|
||||
width = surface->currentDesc.Width;
|
||||
|
@ -4484,7 +4484,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
if ((convert != NO_CONVERSION) && surface->resource.allocatedMemory)
|
||||
{
|
||||
int height = surface->currentDesc.Height;
|
||||
byte_count = desc.conv_byte_count;
|
||||
byte_count = format.conv_byte_count;
|
||||
|
||||
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
|
||||
outpitch = width * byte_count;
|
||||
|
@ -4504,10 +4504,10 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
{
|
||||
surface->Flags &= ~SFLAG_CONVERTED;
|
||||
mem = surface->resource.allocatedMemory;
|
||||
byte_count = desc.byte_count;
|
||||
byte_count = format.byte_count;
|
||||
}
|
||||
|
||||
flush_to_framebuffer_drawpixels(surface, desc.glFormat, desc.glType, byte_count, mem);
|
||||
flush_to_framebuffer_drawpixels(surface, format.glFormat, format.glType, byte_count, mem);
|
||||
|
||||
/* Don't delete PBO memory */
|
||||
if ((mem != surface->resource.allocatedMemory) && !(surface->Flags & SFLAG_PBO))
|
||||
|
@ -4523,10 +4523,10 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
read_from_framebuffer_texture(surface, flag == SFLAG_INSRGBTEX);
|
||||
}
|
||||
else if (surface->Flags & (SFLAG_INSRGBTEX | SFLAG_INTEXTURE)
|
||||
&& (surface->resource.format_desc->Flags & attach_flags) == attach_flags
|
||||
&& (surface->resource.format->Flags & attach_flags) == attach_flags
|
||||
&& fbo_blit_supported(gl_info, BLIT_OP_BLIT,
|
||||
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format_desc,
|
||||
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format_desc))
|
||||
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format,
|
||||
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format))
|
||||
{
|
||||
DWORD src_location = flag == SFLAG_INSRGBTEX ? SFLAG_INTEXTURE : SFLAG_INSRGBTEX;
|
||||
RECT rect = {0, 0, surface->currentDesc.Width, surface->currentDesc.Height};
|
||||
|
@ -4541,7 +4541,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
struct wined3d_context *context = NULL;
|
||||
|
||||
d3dfmt_get_conv(surface, TRUE /* We need color keying */,
|
||||
TRUE /* We will use textures */, &desc, &convert);
|
||||
TRUE /* We will use textures */, &format, &convert);
|
||||
|
||||
if (srgb)
|
||||
{
|
||||
|
@ -4586,19 +4586,19 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
|
||||
/* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED
|
||||
* but it isn't set (yet) in all cases it is getting called. */
|
||||
if ((convert != NO_CONVERSION || desc.convert) && (surface->Flags & SFLAG_PBO))
|
||||
if ((convert != NO_CONVERSION || format.convert) && (surface->Flags & SFLAG_PBO))
|
||||
{
|
||||
TRACE("Removing the pbo attached to surface %p.\n", surface);
|
||||
surface_remove_pbo(surface, gl_info);
|
||||
}
|
||||
|
||||
if (desc.convert)
|
||||
if (format.convert)
|
||||
{
|
||||
/* This code is entered for texture formats which need a fixup. */
|
||||
int height = surface->currentDesc.Height;
|
||||
|
||||
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
|
||||
outpitch = width * desc.conv_byte_count;
|
||||
outpitch = width * format.conv_byte_count;
|
||||
outpitch = (outpitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1);
|
||||
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height);
|
||||
|
@ -4607,7 +4607,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
if (context) context_release(context);
|
||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
desc.convert(surface->resource.allocatedMemory, mem, pitch, width, height);
|
||||
format.convert(surface->resource.allocatedMemory, mem, pitch, width, height);
|
||||
}
|
||||
else if (convert != NO_CONVERSION && surface->resource.allocatedMemory)
|
||||
{
|
||||
|
@ -4615,7 +4615,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
int height = surface->currentDesc.Height;
|
||||
|
||||
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
|
||||
outpitch = width * desc.conv_byte_count;
|
||||
outpitch = width * format.conv_byte_count;
|
||||
outpitch = (outpitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1);
|
||||
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height);
|
||||
|
@ -4638,7 +4638,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
|||
LEAVE_GL();
|
||||
|
||||
if (mem || (surface->Flags & SFLAG_PBO))
|
||||
surface_upload_data(surface, gl_info, &desc, srgb, mem);
|
||||
surface_upload_data(surface, gl_info, &format, srgb, mem);
|
||||
|
||||
/* Restore the default pitch */
|
||||
ENTER_GL();
|
||||
|
@ -4780,7 +4780,7 @@ static HRESULT ffp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface)
|
|||
{
|
||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
enum complex_fixup fixup = get_complex_fixup(surface->resource.format_desc->color_fixup);
|
||||
enum complex_fixup fixup = get_complex_fixup(surface->resource.format->color_fixup);
|
||||
|
||||
/* When EXT_PALETTED_TEXTURE is around, palette conversion is done by the GPU
|
||||
* else the surface is converted in software at upload time in LoadLocation.
|
||||
|
@ -4818,10 +4818,8 @@ static void ffp_blit_unset(IWineD3DDevice *iface)
|
|||
}
|
||||
|
||||
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool,
|
||||
const struct wined3d_format_desc *src_format_desc,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool,
|
||||
const struct wined3d_format_desc *dst_format_desc)
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format)
|
||||
{
|
||||
enum complex_fixup src_fixup;
|
||||
|
||||
|
@ -4836,11 +4834,11 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
src_fixup = get_complex_fixup(src_format_desc->color_fixup);
|
||||
src_fixup = get_complex_fixup(src_format->color_fixup);
|
||||
if (TRACE_ON(d3d_surface) && TRACE_ON(d3d))
|
||||
{
|
||||
TRACE("Checking support for fixup:\n");
|
||||
dump_color_fixup_desc(src_format_desc->color_fixup);
|
||||
dump_color_fixup_desc(src_format->color_fixup);
|
||||
}
|
||||
|
||||
if (blit_op != BLIT_OP_BLIT)
|
||||
|
@ -4849,7 +4847,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!is_identity_fixup(dst_format_desc->color_fixup))
|
||||
if (!is_identity_fixup(dst_format->color_fixup))
|
||||
{
|
||||
TRACE("Destination fixups are not supported\n");
|
||||
return FALSE;
|
||||
|
@ -4862,7 +4860,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
|
|||
}
|
||||
|
||||
/* We only support identity conversions. */
|
||||
if (is_identity_fixup(src_format_desc->color_fixup))
|
||||
if (is_identity_fixup(src_format->color_fixup))
|
||||
{
|
||||
TRACE("[OK]\n");
|
||||
return TRUE;
|
||||
|
@ -4912,10 +4910,8 @@ static void cpu_blit_unset(IWineD3DDevice *iface)
|
|||
}
|
||||
|
||||
static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool,
|
||||
const struct wined3d_format_desc *src_format_desc,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool,
|
||||
const struct wined3d_format_desc *dst_format_desc)
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format)
|
||||
{
|
||||
if (blit_op == BLIT_OP_COLOR_FILL)
|
||||
{
|
||||
|
@ -4932,7 +4928,7 @@ static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceIm
|
|||
|
||||
memset(&BltFx, 0, sizeof(BltFx));
|
||||
BltFx.dwSize = sizeof(BltFx);
|
||||
BltFx.u5.dwFillColor = wined3d_format_convert_from_float(dst_surface->resource.format_desc, color);
|
||||
BltFx.u5.dwFillColor = wined3d_format_convert_from_float(dst_surface->resource.format, color);
|
||||
return IWineD3DBaseSurfaceImpl_Blt((IWineD3DSurface*)dst_surface, dst_rect,
|
||||
NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
|
||||
}
|
||||
|
@ -4947,10 +4943,8 @@ const struct blit_shader cpu_blit = {
|
|||
};
|
||||
|
||||
static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool,
|
||||
const struct wined3d_format_desc *src_format_desc,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool,
|
||||
const struct wined3d_format_desc *dst_format_desc)
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format)
|
||||
{
|
||||
if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
|
||||
return FALSE;
|
||||
|
@ -4965,17 +4959,17 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
|
|||
if (src_pool == WINED3DPOOL_SYSTEMMEM || dst_pool == WINED3DPOOL_SYSTEMMEM)
|
||||
return FALSE;
|
||||
|
||||
if(!((src_format_desc->Flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (src_usage & WINED3DUSAGE_RENDERTARGET))
|
||||
&& ((dst_format_desc->Flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (dst_usage & WINED3DUSAGE_RENDERTARGET)))
|
||||
if (!((src_format->Flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (src_usage & WINED3DUSAGE_RENDERTARGET))
|
||||
&& ((dst_format->Flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (dst_usage & WINED3DUSAGE_RENDERTARGET)))
|
||||
return FALSE;
|
||||
|
||||
if (!is_identity_fixup(src_format_desc->color_fixup) ||
|
||||
!is_identity_fixup(dst_format_desc->color_fixup))
|
||||
if (!is_identity_fixup(src_format->color_fixup)
|
||||
|| !is_identity_fixup(dst_format->color_fixup))
|
||||
return FALSE;
|
||||
|
||||
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))))
|
||||
if (!(src_format->id == dst_format->id
|
||||
|| (is_identity_fixup(src_format->color_fixup)
|
||||
&& is_identity_fixup(dst_format->color_fixup))))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -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->id;
|
||||
pDesc->format = This->resource.format->id;
|
||||
pDesc->resource_type = This->resource.resourceType;
|
||||
pDesc->usage = This->resource.usage;
|
||||
pDesc->pool = This->resource.pool;
|
||||
|
@ -303,24 +303,24 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
|
||||
DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
const struct wined3d_format_desc *format_desc = This->resource.format_desc;
|
||||
const struct wined3d_format *format = This->resource.format;
|
||||
DWORD ret;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if ((format_desc->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH))
|
||||
== WINED3DFMT_FLAG_COMPRESSED)
|
||||
if ((format->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
/* Since compressed formats are block based, pitch means the amount of
|
||||
* bytes to the next row of block rather than the next row of pixels. */
|
||||
UINT row_block_count = (This->currentDesc.Width + format_desc->block_width - 1) / format_desc->block_width;
|
||||
ret = row_block_count * format_desc->block_byte_count;
|
||||
UINT row_block_count = (This->currentDesc.Width + format->block_width - 1) / format->block_width;
|
||||
ret = row_block_count * format->block_byte_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char alignment = This->resource.device->surface_alignment;
|
||||
ret = This->resource.format_desc->byte_count * This->currentDesc.Width; /* Bytes / row */
|
||||
ret = This->resource.format->byte_count * This->currentDesc.Width; /* Bytes / row */
|
||||
ret = (ret + alignment - 1) & ~(alignment - 1);
|
||||
}
|
||||
TRACE("(%p) Returning %d\n", This, ret);
|
||||
|
@ -470,32 +470,32 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD
|
|||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wined3d_format_id format_id)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id,
|
||||
&This->resource.device->adapter->gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(&This->resource.device->adapter->gl_info, format_id);
|
||||
|
||||
if (This->resource.format_desc->id != WINED3DFMT_UNKNOWN)
|
||||
if (This->resource.format->id != WINED3DFMT_UNKNOWN)
|
||||
{
|
||||
FIXME("(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN\n", This);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
TRACE("(%p) : Setting texture format to (%d,%s)\n", This, format_id, debug_d3dformat(format_id));
|
||||
TRACE("(%p) : Setting texture format to %s (%#x).\n", This, debug_d3dformat(format_id), format_id);
|
||||
|
||||
This->resource.size = wined3d_format_calculate_size(format_desc, This->resource.device->surface_alignment,
|
||||
This->resource.size = wined3d_format_calculate_size(format, This->resource.device->surface_alignment,
|
||||
This->pow2Width, This->pow2Height);
|
||||
|
||||
This->Flags |= (WINED3DFMT_D16_LOCKABLE == format_id) ? SFLAG_LOCKABLE : 0;
|
||||
|
||||
This->resource.format_desc = format_desc;
|
||||
This->resource.format = format;
|
||||
|
||||
TRACE("(%p) : Size %d, bytesPerPixel %d\n", This, This->resource.size, format_desc->byte_count);
|
||||
TRACE("(%p) : Size %d, bytesPerPixel %d\n", This, This->resource.size, format->byte_count);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
||||
HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
const struct wined3d_format_desc *format_desc = This->resource.format_desc;
|
||||
const struct wined3d_format *format = This->resource.format;
|
||||
int extraline = 0;
|
||||
SYSTEM_INFO sysInfo;
|
||||
BITMAPINFO* b_info;
|
||||
|
@ -503,13 +503,13 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
|||
DWORD *masks;
|
||||
UINT usage;
|
||||
|
||||
if(!(format_desc->Flags & WINED3DFMT_FLAG_GETDC))
|
||||
if (!(format->Flags & WINED3DFMT_FLAG_GETDC))
|
||||
{
|
||||
WARN("Cannot use GetDC on a %s surface\n", debug_d3dformat(format_desc->id));
|
||||
WARN("Cannot use GetDC on a %s surface\n", debug_d3dformat(format->id));
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
switch (format_desc->byte_count)
|
||||
switch (format->byte_count)
|
||||
{
|
||||
case 2:
|
||||
case 4:
|
||||
|
@ -524,7 +524,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
|||
default:
|
||||
/* Allocate extra space for a palette. */
|
||||
b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << (format_desc->byte_count * 8)));
|
||||
sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << (format->byte_count * 8)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -544,11 +544,11 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
|||
|
||||
b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
/* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */
|
||||
b_info->bmiHeader.biWidth = IWineD3DSurface_GetPitch(iface) / format_desc->byte_count;
|
||||
b_info->bmiHeader.biWidth = IWineD3DSurface_GetPitch(iface) / format->byte_count;
|
||||
b_info->bmiHeader.biHeight = -This->currentDesc.Height -extraline;
|
||||
b_info->bmiHeader.biSizeImage = ( This->currentDesc.Height + extraline) * IWineD3DSurface_GetPitch(iface);
|
||||
b_info->bmiHeader.biPlanes = 1;
|
||||
b_info->bmiHeader.biBitCount = format_desc->byte_count * 8;
|
||||
b_info->bmiHeader.biBitCount = format->byte_count * 8;
|
||||
|
||||
b_info->bmiHeader.biXPelsPerMeter = 0;
|
||||
b_info->bmiHeader.biYPelsPerMeter = 0;
|
||||
|
@ -557,7 +557,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
|||
|
||||
/* Get the bit masks */
|
||||
masks = (DWORD *)b_info->bmiColors;
|
||||
switch (This->resource.format_desc->id)
|
||||
switch (This->resource.format->id)
|
||||
{
|
||||
case WINED3DFMT_B8G8R8_UNORM:
|
||||
usage = DIB_RGB_COLORS;
|
||||
|
@ -578,9 +578,9 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
|||
case WINED3DFMT_R16G16B16A16_UNORM:
|
||||
usage = 0;
|
||||
b_info->bmiHeader.biCompression = BI_BITFIELDS;
|
||||
masks[0] = format_desc->red_mask;
|
||||
masks[1] = format_desc->green_mask;
|
||||
masks[2] = format_desc->blue_mask;
|
||||
masks[0] = format->red_mask;
|
||||
masks[1] = format->green_mask;
|
||||
masks[2] = format->blue_mask;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -802,11 +802,11 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
|
|||
WINED3DLOCKED_RECT lock_src, lock_dst;
|
||||
HRESULT hr;
|
||||
|
||||
conv = find_convertor(source->resource.format_desc->id, to_fmt);
|
||||
conv = find_convertor(source->resource.format->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));
|
||||
debug_d3dformat(source->resource.format->id), debug_d3dformat(to_fmt));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
|||
HRESULT ret = WINED3D_OK;
|
||||
WINED3DLOCKED_RECT dlock, slock;
|
||||
int bpp, srcheight, srcwidth, dstheight, dstwidth, width;
|
||||
const struct wined3d_format_desc *sEntry, *dEntry;
|
||||
const struct wined3d_format *sEntry, *dEntry;
|
||||
int x, y;
|
||||
const BYTE *sbuf;
|
||||
BYTE *dbuf;
|
||||
|
@ -1095,15 +1095,15 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
|||
{
|
||||
IWineD3DSurface_LockRect(iface, &dlock, NULL, 0);
|
||||
slock = dlock;
|
||||
sEntry = This->resource.format_desc;
|
||||
sEntry = This->resource.format;
|
||||
dEntry = sEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
dEntry = This->resource.format_desc;
|
||||
dEntry = This->resource.format;
|
||||
if (src)
|
||||
{
|
||||
if (This->resource.format_desc->id != src->resource.format_desc->id)
|
||||
if (This->resource.format->id != src->resource.format->id)
|
||||
{
|
||||
src = surface_convert_format(src, dEntry->id);
|
||||
if (!src)
|
||||
|
@ -1114,7 +1114,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
|||
}
|
||||
}
|
||||
IWineD3DSurface_LockRect((IWineD3DSurface *)src, &slock, NULL, WINED3DLOCK_READONLY);
|
||||
sEntry = src->resource.format_desc;
|
||||
sEntry = src->resource.format;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1137,7 +1137,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
|||
}
|
||||
}
|
||||
|
||||
bpp = This->resource.format_desc->byte_count;
|
||||
bpp = This->resource.format->byte_count;
|
||||
srcheight = xsrc.bottom - xsrc.top;
|
||||
srcwidth = xsrc.right - xsrc.left;
|
||||
dstheight = xdst.bottom - xdst.top;
|
||||
|
@ -1561,7 +1561,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
RECT lock_src, lock_dst, lock_union;
|
||||
const BYTE *sbuf;
|
||||
BYTE *dbuf;
|
||||
const struct wined3d_format_desc *sEntry, *dEntry;
|
||||
const struct wined3d_format *sEntry, *dEntry;
|
||||
|
||||
TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
|
||||
iface, dstx, dsty, src_surface, wine_dbgstr_rect(rsrc), trans);
|
||||
|
@ -1614,7 +1614,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
lock_dst.right = dstx + w;
|
||||
lock_dst.bottom = dsty + h;
|
||||
|
||||
bpp = This->resource.format_desc->byte_count;
|
||||
bpp = This->resource.format->byte_count;
|
||||
|
||||
/* We need to lock the surfaces, or we won't get refreshes when done. */
|
||||
if (src == This)
|
||||
|
@ -1633,7 +1633,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
/* Since slock was originally copied from this surface's description, we can just reuse it */
|
||||
sbuf = This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
|
||||
dbuf = This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
|
||||
sEntry = src->resource.format_desc;
|
||||
sEntry = src->resource.format;
|
||||
dEntry = sEntry;
|
||||
}
|
||||
else
|
||||
|
@ -1647,8 +1647,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
dbuf = dlock.pBits;
|
||||
TRACE("Dst is at %p, Src is at %p\n", dbuf, sbuf);
|
||||
|
||||
sEntry = src->resource.format_desc;
|
||||
dEntry = This->resource.format_desc;
|
||||
sEntry = src->resource.format;
|
||||
dEntry = This->resource.format;
|
||||
}
|
||||
|
||||
/* Handle compressed surfaces first... */
|
||||
|
@ -1661,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->id != This->resource.format_desc->id)
|
||||
if (src->resource.format->id != This->resource.format->id)
|
||||
{
|
||||
FIXME("compressed -> compressed copy only supported for the same type of surface\n");
|
||||
ret = WINED3DERR_WRONGTEXTUREFORMAT;
|
||||
|
@ -1690,9 +1690,9 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
if (trans & (WINEDDBLTFAST_SRCCOLORKEY | WINEDDBLTFAST_DESTCOLORKEY))
|
||||
{
|
||||
DWORD keylow, keyhigh;
|
||||
DWORD mask = src->resource.format_desc->red_mask
|
||||
| src->resource.format_desc->green_mask
|
||||
| src->resource.format_desc->blue_mask;
|
||||
DWORD mask = src->resource.format->red_mask
|
||||
| src->resource.format->green_mask
|
||||
| src->resource.format->blue_mask;
|
||||
|
||||
/* For some 8-bit formats like L8 and P8 color masks don't make sense */
|
||||
if(!mask && bpp==1)
|
||||
|
@ -1829,25 +1829,24 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
|
|||
}
|
||||
else
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc = This->resource.format_desc;
|
||||
const struct wined3d_format *format = This->resource.format;
|
||||
|
||||
TRACE("Lock Rect (%p) = l %d, t %d, r %d, b %d\n",
|
||||
pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
||||
|
||||
if ((format_desc->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH))
|
||||
== WINED3DFMT_FLAG_COMPRESSED)
|
||||
if ((format->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
/* Compressed textures are block based, so calculate the offset of
|
||||
* the block that contains the top-left pixel of the locked rectangle. */
|
||||
pLockedRect->pBits = This->resource.allocatedMemory
|
||||
+ ((pRect->top / format_desc->block_height) * pLockedRect->Pitch)
|
||||
+ ((pRect->left / format_desc->block_width) * format_desc->block_byte_count);
|
||||
+ ((pRect->top / format->block_height) * pLockedRect->Pitch)
|
||||
+ ((pRect->left / format->block_width) * format->block_byte_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
pLockedRect->pBits = This->resource.allocatedMemory +
|
||||
(pLockedRect->Pitch * pRect->top) +
|
||||
(pRect->left * format_desc->byte_count);
|
||||
(pRect->left * format->byte_count);
|
||||
}
|
||||
This->lockedRect.left = pRect->left;
|
||||
This->lockedRect.top = pRect->top;
|
||||
|
|
|
@ -289,8 +289,8 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
|
|||
return hr;
|
||||
}
|
||||
|
||||
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
if (This->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
{
|
||||
unsigned int n;
|
||||
const PALETTEENTRY *pal = NULL;
|
||||
|
|
|
@ -117,7 +117,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
|
|||
GetClientRect(This->win_handle, &win_rect);
|
||||
win_h = win_rect.bottom - win_rect.top;
|
||||
|
||||
if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format_desc->color_fixup))
|
||||
if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup))
|
||||
{
|
||||
ENTER_GL();
|
||||
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, SFLAG_INTEXTURE);
|
||||
|
@ -161,7 +161,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
|
|||
tex_bottom /= src_h;
|
||||
}
|
||||
|
||||
if (is_complex_fixup(backbuffer->resource.format_desc->color_fixup))
|
||||
if (is_complex_fixup(backbuffer->resource.format->color_fixup))
|
||||
gl_filter = GL_NEAREST;
|
||||
|
||||
ENTER_GL();
|
||||
|
@ -261,7 +261,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||
cursor.resource.ref = 1;
|
||||
cursor.resource.device = This->device;
|
||||
cursor.resource.pool = WINED3DPOOL_SCRATCH;
|
||||
cursor.resource.format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
|
||||
cursor.resource.format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
|
||||
cursor.resource.resourceType = WINED3DRTYPE_SURFACE;
|
||||
cursor.texture_name = This->device->cursorTexture;
|
||||
cursor.texture_target = GL_TEXTURE_2D;
|
||||
|
@ -625,7 +625,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
|
|||
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent)
|
||||
{
|
||||
const struct wined3d_adapter *adapter = device->adapter;
|
||||
const struct wined3d_format_desc *format_desc;
|
||||
const struct wined3d_format *format;
|
||||
BOOL displaymode_set = FALSE;
|
||||
WINED3DDISPLAYMODE mode;
|
||||
RECT client_rect;
|
||||
|
@ -679,7 +679,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
|
|||
swapchain->orig_width = mode.Width;
|
||||
swapchain->orig_height = mode.Height;
|
||||
swapchain->orig_fmt = mode.Format;
|
||||
format_desc = getFormatDescEntry(mode.Format, &adapter->gl_info);
|
||||
format = wined3d_get_format(&adapter->gl_info, mode.Format);
|
||||
|
||||
GetClientRect(window, &client_rect);
|
||||
if (present_parameters->Windowed
|
||||
|
@ -795,7 +795,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
|
|||
* issue needs to be fixed. */
|
||||
for (i = 0; i < (sizeof(formats) / sizeof(*formats)); i++)
|
||||
{
|
||||
swapchain->ds_format = getFormatDescEntry(formats[i], gl_info);
|
||||
swapchain->ds_format = wined3d_get_format(gl_info, formats[i]);
|
||||
swapchain->context[0] = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format);
|
||||
if (swapchain->context[0]) break;
|
||||
TRACE("Depth stencil format %s is not supported, trying next format\n",
|
||||
|
@ -886,7 +886,7 @@ err:
|
|||
memset(&devmode, 0, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(devmode);
|
||||
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
devmode.dmBitsPerPel = format_desc->byte_count * 8;
|
||||
devmode.dmBitsPerPel = format->byte_count * CHAR_BIT;
|
||||
devmode.dmPelsWidth = swapchain->orig_width;
|
||||
devmode.dmPelsHeight = swapchain->orig_height;
|
||||
ChangeDisplaySettingsExW(adapter->DeviceName, &devmode, NULL, CDS_FULLSCREEN, NULL);
|
||||
|
|
|
@ -66,8 +66,8 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
|
|||
context = context_acquire(device, NULL);
|
||||
}
|
||||
|
||||
if (This->resource.format_desc->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format_desc->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
if (This->resource.format->id == WINED3DFMT_P8_UINT
|
||||
|| This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
|
||||
{
|
||||
for (i = 0; i < This->baseTexture.level_count; ++i)
|
||||
{
|
||||
|
@ -466,7 +466,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
|
|||
IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
UINT pow2_width, pow2_height;
|
||||
UINT tmp_w, tmp_h;
|
||||
unsigned int i;
|
||||
|
@ -530,7 +530,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
|
|||
texture->lpVtbl = &IWineD3DTexture_Vtbl;
|
||||
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 1, levels,
|
||||
WINED3DRTYPE_TEXTURE, device, 0, usage, format_desc, pool, parent, parent_ops);
|
||||
WINED3DRTYPE_TEXTURE, device, 0, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize basetexture, returning %#x.\n", hr);
|
||||
|
@ -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->id == WINED3DFMT_P8_UINT && gl_info->supported[EXT_PALETTED_TEXTURE]
|
||||
&& !(format->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;
|
||||
|
@ -564,7 +564,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
|
|||
texture->target = GL_TEXTURE_RECTANGLE_ARB;
|
||||
texture->cond_np2 = TRUE;
|
||||
|
||||
if(texture->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING)
|
||||
if(texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING)
|
||||
{
|
||||
texture->baseTexture.minMipLookup = minMipLookup_noMip;
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
|
|||
|
||||
/* Use the callback to create the texture surface. */
|
||||
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h,
|
||||
format_desc->id, usage, pool, i, 0, &surface);
|
||||
format->id, usage, pool, i, 0, &surface);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
FIXME("Failed to create surface %p, hr %#x\n", texture, hr);
|
||||
|
|
|
@ -882,8 +882,8 @@ static BOOL init_format_base_info(struct wined3d_gl_info *gl_info)
|
|||
UINT format_count = sizeof(formats) / sizeof(*formats);
|
||||
UINT i;
|
||||
|
||||
gl_info->gl_formats = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, format_count * sizeof(*gl_info->gl_formats));
|
||||
if (!gl_info->gl_formats)
|
||||
gl_info->formats = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, format_count * sizeof(*gl_info->formats));
|
||||
if (!gl_info->formats)
|
||||
{
|
||||
ERR("Failed to allocate memory.\n");
|
||||
return FALSE;
|
||||
|
@ -891,15 +891,15 @@ 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->id = formats[i].id;
|
||||
desc->red_mask = formats[i].redMask;
|
||||
desc->green_mask = formats[i].greenMask;
|
||||
desc->blue_mask = formats[i].blueMask;
|
||||
desc->alpha_mask = formats[i].alphaMask;
|
||||
desc->byte_count = formats[i].bpp;
|
||||
desc->depth_size = formats[i].depthSize;
|
||||
desc->stencil_size = formats[i].stencilSize;
|
||||
struct wined3d_format *format = &gl_info->formats[i];
|
||||
format->id = formats[i].id;
|
||||
format->red_mask = formats[i].redMask;
|
||||
format->green_mask = formats[i].greenMask;
|
||||
format->blue_mask = formats[i].blueMask;
|
||||
format->alpha_mask = formats[i].alphaMask;
|
||||
format->byte_count = formats[i].bpp;
|
||||
format->depth_size = formats[i].depthSize;
|
||||
format->stencil_size = formats[i].stencilSize;
|
||||
}
|
||||
|
||||
for (i = 0; i < (sizeof(format_base_flags) / sizeof(*format_base_flags)); ++i)
|
||||
|
@ -910,11 +910,11 @@ static BOOL init_format_base_info(struct wined3d_gl_info *gl_info)
|
|||
{
|
||||
ERR("Format %s (%#x) not found.\n",
|
||||
debug_d3dformat(format_base_flags[i].id), format_base_flags[i].id);
|
||||
HeapFree(GetProcessHeap(), 0, gl_info->gl_formats);
|
||||
HeapFree(GetProcessHeap(), 0, gl_info->formats);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gl_info->gl_formats[fmt_idx].Flags |= format_base_flags[i].flags;
|
||||
gl_info->formats[fmt_idx].Flags |= format_base_flags[i].flags;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -926,7 +926,7 @@ static BOOL init_format_compression_info(struct wined3d_gl_info *gl_info)
|
|||
|
||||
for (i = 0; i < (sizeof(format_compression_info) / sizeof(*format_compression_info)); ++i)
|
||||
{
|
||||
struct wined3d_format_desc *format_desc;
|
||||
struct wined3d_format *format;
|
||||
int fmt_idx = getFmtIdx(format_compression_info[i].id);
|
||||
|
||||
if (fmt_idx == -1)
|
||||
|
@ -936,18 +936,18 @@ static BOOL init_format_compression_info(struct wined3d_gl_info *gl_info)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
format_desc = &gl_info->gl_formats[fmt_idx];
|
||||
format_desc->block_width = format_compression_info[i].block_width;
|
||||
format_desc->block_height = format_compression_info[i].block_height;
|
||||
format_desc->block_byte_count = format_compression_info[i].block_byte_count;
|
||||
format_desc->Flags |= WINED3DFMT_FLAG_COMPRESSED;
|
||||
format = &gl_info->formats[fmt_idx];
|
||||
format->block_width = format_compression_info[i].block_width;
|
||||
format->block_height = format_compression_info[i].block_height;
|
||||
format->block_byte_count = format_compression_info[i].block_byte_count;
|
||||
format->Flags |= WINED3DFMT_FLAG_COMPRESSED;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined3d_format_desc *format_desc)
|
||||
static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined3d_format *format)
|
||||
{
|
||||
/* Check if the default internal format is supported as a frame buffer
|
||||
* target, otherwise fall back to the render target internal.
|
||||
|
@ -964,8 +964,7 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
|
|||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format_desc->glInternal, 16, 16, 0,
|
||||
format_desc->glFormat, format_desc->glType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format->glInternal, 16, 16, 0, format->glFormat, format->glType, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
|
@ -976,37 +975,36 @@ 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->id));
|
||||
format_desc->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
|
||||
format_desc->rtInternal = format_desc->glInternal;
|
||||
TRACE("Format %s is supported as FBO color attachment.\n", debug_d3dformat(format->id));
|
||||
format->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
|
||||
format->rtInternal = format->glInternal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!format_desc->rtInternal)
|
||||
if (!format->rtInternal)
|
||||
{
|
||||
if (format_desc->Flags & WINED3DFMT_FLAG_RENDERTARGET)
|
||||
if (format->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->id));
|
||||
format_desc->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
|
||||
" and no fallback specified.\n", debug_d3dformat(format->id));
|
||||
format->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Format %s is not supported as FBO color attachment.\n", debug_d3dformat(format_desc->id));
|
||||
TRACE("Format %s is not supported as FBO color attachment.\n", debug_d3dformat(format->id));
|
||||
}
|
||||
format_desc->rtInternal = format_desc->glInternal;
|
||||
format->rtInternal = format->glInternal;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Format %s is not supported as FBO color attachment, trying rtInternal format as fallback.\n",
|
||||
debug_d3dformat(format_desc->id));
|
||||
debug_d3dformat(format->id));
|
||||
|
||||
while(glGetError());
|
||||
|
||||
gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format_desc->rtInternal, 16, 16, 0,
|
||||
format_desc->glFormat, format_desc->glType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format->rtInternal, 16, 16, 0, format->glFormat, format->glType, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
|
@ -1018,18 +1016,18 @@ 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->id));
|
||||
debug_d3dformat(format->id));
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("Format %s rtInternal format is not supported as FBO color attachment.\n",
|
||||
debug_d3dformat(format_desc->id));
|
||||
format_desc->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
|
||||
debug_d3dformat(format->id));
|
||||
format->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status == GL_FRAMEBUFFER_COMPLETE && format_desc->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
|
||||
if (status == GL_FRAMEBUFFER_COMPLETE && format->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
|
||||
{
|
||||
GLuint rb;
|
||||
|
||||
|
@ -1050,7 +1048,7 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
|
|||
{
|
||||
while(glGetError());
|
||||
TRACE("Format doesn't support post-pixelshader blending.\n");
|
||||
format_desc->Flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
|
||||
format->Flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
|
||||
}
|
||||
|
||||
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
|
||||
|
@ -1063,10 +1061,9 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined
|
|||
}
|
||||
}
|
||||
|
||||
if (format_desc->glInternal != format_desc->glGammaInternal)
|
||||
if (format->glInternal != format->glGammaInternal)
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format_desc->glGammaInternal, 16, 16, 0,
|
||||
format_desc->glFormat, format_desc->glType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format->glGammaInternal, 16, 16, 0, format->glFormat, format->glType, NULL);
|
||||
gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
|
||||
|
||||
status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
@ -1074,12 +1071,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->id));
|
||||
format_desc->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
|
||||
TRACE("Format %s's sRGB format is FBO attachable.\n", debug_d3dformat(format->id));
|
||||
format->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN("Format %s's sRGB format is not FBO attachable.\n", debug_d3dformat(format_desc->id));
|
||||
WARN("Format %s's sRGB format is not FBO attachable.\n", debug_d3dformat(format->id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,32 +1103,32 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info)
|
|||
|
||||
for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i)
|
||||
{
|
||||
struct wined3d_format_desc *desc = &gl_info->gl_formats[i];
|
||||
struct wined3d_format *format = &gl_info->formats[i];
|
||||
|
||||
if (!desc->glInternal) continue;
|
||||
if (!format->glInternal) continue;
|
||||
|
||||
if (desc->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
if (format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
{
|
||||
TRACE("Skipping format %s because it's a depth/stencil format.\n",
|
||||
debug_d3dformat(desc->id));
|
||||
debug_d3dformat(format->id));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
if (format->Flags & WINED3DFMT_FLAG_COMPRESSED)
|
||||
{
|
||||
TRACE("Skipping format %s because it's a compressed format.\n",
|
||||
debug_d3dformat(desc->id));
|
||||
debug_d3dformat(format->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->id));
|
||||
check_fbo_compat(gl_info, desc);
|
||||
TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->id));
|
||||
check_fbo_compat(gl_info, format);
|
||||
}
|
||||
else
|
||||
{
|
||||
desc->rtInternal = desc->glInternal;
|
||||
format->rtInternal = format->glInternal;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1149,7 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
|
|||
for (i = 0; i < sizeof(format_texture_info) / sizeof(*format_texture_info); ++i)
|
||||
{
|
||||
int fmt_idx = getFmtIdx(format_texture_info[i].id);
|
||||
struct wined3d_format_desc *desc;
|
||||
struct wined3d_format *format;
|
||||
|
||||
if (fmt_idx == -1)
|
||||
{
|
||||
|
@ -1163,19 +1160,19 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
|
|||
|
||||
if (!gl_info->supported[format_texture_info[i].extension]) continue;
|
||||
|
||||
desc = &gl_info->gl_formats[fmt_idx];
|
||||
desc->glInternal = format_texture_info[i].gl_internal;
|
||||
desc->glGammaInternal = format_texture_info[i].gl_srgb_internal;
|
||||
desc->rtInternal = format_texture_info[i].gl_rt_internal;
|
||||
desc->glFormat = format_texture_info[i].gl_format;
|
||||
desc->glType = format_texture_info[i].gl_type;
|
||||
desc->color_fixup = COLOR_FIXUP_IDENTITY;
|
||||
desc->Flags |= format_texture_info[i].flags;
|
||||
desc->heightscale = 1.0f;
|
||||
format = &gl_info->formats[fmt_idx];
|
||||
format->glInternal = format_texture_info[i].gl_internal;
|
||||
format->glGammaInternal = format_texture_info[i].gl_srgb_internal;
|
||||
format->rtInternal = format_texture_info[i].gl_rt_internal;
|
||||
format->glFormat = format_texture_info[i].gl_format;
|
||||
format->glType = format_texture_info[i].gl_type;
|
||||
format->color_fixup = COLOR_FIXUP_IDENTITY;
|
||||
format->Flags |= format_texture_info[i].flags;
|
||||
format->heightscale = 1.0f;
|
||||
|
||||
/* Texture conversion stuff */
|
||||
desc->convert = format_texture_info[i].convert;
|
||||
desc->conv_byte_count = format_texture_info[i].conv_byte_count;
|
||||
format->convert = format_texture_info[i].convert;
|
||||
format->conv_byte_count = format_texture_info[i].conv_byte_count;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1293,7 +1290,7 @@ static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
|
|||
|
||||
static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor)
|
||||
{
|
||||
struct wined3d_format_desc *desc;
|
||||
struct wined3d_format *format;
|
||||
unsigned int fmt_idx, i;
|
||||
static const enum wined3d_format_id fmts16[] =
|
||||
{
|
||||
|
@ -1327,7 +1324,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3
|
|||
for(i = 0; i < (sizeof(fmts16) / sizeof(*fmts16)); i++)
|
||||
{
|
||||
fmt_idx = getFmtIdx(fmts16[i]);
|
||||
gl_info->gl_formats[fmt_idx].Flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
gl_info->formats[fmt_idx].Flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -1336,14 +1333,14 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3
|
|||
for(i = 0; i < (sizeof(fmts16) / sizeof(*fmts16)); i++)
|
||||
{
|
||||
fmt_idx = getFmtIdx(fmts16[i]);
|
||||
desc = &gl_info->gl_formats[fmt_idx];
|
||||
if(!desc->glInternal) continue; /* Not supported by GL */
|
||||
format = &gl_info->formats[fmt_idx];
|
||||
if (!format->glInternal) continue; /* Not supported by GL */
|
||||
|
||||
filtered = check_filter(gl_info, gl_info->gl_formats[fmt_idx].glInternal);
|
||||
filtered = check_filter(gl_info, gl_info->formats[fmt_idx].glInternal);
|
||||
if(filtered)
|
||||
{
|
||||
TRACE("Format %s supports filtering\n", debug_d3dformat(fmts16[i]));
|
||||
desc->Flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
format->Flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1357,23 +1354,23 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
|
|||
int idx;
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R16_FLOAT);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R32_FLOAT);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16_UNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16_FLOAT);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R32G32_FLOAT);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
|
||||
|
||||
/* V8U8 is supported natively by GL_ATI_envmap_bumpmap and GL_NV_texture_shader.
|
||||
|
@ -1388,20 +1385,20 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
|
|||
if (!gl_info->supported[NV_TEXTURE_SHADER])
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_R8G8_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_R8G8_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
}
|
||||
|
||||
|
@ -1411,13 +1408,13 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
|
|||
* with each other
|
||||
*/
|
||||
idx = getFmtIdx(WINED3DFMT_R5G5_SNORM_L6_UNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE);
|
||||
idx = getFmtIdx(WINED3DFMT_R8G8_SNORM_L8X8_UNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_W);
|
||||
idx = getFmtIdx(WINED3DFMT_R8G8B8A8_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 1, CHANNEL_SOURCE_Z, 1, CHANNEL_SOURCE_W);
|
||||
}
|
||||
else
|
||||
|
@ -1432,39 +1429,39 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
|
|||
if (gl_info->supported[EXT_TEXTURE_COMPRESSION_RGTC])
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_ATI2N);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
}
|
||||
else if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC])
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_ATI2N);
|
||||
gl_info->gl_formats[idx].color_fixup= create_color_fixup_desc(
|
||||
gl_info->formats[idx].color_fixup= create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_W, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
}
|
||||
|
||||
if (!gl_info->supported[APPLE_YCBCR_422])
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_YUY2);
|
||||
gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YUY2);
|
||||
gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YUY2);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_UYVY);
|
||||
gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_UYVY);
|
||||
gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_UYVY);
|
||||
}
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_YV12);
|
||||
gl_info->gl_formats[idx].heightscale = 1.5f;
|
||||
gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
|
||||
gl_info->formats[idx].heightscale = 1.5f;
|
||||
gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
|
||||
|
||||
if (gl_info->supported[EXT_PALETTED_TEXTURE] || gl_info->supported[ARB_FRAGMENT_PROGRAM])
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_P8_UINT);
|
||||
gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
|
||||
gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
|
||||
}
|
||||
|
||||
if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
|
||||
{
|
||||
idx = getFmtIdx(WINED3DFMT_B8G8R8A8_UNORM);
|
||||
gl_info->gl_formats[idx].gl_vtx_format = GL_BGRA;
|
||||
gl_info->formats[idx].gl_vtx_format = GL_BGRA;
|
||||
}
|
||||
|
||||
if (gl_info->supported[ARB_HALF_FLOAT_VERTEX])
|
||||
|
@ -1472,10 +1469,10 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
|
|||
/* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though.
|
||||
* It is the job of the vertex buffer code to make sure that the vbos have the right format */
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16_FLOAT);
|
||||
gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT; /* == GL_HALF_FLOAT_NV */
|
||||
gl_info->formats[idx].gl_vtx_type = GL_HALF_FLOAT; /* == GL_HALF_FLOAT_NV */
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16B16A16_FLOAT);
|
||||
gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT;
|
||||
gl_info->formats[idx].gl_vtx_type = GL_HALF_FLOAT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1485,7 +1482,7 @@ static BOOL init_format_vertex_info(struct wined3d_gl_info *gl_info)
|
|||
|
||||
for (i = 0; i < (sizeof(format_vertex_info) / sizeof(*format_vertex_info)); ++i)
|
||||
{
|
||||
struct wined3d_format_desc *format_desc;
|
||||
struct wined3d_format *format;
|
||||
int fmt_idx = getFmtIdx(format_vertex_info[i].id);
|
||||
|
||||
if (fmt_idx == -1)
|
||||
|
@ -1495,13 +1492,13 @@ static BOOL init_format_vertex_info(struct wined3d_gl_info *gl_info)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
format_desc = &gl_info->gl_formats[fmt_idx];
|
||||
format_desc->emit_idx = format_vertex_info[i].emit_idx;
|
||||
format_desc->component_count = format_vertex_info[i].component_count;
|
||||
format_desc->gl_vtx_type = format_vertex_info[i].gl_vtx_type;
|
||||
format_desc->gl_vtx_format = format_vertex_info[i].gl_vtx_format;
|
||||
format_desc->gl_normalized = format_vertex_info[i].gl_normalized;
|
||||
format_desc->component_size = format_vertex_info[i].component_size;
|
||||
format = &gl_info->formats[fmt_idx];
|
||||
format->emit_idx = format_vertex_info[i].emit_idx;
|
||||
format->component_count = format_vertex_info[i].component_count;
|
||||
format->gl_vtx_type = format_vertex_info[i].gl_vtx_type;
|
||||
format->gl_vtx_format = format_vertex_info[i].gl_vtx_format;
|
||||
format->gl_normalized = format_vertex_info[i].gl_normalized;
|
||||
format->component_size = format_vertex_info[i].component_size;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1513,8 +1510,8 @@ BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info)
|
|||
|
||||
if (!init_format_compression_info(gl_info))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, gl_info->gl_formats);
|
||||
gl_info->gl_formats = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, gl_info->formats);
|
||||
gl_info->formats = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1537,13 +1534,13 @@ BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor v
|
|||
return TRUE;
|
||||
|
||||
fail:
|
||||
HeapFree(GetProcessHeap(), 0, gl_info->gl_formats);
|
||||
gl_info->gl_formats = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, gl_info->formats);
|
||||
gl_info->formats = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const struct wined3d_format_desc *getFormatDescEntry(enum wined3d_format_id format_id,
|
||||
const struct wined3d_gl_info *gl_info)
|
||||
const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl_info,
|
||||
enum wined3d_format_id format_id)
|
||||
{
|
||||
int idx = getFmtIdx(format_id);
|
||||
|
||||
|
@ -1555,10 +1552,10 @@ const struct wined3d_format_desc *getFormatDescEntry(enum wined3d_format_id form
|
|||
idx = getFmtIdx(WINED3DFMT_UNKNOWN);
|
||||
}
|
||||
|
||||
return &gl_info->gl_formats[idx];
|
||||
return &gl_info->formats[idx];
|
||||
}
|
||||
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format_desc *format, UINT alignment, UINT width, UINT height)
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT alignment, UINT width, UINT height)
|
||||
{
|
||||
UINT size;
|
||||
|
||||
|
@ -2490,12 +2487,12 @@ unsigned int count_bits(unsigned int mask)
|
|||
|
||||
/* Helper function for retrieving color info for ChoosePixelFormat and wglChoosePixelFormatARB.
|
||||
* The later function requires individual color components. */
|
||||
BOOL getColorBits(const struct wined3d_format_desc *format_desc,
|
||||
BOOL getColorBits(const struct wined3d_format *format,
|
||||
short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize)
|
||||
{
|
||||
TRACE("format %s.\n", debug_d3dformat(format_desc->id));
|
||||
TRACE("format %s.\n", debug_d3dformat(format->id));
|
||||
|
||||
switch (format_desc->id)
|
||||
switch (format->id)
|
||||
{
|
||||
case WINED3DFMT_B8G8R8X8_UNORM:
|
||||
case WINED3DFMT_B8G8R8_UNORM:
|
||||
|
@ -2512,27 +2509,27 @@ BOOL getColorBits(const struct wined3d_format_desc *format_desc,
|
|||
case WINED3DFMT_P8_UINT:
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported format %s.\n", debug_d3dformat(format_desc->id));
|
||||
FIXME("Unsupported format %s.\n", debug_d3dformat(format->id));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*redSize = count_bits(format_desc->red_mask);
|
||||
*greenSize = count_bits(format_desc->green_mask);
|
||||
*blueSize = count_bits(format_desc->blue_mask);
|
||||
*alphaSize = count_bits(format_desc->alpha_mask);
|
||||
*redSize = count_bits(format->red_mask);
|
||||
*greenSize = count_bits(format->green_mask);
|
||||
*blueSize = count_bits(format->blue_mask);
|
||||
*alphaSize = count_bits(format->alpha_mask);
|
||||
*totalSize = *redSize + *greenSize + *blueSize + *alphaSize;
|
||||
|
||||
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));
|
||||
*redSize, *greenSize, *blueSize, *alphaSize, *totalSize, debug_d3dformat(format->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)
|
||||
BOOL getDepthStencilBits(const struct wined3d_format *format, short *depthSize, short *stencilSize)
|
||||
{
|
||||
TRACE("format %s.\n", debug_d3dformat(format_desc->id));
|
||||
TRACE("format %s.\n", debug_d3dformat(format->id));
|
||||
|
||||
switch (format_desc->id)
|
||||
switch (format->id)
|
||||
{
|
||||
case WINED3DFMT_D16_LOCKABLE:
|
||||
case WINED3DFMT_D16_UNORM:
|
||||
|
@ -2545,22 +2542,22 @@ BOOL getDepthStencilBits(const struct wined3d_format_desc *format_desc, short *d
|
|||
case WINED3DFMT_D32_FLOAT:
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported depth/stencil format %s.\n", debug_d3dformat(format_desc->id));
|
||||
FIXME("Unsupported depth/stencil format %s.\n", debug_d3dformat(format->id));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*depthSize = format_desc->depth_size;
|
||||
*stencilSize = format_desc->stencil_size;
|
||||
*depthSize = format->depth_size;
|
||||
*stencilSize = format->stencil_size;
|
||||
|
||||
TRACE("Returning depthSize: %d and stencilSize: %d for format %s.\n",
|
||||
*depthSize, *stencilSize, debug_d3dformat(format_desc->id));
|
||||
*depthSize, *stencilSize, debug_d3dformat(format->id));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Note: It's the caller's responsibility to ensure values can be expressed
|
||||
* in the requested format. UNORM formats for example can only express values
|
||||
* in the range 0.0f -> 1.0f. */
|
||||
DWORD wined3d_format_convert_from_float(const struct wined3d_format_desc *format, const WINED3DCOLORVALUE *color)
|
||||
DWORD wined3d_format_convert_from_float(const struct wined3d_format *format, const WINED3DCOLORVALUE *color)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
|
@ -2745,9 +2742,11 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
|
|||
}
|
||||
|
||||
texture = (IWineD3DBaseTextureImpl *) stateblock->textures[i];
|
||||
if(texture) {
|
||||
settings->op[i].color_fixup = texture->resource.format_desc->color_fixup;
|
||||
if(ignore_textype) {
|
||||
if (texture)
|
||||
{
|
||||
settings->op[i].color_fixup = texture->resource.format->color_fixup;
|
||||
if (ignore_textype)
|
||||
{
|
||||
settings->op[i].tex_type = tex_1d;
|
||||
} else {
|
||||
switch (IWineD3DBaseTexture_GetTextureDimensions((IWineD3DBaseTexture *)texture)) {
|
||||
|
@ -2810,7 +2809,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
|
|||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)stateblock->textures[0];
|
||||
IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0];
|
||||
|
||||
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format_desc->alpha_mask)
|
||||
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
|
||||
{
|
||||
if (aop == WINED3DTOP_DISABLE)
|
||||
{
|
||||
|
@ -2913,8 +2912,9 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(stateblock->renderState[WINED3DRS_SRGBWRITEENABLE] &&
|
||||
rt->resource.format_desc->Flags & WINED3DFMT_FLAG_SRGB_WRITE) {
|
||||
if (stateblock->renderState[WINED3DRS_SRGBWRITEENABLE]
|
||||
&& rt->resource.format->Flags & WINED3DFMT_FLAG_SRGB_WRITE)
|
||||
{
|
||||
settings->sRGB_write = 1;
|
||||
} else {
|
||||
settings->sRGB_write = 0;
|
||||
|
@ -3138,8 +3138,8 @@ void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected,
|
|||
}
|
||||
|
||||
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format)
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format)
|
||||
{
|
||||
static const struct blit_shader * const blitters[] =
|
||||
{
|
||||
|
|
|
@ -221,7 +221,7 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWine
|
|||
{
|
||||
struct wined3d_vertex_declaration_element *e = &declaration->elements[i];
|
||||
|
||||
e->format_desc = getFormatDescEntry(elements[i].format, gl_info);
|
||||
e->format = wined3d_get_format(gl_info, elements[i].format);
|
||||
e->ffp_valid = declaration_element_valid_ffp(&elements[i]);
|
||||
e->input_slot = elements[i].input_slot;
|
||||
e->offset = elements[i].offset;
|
||||
|
@ -236,7 +236,7 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWine
|
|||
* to be loaded when drawing, but filter tesselation pseudo streams. */
|
||||
if (e->input_slot >= MAX_STREAMS) continue;
|
||||
|
||||
if (!e->format_desc->gl_vtx_format)
|
||||
if (!e->format->gl_vtx_format)
|
||||
{
|
||||
FIXME("The application tries to use an unsupported format (%s), returning E_FAIL.\n",
|
||||
debug_d3dformat(elements[i].format));
|
||||
|
|
|
@ -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->id;
|
||||
pDesc->Format = This->resource.format->id;
|
||||
pDesc->Type = This->resource.resourceType;
|
||||
pDesc->Usage = This->resource.usage;
|
||||
pDesc->Pool = This->resource.pool;
|
||||
|
@ -212,8 +212,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DL
|
|||
/* fixme: should we really lock as such? */
|
||||
TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory);
|
||||
|
||||
pLockedVolume->RowPitch = This->resource.format_desc->byte_count * This->currentDesc.Width; /* Bytes / row */
|
||||
pLockedVolume->SlicePitch = This->resource.format_desc->byte_count
|
||||
pLockedVolume->RowPitch = This->resource.format->byte_count * This->currentDesc.Width; /* Bytes / row */
|
||||
pLockedVolume->SlicePitch = This->resource.format->byte_count
|
||||
* This->currentDesc.Width * This->currentDesc.Height; /* Bytes / slice */
|
||||
if (!pBox) {
|
||||
TRACE("No box supplied - all is ok\n");
|
||||
|
@ -229,7 +229,7 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DL
|
|||
pLockedVolume->pBits = This->resource.allocatedMemory
|
||||
+ (pLockedVolume->SlicePitch * pBox->Front) /* FIXME: is front < back or vica versa? */
|
||||
+ (pLockedVolume->RowPitch * pBox->Top)
|
||||
+ (pBox->Left * This->resource.format_desc->byte_count);
|
||||
+ (pBox->Left * This->resource.format->byte_count);
|
||||
This->lockedBox.Left = pBox->Left;
|
||||
This->lockedBox.Top = pBox->Top;
|
||||
This->lockedBox.Front = pBox->Front;
|
||||
|
@ -273,36 +273,21 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int
|
|||
{
|
||||
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
||||
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *glDesc = This->resource.format_desc;
|
||||
const struct wined3d_format *format = This->resource.format;
|
||||
|
||||
TRACE("iface %p, level %u, srgb %#x, format %s (%#x).\n",
|
||||
iface, gl_level, srgb_mode, debug_d3dformat(glDesc->id), glDesc->id);
|
||||
iface, gl_level, srgb_mode, debug_d3dformat(format->id), format->id);
|
||||
|
||||
volume_bind_and_dirtify(iface);
|
||||
|
||||
TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||
GL_TEXTURE_3D,
|
||||
gl_level,
|
||||
glDesc->glInternal,
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
This->currentDesc.Depth,
|
||||
0,
|
||||
glDesc->glFormat,
|
||||
glDesc->glType,
|
||||
This->resource.allocatedMemory);
|
||||
GL_TEXTURE_3D, gl_level, format->glInternal, This->currentDesc.Width, This->currentDesc.Height,
|
||||
This->currentDesc.Depth, 0, format->glFormat, format->glType, This->resource.allocatedMemory);
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D,
|
||||
gl_level,
|
||||
glDesc->glInternal,
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
This->currentDesc.Depth,
|
||||
0,
|
||||
glDesc->glFormat,
|
||||
glDesc->glType,
|
||||
This->resource.allocatedMemory));
|
||||
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, gl_level, format->glInternal,
|
||||
This->currentDesc.Width, This->currentDesc.Height, This->currentDesc.Depth,
|
||||
0, format->glFormat, format->glType, This->resource.allocatedMemory));
|
||||
checkGLcall("glTexImage3D");
|
||||
LEAVE_GL();
|
||||
|
||||
|
@ -343,7 +328,7 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
|
|||
IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
HRESULT hr;
|
||||
|
||||
if (!gl_info->supported[EXT_TEXTURE3D])
|
||||
|
@ -355,7 +340,7 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT
|
|||
volume->lpVtbl = &IWineD3DVolume_Vtbl;
|
||||
|
||||
hr = resource_init((IWineD3DResource *)volume, WINED3DRTYPE_VOLUME, device,
|
||||
width * height * depth * format_desc->byte_count, usage, format_desc, pool, parent, parent_ops);
|
||||
width * height * depth * format->byte_count, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x.\n", hr);
|
||||
|
|
|
@ -388,7 +388,7 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
|
|||
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
const struct wined3d_format_desc *format_desc = getFormatDescEntry(format_id, gl_info);
|
||||
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
|
||||
UINT tmp_w, tmp_h, tmp_d;
|
||||
unsigned int i;
|
||||
HRESULT hr;
|
||||
|
@ -433,7 +433,7 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
|
|||
texture->lpVtbl = &IWineD3DVolumeTexture_Vtbl;
|
||||
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 1, levels,
|
||||
WINED3DRTYPE_VOLUMETEXTURE, device, 0, usage, format_desc, pool, parent, parent_ops);
|
||||
WINED3DRTYPE_VOLUMETEXTURE, device, 0, usage, format, pool, parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize basetexture, returning %#x.\n", hr);
|
||||
|
|
|
@ -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->id, \
|
||||
si->elements[name].data, si->elements[name].stride, si->elements[name].format->id, \
|
||||
si->elements[name].buffer_object, si->elements[name].stream_idx); } while(0)
|
||||
|
||||
/* Advance declaration of structures to satisfy compiler */
|
||||
|
@ -862,7 +862,7 @@ enum wined3d_ffp_emit_idx
|
|||
|
||||
struct wined3d_stream_info_element
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc;
|
||||
const struct wined3d_format *format;
|
||||
GLsizei stride;
|
||||
const BYTE *data;
|
||||
UINT stream_idx;
|
||||
|
@ -1141,8 +1141,8 @@ struct blit_shader
|
|||
HRESULT (*set_shader)(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface);
|
||||
void (*unset_shader)(IWineD3DDevice *iface);
|
||||
BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format_desc,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format_desc);
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format);
|
||||
HRESULT (*color_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
|
||||
const RECT *dst_rect, const WINED3DCOLORVALUE *color);
|
||||
};
|
||||
|
@ -1152,8 +1152,8 @@ extern const struct blit_shader arbfp_blit DECLSPEC_HIDDEN;
|
|||
extern const struct blit_shader cpu_blit DECLSPEC_HIDDEN;
|
||||
|
||||
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format)
|
||||
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
|
||||
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format)
|
||||
DECLSPEC_HIDDEN;
|
||||
|
||||
/* Temporary blit_shader helper functions */
|
||||
|
@ -1176,7 +1176,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
|
|||
GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
|
||||
void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN;
|
||||
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
|
||||
const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN;
|
||||
const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
|
||||
void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void context_free_event_query(struct wined3d_event_query *query) DECLSPEC_HIDDEN;
|
||||
void context_free_occlusion_query(struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
|
||||
|
@ -1417,7 +1417,7 @@ struct wined3d_gl_info
|
|||
WGL_EXT_FUNCS_GEN
|
||||
#undef USE_GL_FUNC
|
||||
|
||||
struct wined3d_format_desc *gl_formats;
|
||||
struct wined3d_format *formats;
|
||||
};
|
||||
|
||||
struct wined3d_driver_info
|
||||
|
@ -1755,7 +1755,7 @@ typedef struct IWineD3DResourceClass
|
|||
WINED3DPOOL pool;
|
||||
UINT size;
|
||||
DWORD usage;
|
||||
const struct wined3d_format_desc *format_desc;
|
||||
const struct wined3d_format *format;
|
||||
DWORD priority;
|
||||
BYTE *allocatedMemory; /* Pointer to the real data location */
|
||||
BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */
|
||||
|
@ -1778,7 +1778,7 @@ DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN;
|
|||
HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
|
||||
void *data, DWORD *data_size) DECLSPEC_HIDDEN;
|
||||
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
|
||||
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format_desc *format_desc,
|
||||
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
|
||||
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
|
||||
WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;
|
||||
DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN;
|
||||
|
@ -1868,7 +1868,7 @@ IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *text
|
|||
UINT layer, UINT level) DECLSPEC_HIDDEN;
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
|
||||
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
|
||||
const struct wined3d_format_desc *format_desc, WINED3DPOOL pool, IUnknown *parent,
|
||||
const struct wined3d_format *format, WINED3DPOOL pool, IUnknown *parent,
|
||||
const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
|
||||
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface,
|
||||
WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN;
|
||||
|
@ -2227,9 +2227,9 @@ typedef enum {
|
|||
CONVERT_RGB32_888
|
||||
} CONVERT_TYPES;
|
||||
|
||||
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing,
|
||||
struct wined3d_format_desc *desc, CONVERT_TYPES *convert) DECLSPEC_HIDDEN;
|
||||
void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
|
||||
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *surface, BOOL need_alpha_ck, BOOL use_texturing,
|
||||
struct wined3d_format *format, CONVERT_TYPES *convert) DECLSPEC_HIDDEN;
|
||||
void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL palette9_changed(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -2239,7 +2239,7 @@ BOOL palette9_changed(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
|
|||
|
||||
struct wined3d_vertex_declaration_element
|
||||
{
|
||||
const struct wined3d_format_desc *format_desc;
|
||||
const struct wined3d_format *format;
|
||||
BOOL ffp_valid;
|
||||
WORD input_slot;
|
||||
WORD offset;
|
||||
|
@ -2553,7 +2553,7 @@ struct IWineD3DSwapChainImpl
|
|||
enum wined3d_format_id orig_fmt;
|
||||
WINED3DGAMMARAMP orig_gamma;
|
||||
BOOL render_to_fbo;
|
||||
const struct wined3d_format_desc *ds_format;
|
||||
const struct wined3d_format *ds_format;
|
||||
|
||||
LONG prev_time, frames; /* Performance tracking */
|
||||
unsigned int vSyncCounter;
|
||||
|
@ -2652,9 +2652,9 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock,
|
|||
void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
|
||||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL getColorBits(const struct wined3d_format_desc *format_desc,
|
||||
BOOL getColorBits(const struct wined3d_format *format,
|
||||
short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize) DECLSPEC_HIDDEN;
|
||||
BOOL getDepthStencilBits(const struct wined3d_format_desc *format_desc,
|
||||
BOOL getDepthStencilBits(const struct wined3d_format *format,
|
||||
short *depthSize, short *stencilSize) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Math utils */
|
||||
|
@ -2963,7 +2963,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
|
|||
#define WINED3DFMT_FLAG_COMPRESSED 0x00008000
|
||||
#define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
|
||||
|
||||
struct wined3d_format_desc
|
||||
struct wined3d_format
|
||||
{
|
||||
enum wined3d_format_id id;
|
||||
|
||||
|
@ -2998,11 +2998,11 @@ struct wined3d_format_desc
|
|||
void (*convert)(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height);
|
||||
};
|
||||
|
||||
const struct wined3d_format_desc *getFormatDescEntry(enum wined3d_format_id format_id,
|
||||
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format_desc *format,
|
||||
const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl_info,
|
||||
enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
|
||||
UINT wined3d_format_calculate_size(const struct wined3d_format *format,
|
||||
UINT alignment, UINT width, UINT height) DECLSPEC_HIDDEN;
|
||||
DWORD wined3d_format_convert_from_float(const struct wined3d_format_desc *format,
|
||||
DWORD wined3d_format_convert_from_float(const struct wined3d_format *format,
|
||||
const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline BOOL use_vs(IWineD3DStateBlockImpl *stateblock)
|
||||
|
|
Loading…
Reference in New Issue