Skip to content

Commit

Permalink
[d3d8] Surface desc size as bytes not bits
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpyneDreams committed Feb 23, 2023
1 parent aae4965 commit 31c149b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/d3d8/d3d8_d3d9_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ namespace dxvk {
return params;
}

inline UINT GetFormatBPP(const D3DFORMAT fmt) {
// TODO: get bpp based on format
return 32;
// Get bytes per pixel
inline UINT GetFormatStride(const D3DFORMAT fmt) {
// TODO: Get texture size based on format
return 4;
}

// (8<-9) Convert D3DSURFACE_DESC
Expand All @@ -92,7 +93,7 @@ namespace dxvk {
pSurf8->Type = D3DRESOURCETYPE(pSurf9->Type);
pSurf8->Usage = pSurf9->Usage;
pSurf8->Pool = D3DPOOL(pSurf9->Pool);
pSurf8->Size = pSurf9->Width * pSurf9->Height * GetFormatBPP(pSurf8->Format);
pSurf8->Size = pSurf9->Width * pSurf9->Height * GetFormatStride(pSurf8->Format);

pSurf8->MultiSampleType = D3DMULTISAMPLE_TYPE(pSurf9->MultiSampleType);
// DX8: No multisample quality
Expand All @@ -106,7 +107,7 @@ namespace dxvk {
pVol8->Type = D3DRESOURCETYPE(pVol9->Type);
pVol8->Usage = pVol9->Usage;
pVol8->Pool = D3DPOOL(pVol9->Pool);
pVol8->Size = pVol9->Width * pVol9->Height * pVol9->Depth * GetFormatBPP(pVol8->Format);
pVol8->Size = pVol9->Width * pVol9->Height * pVol9->Depth * GetFormatStride(pVol8->Format);
pVol8->Width = pVol9->Width;
pVol8->Height = pVol9->Height;
pVol8->Depth = pVol9->Depth;
Expand Down

0 comments on commit 31c149b

Please sign in to comment.