home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / plugin / vdvideoaccel.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  4.0 KB  |  100 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    Copyright (C) 1998-2009 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #ifndef f_VD2_PLUGIN_VDVIDEOACCEL_H
  19. #define f_VD2_PLUGIN_VDVIDEOACCEL_H
  20.  
  21. #ifdef _MSC_VER
  22.     #pragma once
  23. #endif
  24.  
  25. #include <stddef.h>
  26.  
  27. #include "vdplugin.h"
  28.  
  29. struct VDXAInitData2D {
  30.     const void *mpData;
  31.     ptrdiff_t mPitch;
  32. };
  33.  
  34. struct VDXATextureDesc {
  35.     uint32    mImageWidth;
  36.     uint32    mImageHeight;
  37.     uint32    mTexWidth;
  38.     uint32    mTexHeight;
  39.     float    mInvTexWidth;
  40.     float    mInvTexHeight;
  41. };
  42.  
  43. enum VDXAFormat {
  44.     kVDXAF_Unknown,
  45.     kVDXAF_A8R8G8B8
  46. };
  47.  
  48. enum VDXAProgramFormat {
  49.     kVDXAPF_D3D9ByteCodePS20
  50. };
  51.  
  52. enum VDXAFilterMode {
  53.     kVDXAFilt_Point,
  54.     kVDXAFilt_Bilinear,
  55.     kVDXAFilt_BilinearMip,
  56.     kVDXAFiltCount
  57. };
  58.  
  59. class IVDXAContext : public IVDXUnknown {
  60. public:
  61.     // Create a texture.
  62.     virtual uint32 VDXAPIENTRY CreateTexture2D(uint32 width, uint32 height, uint32 mipCount, VDXAFormat format, bool wrap, const VDXAInitData2D *initData) = 0;
  63.  
  64.     // Create a fragment program.
  65.     virtual uint32 VDXAPIENTRY CreateFragmentProgram(VDXAProgramFormat programFormat, const void *data, uint32 length) = 0;
  66.  
  67.     virtual uint32 VDXAPIENTRY CreateRenderTexture(uint32 width, uint32 height, uint32 borderWidth, uint32 borderHeight, VDXAFormat format, bool wrap) = 0;
  68.  
  69.     // Destroy an object. If the object is bound, it is automatically unbound before being destroyed.
  70.     virtual void VDXAPIENTRY DestroyObject(uint32 handle) = 0;
  71.  
  72.     // Query the description of a texture.
  73.     virtual void VDXAPIENTRY GetTextureDesc(uint32 handle, VDXATextureDesc& desc) = 0;
  74.  
  75.     // Set one or more fragment program constants with an array of 4-vectors.
  76.     virtual void VDXAPIENTRY SetFragmentProgramConstF(uint32 startIndex, uint32 count, const float *values) = 0;
  77.  
  78.     // Set a 2x3 transform matrix used by a texture coordinate interpolator to target one source rectangle.
  79.     virtual void VDXAPIENTRY SetTextureMatrix(uint32 coordIndex, uint32 textureHandle, float xoffset, float yoffset, const float uvMatrix[12]) = 0;
  80.  
  81.     // Set a 4x3 transform matrix used by a texture coordinate interpolator to target two source rectangles.
  82.     virtual void VDXAPIENTRY SetTextureMatrixDual(uint32 coordIndex, uint32 textureHandle, float xoffset1, float yoffset1, float xoffset2, float yoffset2) = 0;
  83.  
  84.     // A call of SetSampler(samplerIndex, 0, false, NULL) will disable a sampler. However, there is no
  85.     // need to explicitly disable samplers, as the runtime will automatically do this whenever a bound
  86.     // texture is destroyed, and ignore samplers not used by a fragment program.
  87.     virtual void VDXAPIENTRY SetSampler(uint32 samplerIndex, uint32 textureHandle, VDXAFilterMode filterMode) = 0;
  88.  
  89.     // Draw a quad using the given fragment program. The rectangle size is determined by the natural size
  90.     // of the render target. The optional destination rect is cropped against the render target if
  91.     // required.
  92.     virtual void VDXAPIENTRY DrawRect(uint32 renderTargetHandle, uint32 fragmentProgram, const VDXRect *destRect) = 0;
  93.  
  94.     // Fill a series of rectangles with a solid color. The rectangles are cropped to the destination as
  95.     // necessary. If rectCount > 0 and rects != null, the entire destination is filled.
  96.     virtual void VDXAPIENTRY FillRects(uint32 renderTargetHandle, uint32 rectCount, const VDXRect *rects, uint32 colorARGB) = 0;
  97. };
  98.  
  99. #endif
  100.