Back to index

nux  3.0.0
arb_programs_limits.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * version 3 along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>
00016  *
00017  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00018  *
00019  */
00020 
00021 
00022 #include "NuxCore/NuxCore.h"
00023 #include "NuxGraphics/BitmapFormats.h"
00024 #include "NuxGraphics/GraphicsDisplay.h"
00025 #include "NuxGraphics/GLWindowManager.h"
00026 #include "NuxGraphics/GraphicsEngine.h"
00027 
00028 /*
00029  * Tests: 
00030  *  - Display arb programs limits
00031  */
00032  
00033 void ARBProgramLimits ()
00034 {
00035   nux::GraphicsDisplay* graphics_display = gGLWindowManager.CreateGLWindow("Window", 570, 270, nux::WINDOWSTYLE_NORMAL, 0, false);
00036 
00037 
00038   int OPENGL_MAX_PROGRAM_INSTRUCTIONS_ARB;
00039   int OPENGL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB;
00040   int OPENGL_MAX_PROGRAM_TEMPORARIES_ARB;
00041   int OPENGL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB;
00042   int OPENGL_MAX_PROGRAM_PARAMETERS_ARB;
00043   int OPENGL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB;
00044   int OPENGL_MAX_PROGRAM_ATTRIBS_ARB;
00045   int OPENGL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB;
00046   int OPENGL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB;
00047   int OPENGL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB;
00048   int OPENGL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB;
00049   int OPENGL_MAX_PROGRAM_ENV_PARAMETERS_ARB;
00050   int OPENGL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB;
00051   int OPENGL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB;
00052   int OPENGL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB;
00053   int OPENGL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB;
00054   int OPENGL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB;
00055   int OPENGL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB;
00056 
00057   
00058   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB,                &OPENGL_MAX_PROGRAM_INSTRUCTIONS_ARB) );
00059   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,         &OPENGL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB) );
00060   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB,                 &OPENGL_MAX_PROGRAM_TEMPORARIES_ARB) );
00061   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,          &OPENGL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB) );
00062   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_PARAMETERS_ARB,                  &OPENGL_MAX_PROGRAM_PARAMETERS_ARB) );
00063   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB,           &OPENGL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB) );
00064   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ATTRIBS_ARB,                     &OPENGL_MAX_PROGRAM_ATTRIBS_ARB) );
00065   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB,              &OPENGL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB) );
00066   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB,           &OPENGL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB) );
00067   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB,    &OPENGL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB) );
00068   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB,            &OPENGL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB) );
00069   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB,              &OPENGL_MAX_PROGRAM_ENV_PARAMETERS_ARB) );
00070   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB,            &OPENGL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB) );
00071   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,     &OPENGL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB) );
00072   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB,            &OPENGL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB) );
00073   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB,     &OPENGL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB) );
00074   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,            &OPENGL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB) );
00075   CHECKGL (glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB,     &OPENGL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB) );
00076   
00077   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_NONE, "---------------------------------------------");
00078   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_NONE, "Vertex Program");
00079   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_NONE, "---------------------------------------------");
00080   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_INSTRUCTIONS_ARB             = %d",  OPENGL_MAX_PROGRAM_INSTRUCTIONS_ARB);
00081   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB      = %d",  OPENGL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
00082   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_TEMPORARIES_ARB              = %d",  OPENGL_MAX_PROGRAM_TEMPORARIES_ARB);
00083   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_TEMPORARIES_ARB       = %d",  OPENGL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
00084   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_PARAMETERS_ARB               = %d",  OPENGL_MAX_PROGRAM_PARAMETERS_ARB);
00085   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_PARAMETERS_ARB        = %d",  OPENGL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
00086   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ATTRIBS_ARB                  = %d",  OPENGL_MAX_PROGRAM_ATTRIBS_ARB);
00087   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_ATTRIBS_ARB           = %d",  OPENGL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB);
00088   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ADDRESS_REGISTERS_ARB        = %d",  OPENGL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
00089   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = %d",  OPENGL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);
00090   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_LOCAL_PARAMETERS_ARB         = %d",  OPENGL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
00091   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ENV_PARAMETERS_ARB           = %d",  OPENGL_MAX_PROGRAM_ENV_PARAMETERS_ARB);
00092   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ALU_INSTRUCTIONS_ARB         = %d",  OPENGL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB);
00093   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB  = %d",  OPENGL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB);
00094   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_TEX_INSTRUCTIONS_ARB         = %d",  OPENGL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB);
00095   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB  = %d",  OPENGL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB);
00096   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_TEX_INDIRECTIONS_ARB         = %d",  OPENGL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
00097   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB  = %d",  OPENGL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB);
00098   
00099   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB,                &OPENGL_MAX_PROGRAM_INSTRUCTIONS_ARB) );
00100   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,         &OPENGL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB) );
00101   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB,                 &OPENGL_MAX_PROGRAM_TEMPORARIES_ARB) );
00102   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,          &OPENGL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB) );
00103   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_PARAMETERS_ARB,                  &OPENGL_MAX_PROGRAM_PARAMETERS_ARB) );
00104   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB,           &OPENGL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB) );
00105   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ATTRIBS_ARB,                     &OPENGL_MAX_PROGRAM_ATTRIBS_ARB) );
00106   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB,              &OPENGL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB) );
00107   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB,           &OPENGL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB) );
00108   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB,    &OPENGL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB) );
00109   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB,            &OPENGL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB) );
00110   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB,              &OPENGL_MAX_PROGRAM_ENV_PARAMETERS_ARB) );
00111   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB,            &OPENGL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB) );
00112   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,     &OPENGL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB) );
00113   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB,            &OPENGL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB) );
00114   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB,     &OPENGL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB) );
00115   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,            &OPENGL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB) );
00116   CHECKGL (glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB,     &OPENGL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB) );
00117   
00118   
00119   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_NONE, "---------------------------------------------");
00120   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_NONE, "Fragment Program");
00121   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_NONE, "---------------------------------------------");
00122   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_INSTRUCTIONS_ARB             = %d",  OPENGL_MAX_PROGRAM_INSTRUCTIONS_ARB);
00123   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB      = %d",  OPENGL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
00124   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_TEMPORARIES_ARB              = %d",  OPENGL_MAX_PROGRAM_TEMPORARIES_ARB);
00125   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_TEMPORARIES_ARB       = %d",  OPENGL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
00126   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_PARAMETERS_ARB               = %d",  OPENGL_MAX_PROGRAM_PARAMETERS_ARB);
00127   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_PARAMETERS_ARB        = %d",  OPENGL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
00128   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ATTRIBS_ARB                  = %d",  OPENGL_MAX_PROGRAM_ATTRIBS_ARB);
00129   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_ATTRIBS_ARB           = %d",  OPENGL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB);
00130   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ADDRESS_REGISTERS_ARB        = %d",  OPENGL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
00131   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = %d",  OPENGL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);
00132   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_LOCAL_PARAMETERS_ARB         = %d",  OPENGL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
00133   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ENV_PARAMETERS_ARB           = %d",  OPENGL_MAX_PROGRAM_ENV_PARAMETERS_ARB);
00134   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_ALU_INSTRUCTIONS_ARB         = %d",  OPENGL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB);
00135   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB  = %d",  OPENGL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB);
00136   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_TEX_INSTRUCTIONS_ARB         = %d",  OPENGL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB);
00137   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB  = %d",  OPENGL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB);
00138   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_TEX_INDIRECTIONS_ARB         = %d",  OPENGL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
00139   nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_INFO, "MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB  = %d",  OPENGL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB);
00140 
00141   delete graphics_display;
00142 }
00143 
00144 int main(int argc, char **argv)
00145 {
00146   nux::NuxCoreInitialize(0);
00147   nux::NuxGraphicsInitialize();
00148 
00149   ARBProgramLimits();
00150 
00151   return 0;
00152 }
00153