1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef D3D9_Direct3DVolume9_hpp 16 #define D3D9_Direct3DVolume9_hpp 17 18 #include "Unknown.hpp" 19 20 #include "Surface.hpp" 21 22 #include <d3d9.h> 23 24 namespace D3D9 25 { 26 class Direct3DDevice9; 27 class Direct3DResource9; 28 class Direct3DVolumeTexture9; 29 30 class Direct3DVolume9 : public IDirect3DVolume9, public Unknown, public sw::Surface 31 { 32 public: 33 Direct3DVolume9(Direct3DDevice9 *device, Direct3DVolumeTexture9 *container, int width, int height, int depth, D3DFORMAT format, D3DPOOL pool, unsigned long usage); 34 35 virtual ~Direct3DVolume9(); 36 37 // IUnknown methods 38 long __stdcall QueryInterface(const IID &iid, void **object); 39 unsigned long __stdcall AddRef(); 40 unsigned long __stdcall Release(); 41 42 // IDirect3DVolume9 methods 43 long __stdcall FreePrivateData(const GUID &guid); 44 long __stdcall GetContainer(const IID &iid, void **container); 45 long __stdcall GetDesc(D3DVOLUME_DESC *description); 46 long __stdcall GetDevice(IDirect3DDevice9 **device); 47 long __stdcall GetPrivateData(const GUID &guid, void *data, unsigned long *size); 48 long __stdcall LockBox(D3DLOCKED_BOX *lockedVolume, const D3DBOX *box, unsigned long flags); 49 long __stdcall SetPrivateData(const GUID &guid, const void *data, unsigned long size, unsigned long flags); 50 long __stdcall UnlockBox(); 51 52 private: 53 static sw::Format translateFormat(D3DFORMAT format); 54 static unsigned int memoryUsage(int width, int height, int depth, D3DFORMAT format); 55 56 // Creation parameters 57 Direct3DDevice9 *const device; 58 Direct3DVolumeTexture9 *const container; 59 const int width; 60 const int height; 61 const int depth; 62 const D3DFORMAT format; 63 const D3DPOOL pool; 64 const bool lockable; 65 const unsigned long usage; 66 67 Direct3DResource9 *resource; 68 }; 69 } 70 71 #endif // D3D9_Direct3DVolume9_hpp 72