Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# deShader_priv.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file deShader_priv.hpp
    00003 ///
    00004 /// @brief Private header file for the deShader class
    00005 ///
    00006 /// @author JesusFreak
    00007 ///
    00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
    00009 /// contents of this file is subject to the Destiny3D Member License which
    00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
    00011 ///
    00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
    00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
    00014 /// for any particular purpose.
    00015 ///
    00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
    00017 ///
    00018 /// <hr>
    00019 ///                                 Change History
    00020 /// <hr>
    00021 ///
    00022 /// @date May 2002
    00023 /// @author JesusFreak
    00024 /// @remarks Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DEVSHADER_PRIV_HPP
    00029 #define DEVSHADER_PRIV_HPP
    00030
    00031 #include "deDriver.hpp"
    00032 #include "deArray.hpp"
    00033 #include "deFile.hpp"
    00034
    00035 #define IdeShader_Argument_X 0x00100000
    00036 #define IdeShader_Argument_Y 0x00200000
    00037 #define IdeShader_Argument_Z 0x00400000
    00038 #define IdeShader_Argument_W 0x00800000
    00039 #define IdeShader_Argument_Negate 0x0010000
    00040
    00041 #define IdeShader_Argument_Swizzle_1X 0x00001000
    00042 #define IdeShader_Argument_Swizzle_1Y 0x00002000
    00043 #define IdeShader_Argument_Swizzle_1Z 0x00004000
    00044 #define IdeShader_Argument_Swizzle_1W 0x00008000
    00045
    00046 #define IdeShader_Argument_Swizzle_2X 0x00000100
    00047 #define IdeShader_Argument_Swizzle_2Y 0x00000200
    00048 #define IdeShader_Argument_Swizzle_2Z 0x00000400
    00049 #define IdeShader_Argument_Swizzle_2W 0x00000800
    00050
    00051 #define IdeShader_Argument_Swizzle_3X 0x00000010
    00052 #define IdeShader_Argument_Swizzle_3Y 0x00000020
    00053 #define IdeShader_Argument_Swizzle_3Z 0x00000040
    00054 #define IdeShader_Argument_Swizzle_3W 0x00000080
    00055
    00056 #define IdeShader_Argument_Swizzle_4X 0x00000001
    00057 #define IdeShader_Argument_Swizzle_4Y 0x00000002
    00058 #define IdeShader_Argument_Swizzle_4Z 0x00000004
    00059 #define IdeShader_Argument_Swizzle_4W 0x00000008
    00060
    00061 class deShader : public IdeShader, public deRefCountBase
    00062 {
    00063     // Constructor and Destructor
    00064 protected:
    00065     ~deShader();
    00066 public:
    00067     deShader();
    00068
    00069     // Public member functions
    00070 public:
    00071     deBoolean Assemble(char * Code,void (*ErrorCallback)(long LineNumber,char * Error));
    00072     deBoolean Disassemble(deString * Code);
    00073     ShaderType GetShaderType() const;
    00074     long GetInstructionCount() const;
    00075     const deTArray<deShaderInstruction> * GetInstructions() const;
    00076     long GetConstantCount() const;
    00077     const deTArray<deShaderConstant> * GetConstants() const;
    00078     deBoolean Write(IdeFile * File) const;
    00079     deBoolean Read(IdeFile * File);
    00080     deBoolean SetDriverShader(void * Shader);
    00081     void * GetDriverShader() const;
    00082
    00083     // Private member functions
    00084 private:
    00085     void GetNextWord(char ** String,char * Word);
    00086     deBoolean GetArgument(char ** String,deString * Argument);
    00087     deBoolean GetLastArgument(char ** String,deString * Argument);
    00088     long GetArrayArgumentIndex(void (*ErrorCallback)(long LineNumber,char * Error),deString * Argument);
    00089     long GetArgumentOffset(long ArgumentNumber,deString * Argument,deString * OutArgument);
    00090     void GotoNextLine(char ** String);
    00091     void Error(void (*ErrorCallback)(long LineNumber,char * Error),char * Error);
    00092     deBoolean ParseInstruction(void (*ErrorCallback)(long LineNumber,char * Error),char ** Code,char * InstructionName);
    00093     deBoolean ParseConstantDeclaration(void (*ErrorCallback)(long LineNumber,char * Error),char ** Code,deShaderInstructionType Instruction);
    00094     void DisassembleIndexAndOffset(long ArgumentNumber,DWORD IndexBase,DWORD Argument,deString * Code);
    00095     deBoolean DisassembleArgument(long ArgumentNumber,DWORD Argument,deString * Code);
    00096     deBoolean DisassembleInstruction(IdeShader::deShaderInstruction * Instruction,deString * Code);
    00097     deBoolean DisassembleConstant(IdeShader::deShaderConstant * Constant,deString * Code);
    00098     deBoolean SetShaderType();
    00099
    00100     // Private member variables
    00101 private:
    00102     deTArray<deShaderInstruction>   m_Instructions;
    00103     deTArray<deShaderConstant>      m_Constants;
    00104     ShaderType                      m_ShaderType;
    00105     long                            m_CurrentLine;
    00106     long                            m_InstructionCount;
    00107     long                            m_ConstantCount;
    00108     void                            *m_DriverShader;
    00109 };
    00110
    00111 #endif