예제 #1
0
//-- Start --------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
bool ShadeWorm_c::Start()
{
	if (D3D_OK != D3DXCreateTextureFromFile(m_device, "q:\\ScreenSavers\\MrC\\Particle.bmp", &m_spriteTexture))
		return false;

	if (D3D_OK  != m_device->CreateTexture(512, 512, 1, 0, D3DFMT_X8R8G8B8, 0, &m_bufferTexture))
		return false;

	if (D3D_OK  != m_device->CreateTexture(1, 256, 1, 0, D3DFMT_X8R8G8B8, 0, &m_colMapTexture))
		return false;

	if (S_OK != XGAssembleShader(NULL, m_shaderColourMapSrc, strlen(m_shaderColourMapSrc), 0, NULL, &m_pUcode, NULL, NULL, NULL, NULL, NULL))
		return false;

	if (D3D_OK  != m_device->CreatePixelShader((D3DPIXELSHADERDEF*)(DWORD*)m_pUcode->pData, &m_pShader))
	{
		return false;
	}

	LoadSettings(m_saverName);

	if (m_numColMaps == 0)
		return false;

	return true;

} // Start
예제 #2
0
unsigned int CComboRenderer::PreInit()
{
  CXBoxRenderer::PreInit();
  // May have to set clearColour non-zero in future for HW overlays method?
//  if (!m_clearColour)
//    m_clearColour = 0x010001;

  m_bHasDimView = false;
  // Create the pixel shader
  if (!m_hPixelShader)
  {
    // shader to interleave separate Y U and V planes into a single YUY2 output
    const char* shader =
      "xps.1.1\n"
      "def c0,1,0,0,0\n"
      "def c1,0,1,0,0\n"
      "def c2,0,0,1,0\n"
      "def c3,0,0,0,1\n"
      "tex t0\n" // Y1 plane (Y plane)
      "tex t1\n" // U plane
      "tex t2\n" // Y2 plane (Y plane shifted 1 pixel to the left)
      "tex t3\n" // V plane
      "xmma discard,discard,r0, t0, c0, t1, c1\n"
      "xmma discard,discard,r1, t2, c2, t3.b, c3\n"
      "add r0, r0, r1\n";
    XGBuffer* pShader;
    XGAssembleShader("XBMCShader", shader, strlen(shader), 0, NULL, &pShader, NULL, NULL, NULL, NULL, NULL);
    m_pD3DDevice->CreatePixelShader((D3DPIXELSHADERDEF*)pShader->GetBufferPointer(), &m_hPixelShader);
    pShader->Release();
  }

  m_pD3DDevice->EnableOverlay(TRUE);
  return 0;
}