Example #1
0
int main(void){
	Console_Init();
	printf("Test Test\n");
	Console_Clear();
	printf("Testen Testen\n");
	Sleep(2000);
	return 0;
}
Example #2
0
void Console_Startup()
{
    setbuf(stdout, NULL);
    setbuf(stderr, NULL);

	outb(0x3D4, 0x0A);
	outb(0x3D5, 0x20);
	Console_Clear(Console_CreateAttributes(CONSOLE__LightWhite, CONSOLE__DarkBlack));
}
Example #3
0
int
main(void)
{
   SVGA3DUtil_InitFullscreen(CID, 800, 600);
   SVGA3DText_Init();

   vertexSid = SVGA3DUtil_DefineStaticBuffer(vertexData, sizeof vertexData);
   indexSid = SVGA3DUtil_DefineStaticBuffer(indexData, sizeof indexData);

   SVGA3D_DefineShader(CID, MY_VSHADER_ID, SVGA3D_SHADERTYPE_VS,
                       g_vs20_MyVertexShader, sizeof g_vs20_MyVertexShader);
   SVGA3D_DefineShader(CID, MY_PSHADER_ID, SVGA3D_SHADERTYPE_PS,
                       g_ps20_MyPixelShader, sizeof g_ps20_MyPixelShader);

   Matrix_Perspective(perspectiveMat, 45.0f,
                      gSVGA.width / (float)gSVGA.height, 10.0f, 100.0f);

   while (1) {
      if (SVGA3DUtil_UpdateFPSCounter(&gFPS)) {
         Console_Clear();
         Console_Format("Half-precision floating point test.\n"
                        "You should see four identical cubes.\n"
                        "\n"
                        "Top row: Fixed function, Bottom row: Shaders.\n"
                        "Left column: 32-bit float, Right column: 16-bit float.\n"
                        "\n%s",
                        gFPS.text);
         SVGA3DText_Update();
         VMBackdoor_VGAScreenshot();
      }

      SVGA3DUtil_ClearFullscreen(CID, SVGA3D_CLEAR_COLOR | SVGA3D_CLEAR_DEPTH,
                                 0x113366, 1.0f, 0);

      renderCube(-2, 2, FALSE, FALSE);   /* Top-left */
      renderCube(2, 2, FALSE, TRUE);     /* Top-right */
      renderCube(-2, -2, TRUE, FALSE);   /* Bottom-left */
      renderCube(2, -2, TRUE, TRUE);     /* Bottom-right */

      SVGA3DText_Draw();
      SVGA3DUtil_PresentFullscreen();
   }

   return 0;
}
Example #4
0
int
main(void)
{
   SVGA3DUtil_InitFullscreen(CID, 800, 600);
   SVGA3DText_Init();
   Keyboard_Init();
   APM_Init();

   vertexSid = SVGA3DUtil_DefineStaticBuffer(vertexData, sizeof vertexData);
   indexSid = SVGA3DUtil_DefineStaticBuffer(indexData, sizeof indexData);

   Matrix_Perspective(perspectiveMat, 45.0f,
                      gSVGA.width / (float)gSVGA.height, 0.1f, 100.0f);

   while (!Keyboard_IsKeyPressed(KEY_ESCAPE)) {

      if (SVGA3DUtil_UpdateFPSCounter(&gFPS)) {
         Console_Clear();
         Console_Format("VMware SVGA3D Example:\n"
                        "Spinning cube with static vertex and index buffer.\n"
                        "Drag with left mouse button to rotate.\n"
                        "Press ESC to exit.\n"
                        "\n%s",
                        gFPS.text);
         SVGA3DText_Update();
         VMBackdoor_VGAScreenshot();
      }

      while (VMBackdoor_MouseGetPacket(&lastMouseState));

      SVGA3DUtil_ClearFullscreen(CID, SVGA3D_CLEAR_COLOR | SVGA3D_CLEAR_DEPTH,
                                 0x113366, 1.0f, 0);
      render();
      SVGA3DText_Draw();
      SVGA3DUtil_PresentFullscreen();
   }

   APM_SetPowerState(POWER_OFF);
   return 0;
}
Example #5
0
int
main(void)
{
   SVGA3DUtil_InitFullscreen(CID, 800, 600);
   SVGA3DText_Init();

   vertexSid = SVGA3DUtil_DefineSurface2D(MESH_NUM_BYTES, 1, SVGA3D_BUFFER);
   indexSid = createIndexBuffer();

   SVGA3DUtil_AllocDMAPool(&vertexDMA, MESH_NUM_BYTES, 16);

   Matrix_Perspective(perspectiveMat, 45.0f,
                      gSVGA.width / (float)gSVGA.height, 0.1f, 100.0f);

   while (1) {
      if (SVGA3DUtil_UpdateFPSCounter(&gFPS)) {
         Console_Clear();
         Console_Format("VMware SVGA3D Example:\n"
                        "Dynamic vertex buffer stress-test.\n"
                        "This example performs a separate DMA and "
                        "Draw for each row of the mesh.\n\n%s",
                        gFPS.text);
         SVGA3DText_Update();
      }

      SVGA3DUtil_ClearFullscreen(CID, SVGA3D_CLEAR_COLOR | SVGA3D_CLEAR_DEPTH,
                                 0x113366, 1.0f, 0);

      setupFrame();
      render();

      SVGA3DText_Draw();
      SVGA3DUtil_PresentFullscreen();
   }

   return 0;
}
Example #6
0
int
main(void)
{
   uint32 frame = 0;
   uint32 lastTick = 0;

   Intr_Init();
   Intr_SetFaultHandlers(SVGA_DefaultFaultHandler);

   Timer_InitPIT(PIT_HZ / FRAME_RATE);
   Intr_SetMask(PIT_IRQ, TRUE);
   Intr_SetHandler(IRQ_VECTOR(PIT_IRQ), timerISR);

   SVGA_Init();
   GMR_Init();
   Heap_Reset();
   SVGA_SetMode(0, 0, 32);
   Screen_Init();
   ScreenDraw_Init(GMRID_SCREEN_DRAW);

   allocNoise();

   /*
    * Define a screen.
     */

   SVGAScreenObject myScreen = {
      .structSize = sizeof(SVGAScreenObject),
      .id = SCREEN_ID,
      .flags = SVGA_SCREEN_HAS_ROOT | SVGA_SCREEN_IS_PRIMARY,
      .size = { 800, 600 },
      .root = { 0, 0 },
   };
   Screen_Define(&myScreen);

   /*
    * Draw some explanatory text.
    */

   char docString[] =
      "Annotated Blit Sample:"
      "\n\n"
      "You should see two moving rectangles. The left one is animated "
      "using a fill-annotated blit. The blit itself contains random "
      "noise, but the annotation is a blue fill. If your host is "
      "using the annotation, you will see the blue. If not, you'll "
      "see noise. Either one is correct, but it is often more efficient "
      "to use the fill."
      "\n\n"
      "The right one is a copy-annotated blit. The blit data is again "
      "random noise, and the copy is a screen-to-screen copy which "
      "moves the rectangle from its old position to the new position. "
      "We drew a checkerboard pattern to the screen once, and that "
      "pattern should be preserved indefinitely if the annotation is "
      "being executed correctly."
      "\n\n"
      "Both rectangles should have a 1-pixel solid white border, and "
      "in both cases we use a fill-annotated blit to clear the screen "
      "behind each rectangle. This annotation doesn't lie, its blit data "
      "matches the advertised fill color.";

   ScreenDraw_SetScreen(myScreen.id, myScreen.size.width, myScreen.size.height);
   Console_Clear();
   ScreenDraw_WrapText(docString, 770);
   Console_WriteString(docString);

   /*
    * Animate the two rectangles indefinitely, sleeping between frames.
    */

   while (1) {
      SVGASignedRect oldRect1, oldRect2;
      SVGASignedRect newRect1, newRect2;

      /*
       * Move them around in a circle.
       */

      float theta = frame * 0.01;

      newRect1.left = 190 + cosf(theta) * 60;
      newRect1.top = 350 + sinf(theta) * 60;
      newRect1.right = newRect1.left + 80;
      newRect1.bottom = newRect1.top + 120;

      newRect2.left = 530 + sinf(theta) * 60;
      newRect2.top = 350 + cosf(theta) * 60;
      newRect2.right = newRect2.left + 80;
      newRect2.bottom = newRect2.top + 120;

      /*
       * Update the position of each.
       */

      updateFillRect(frame ? &oldRect1 : NULL, &newRect1);
      updateCopyRect(frame ? &oldRect2 : NULL, &newRect2);

      oldRect1 = newRect1;
      oldRect2 = newRect2;

      /*
       * Wait for the next timer tick.
       */

      while (timerTick == lastTick) {
         Intr_Halt();
      }
      lastTick = timerTick;
      frame++;
   }

   return 0;
}
Example #7
0
static void
initScreens(void)
{
   static const SVGAScreenObject screen = {
      .structSize = sizeof(SVGAScreenObject),
      .id = 0,
      .flags = SVGA_SCREEN_HAS_ROOT | SVGA_SCREEN_IS_PRIMARY,
      .size = { 1024, 768 },
      .root = { 1000, 2000 },
   };

   Screen_Define(&screen);

   ScreenDraw_SetScreen(screen.id, screen.size.width, screen.size.height);
   Console_Clear();

   Console_Format("Surface-to-Screen Blit Clipping Test\n");
   ScreenDraw_Border(0, 0, screen.size.width, screen.size.height, 0xFF0000, 1);

   Console_MoveTo(20, 45);
   Console_Format("Stair-step clipping (small tiles)");

   Console_MoveTo(20, 245);
   Console_Format("Top/bottom halves swapped");

   Console_MoveTo(20, 445);
   Console_Format("Scaled bottom half, with hole");

   Console_MoveTo(350, 65);
   Console_Format("Zoomed to 1.5x full screen, two circular clip regions");

   Console_MoveTo(5, 660);
   Console_Format("Stair-step, clipped against screen edges");
}


/*
 * presentWithClipBuf --
 *
 *    Present our surface to the screen, with clipping data from a ClipBuffer.
 *
 *    The supplied ClipBuffer is always in screen coordinates. We
 *    convert them into dest-relative coordinates for the
 *    surface-to-screen blit.
 */

static void
presentWithClipBuf(ClipBuffer *buf, int dstL, int dstT, int dstR, int dstB)
{
   SVGASignedRect srcRect = { 0, 0, surfWidth, surfHeight };
   SVGASignedRect dstRect = { dstL, dstT, dstR, dstB };
   SVGASignedRect *clip;
   int i;

   SVGA3D_BeginBlitSurfaceToScreen(&colorImage, &srcRect, 0,
                                   &dstRect, &clip, buf->numRects);

   for (i = 0; i < buf->numRects; i++) {
      clip->left = buf->rects[i].left - dstL;
      clip->top = buf->rects[i].top - dstT;
      clip->right = buf->rects[i].right - dstL;
      clip->bottom = buf->rects[i].bottom - dstT;
      clip++;
   }

   SVGA_FIFOCommitAll();
}