summaryrefslogtreecommitdiff
path: root/materialsystem/shaderapidx9/texturedx8.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/shaderapidx9/texturedx8.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'materialsystem/shaderapidx9/texturedx8.h')
-rw-r--r--materialsystem/shaderapidx9/texturedx8.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/materialsystem/shaderapidx9/texturedx8.h b/materialsystem/shaderapidx9/texturedx8.h
new file mode 100644
index 0000000..2901798
--- /dev/null
+++ b/materialsystem/shaderapidx9/texturedx8.h
@@ -0,0 +1,110 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef TEXTUREDX8_H
+#define TEXTUREDX8_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "togl/rendermechanism.h"
+#include "bitmap/imageformat.h"
+#include "locald3dtypes.h"
+#include "shaderapi/ishaderapi.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class CPixelWriter;
+
+
+//-----------------------------------------------------------------------------
+// Returns the size of texture memory
+//-----------------------------------------------------------------------------
+int ComputeTextureMemorySize( const GUID &nDeviceId, D3DDEVTYPE deviceType );
+
+
+//-----------------------------------------------------------------------------
+// Texture creation
+//-----------------------------------------------------------------------------
+IDirect3DBaseTexture *CreateD3DTexture( int width, int height, int depth,
+ ImageFormat dstFormat, int numLevels, int creationFlags, char *debugLabel=NULL ); // OK to not-supply the last param
+
+
+//-----------------------------------------------------------------------------
+// Texture destruction
+//-----------------------------------------------------------------------------
+void DestroyD3DTexture( IDirect3DBaseTexture *pTex );
+
+int GetD3DTextureRefCount( IDirect3DBaseTexture *pTex );
+
+
+//-----------------------------------------------------------------------------
+// Texture heap methods
+//-----------------------------------------------------------------------------
+#if defined( _X360 )
+void SetD3DTextureImmobile( IDirect3DBaseTexture *pTex, bool bImmobile );
+void CompactTextureHeap();
+#endif
+
+//-----------------------------------------------------------------------------
+// Stats...
+//-----------------------------------------------------------------------------
+int TextureCount();
+
+
+//-----------------------------------------------------------------------------
+// Info for texture loading
+//-----------------------------------------------------------------------------
+struct TextureLoadInfo_t
+{
+ ShaderAPITextureHandle_t m_TextureHandle;
+ int m_nCopy;
+ IDirect3DBaseTexture *m_pTexture;
+ int m_nLevel;
+ D3DCUBEMAP_FACES m_CubeFaceID;
+ int m_nWidth;
+ int m_nHeight;
+ int16 m_nZOffset; // What z-slice of the volume texture are we loading?
+#if defined( _X360 )
+ bool m_bSrcIsTiled; // format may not be, but data could be
+ bool m_bCanConvertFormat; // allow format conversion
+#else
+ bool m_bTextureIsLockable;
+#endif
+ ImageFormat m_SrcFormat;
+ unsigned char *m_pSrcData;
+};
+
+
+//-----------------------------------------------------------------------------
+// Texture image upload
+//-----------------------------------------------------------------------------
+void LoadTexture( TextureLoadInfo_t &info );
+void LoadTextureFromVTF( TextureLoadInfo_t &info, IVTFTexture* pVTF, int iVTFFrame );
+void LoadCubeTextureFromVTF( TextureLoadInfo_t &info, IVTFTexture* pVTF, int iVTFFrame );
+void LoadVolumeTextureFromVTF( TextureLoadInfo_t &info, IVTFTexture* pVTF, int iVTFFrame );
+
+//-----------------------------------------------------------------------------
+// Upload to a sub-piece of a texture
+//-----------------------------------------------------------------------------
+void LoadSubTexture( TextureLoadInfo_t &info, int xOffset, int yOffset, int srcStride );
+
+//-----------------------------------------------------------------------------
+// Lock, unlock a texture...
+//-----------------------------------------------------------------------------
+bool LockTexture( ShaderAPITextureHandle_t textureHandle, int copy, IDirect3DBaseTexture* pTexture, int level,
+ D3DCUBEMAP_FACES cubeFaceID, int xOffset, int yOffset, int width, int height, bool bDiscard,
+ CPixelWriter& writer );
+
+void UnlockTexture( ShaderAPITextureHandle_t textureHandle, int copy, IDirect3DBaseTexture* pTexture, int level,
+ D3DCUBEMAP_FACES cubeFaceID );
+
+#endif // TEXTUREDX8_H \ No newline at end of file