Commit d6fcc69d authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Implement D3DFMT_UNKNOWN surfaces, this seems to be used a lot in d3d8

but I haven't found any d3d9 application that uses D3DFMT_UNKNOWN surfaces yet.
parent efe606fd
......@@ -710,7 +710,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
* it is based around 4x4 pixel blocks it requires padding, so allocate enough
* space!
*********************************/
if (Format == WINED3DFMT_DXT1) {
if (WINED3DFMT_UNKNOWN == Format) {
Size = 0;
} else if (Format == WINED3DFMT_DXT1) {
/* DXT1 is half byte per pixel */
Size = ((max(pow2Width,4) * D3DFmtGetBpp(This, Format)) * max(pow2Height,4)) >> 1;
......@@ -730,10 +732,17 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
object->currentDesc.MultiSampleType = MultiSample;
object->currentDesc.MultiSampleQuality = MultisampleQuality;
/* Setup some glformat defaults */
object->glDescription.glFormat = D3DFmt2GLFmt(This, object->resource.format);
object->glDescription.glFormatInternal = D3DFmt2GLIntFmt(This, object->resource.format);
object->glDescription.glType = D3DFmt2GLType(This, object->resource.format);
/* Setup some glformat defaults */
if (WINED3DFMT_UNKNOWN != Format) {
object->glDescription.glFormat = D3DFmt2GLFmt(This, object->resource.format);
object->glDescription.glFormatInternal = D3DFmt2GLIntFmt(This, object->resource.format);
object->glDescription.glType = D3DFmt2GLType(This, object->resource.format);
} else {
object->glDescription.glFormat = 0;
object->glDescription.glFormatInternal = 0;
object->glDescription.glType = 0;
}
object->glDescription.textureName = 0;
object->glDescription.level = Level;
object->glDescription.target = GL_TEXTURE_2D;
......@@ -744,8 +753,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
object->nonpow2 = (pow2Width != Width || pow2Height != Height) ? TRUE : FALSE;
object->discard = Discard;
object->activeLock = FALSE;
object->bytesPerPixel = D3DFmtGetBpp(This, Format);
object->pow2Size = (pow2Width * object->bytesPerPixel) * pow2Height;
if (WINED3DFMT_UNKNOWN != Format) {
object->bytesPerPixel = D3DFmtGetBpp(This, Format);
object->pow2Size = (pow2Width * object->bytesPerPixel) * pow2Height;
} else {
object->bytesPerPixel = 0;
object->pow2Size = 0;
}
/** TODO: change this into a texture transform matrix so that it's processed in hardware **/
......
......@@ -999,7 +999,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
STDMETHOD_(void,SetGlTextureDesc)(THIS_ UINT textureName, int target) PURE;
STDMETHOD_(void,GetGlDesc)(THIS_ glDescriptor **glDescription) PURE;
STDMETHOD_(CONST void *, GetData)(THIS) PURE;
STDMETHOD(SetFormat)(THIS_ WINED3DFORMAT format) PURE;
};
#undef INTERFACE
......@@ -1035,6 +1035,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
#define IWineD3DSurface_SetGlTextureDesc(p,a,b) (p)->lpVtbl->SetGlTextureDesc(p,a,b)
#define IWineD3DSurface_GetGlDesc(p,a) (p)->lpVtbl->GetGlDesc(p,a)
#define IWineD3DSurface_GetData(p) (p)->lpVtbl->GetData(p)
#define IWineD3DSurface_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#endif
/*****************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment