STDMETHODIMP CGfxTitanII::Open(DWORD dwWidth, DWORD dwHeight, DWORD dwBuffers, const DWORD *pdwFourCC, IMcPreInit* pPrepareData, RECT* pDst) { if(dwWidth==0 || dwHeight==0) return E_FAIL; if(m_bOpen) return E_FAIL; m_bOpen = true; m_sync = SX_ASYNC_WAITVSYNC; LoadRendererDll(); m_dwWidth = dwWidth; m_dwHeight = dwHeight; m_dispmode.smode = VR_SCR_NORMAL; m_dispmode.dmode = VR_DISP_FULL; m_dispmode.rmode = VR_REN_NORMAL; if(!m_pVr) { if(m_CVR_CreateVideoRender(&m_pVr, NULL) != VR_OK) return E_FAIL; m_internal_hnd = true; } else m_internal_hnd = false; ZeroMemory(&m_rectSrc,sizeof(m_rectSrc)); ZeroMemory(&m_rectDst,sizeof(m_rectDst)); ZeroMemory(&m_rectBltDst,sizeof(m_rectBltDst)); memset(&m_BSMBackBuffer, 0 ,sizeof(m_BSMBackBuffer));; if(m_bUseDSP) { // hack because of poor DSP memory allocation if(dwWidth*dwHeight >= 704*480) m_dwMaxBuffers = min(4,dwBuffers); //dwBuffers; else m_dwMaxBuffers = min(8,dwBuffers); //dwBuffers; } else m_dwMaxBuffers = dwBuffers; if(*pdwFourCC == MAKEFOURCC('P', 'B', 'S', '1')) { m_bBSMMode = TRUE; } else { m_bBSMMode = FALSE; } m_bShow = FALSE; m_bScnClip = TRUE; SetRect(&m_rectScn,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)); SetRect(&m_rectDst, 0,0,ZERO_RECT_WIDTH,ZERO_RECT_HEIGHT); //m_rectDst = m_rectScn; return CreateSurfaces(); }
bool DXVA2Decoder::Init(MythRenderD3D9* render) { bool ok = true; CREATE_CHECK(m_width > 0, "Invalid width.") CREATE_CHECK(m_height > 0, "Invalid height.") CREATE_CHECK(CreateVideoService(render), "Failed to create video service.") CREATE_CHECK(GetInputOutput(), "Failed to find input/output combination.") InitFormat(); CREATE_CHECK(GetDecoderConfig(), "Failed to find a raw input bitstream.") CREATE_CHECK(CreateSurfaces(), "Failed to create surfaces.") CREATE_CHECK(CreateDecoder(), "Failed to create decoder.") return ok; }
void PezInitialize() { TweakBar = TwNewBar("TweakBar"); TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with GLUT and OpenGL.' "); // Message added to the help bar. TwDefine(" TweakBar size='200 400' color='96 216 224' "); // change default tweak bar size and color TwAddVarRW(TweakBar, "Theta", TW_TYPE_FLOAT, &Scene.Theta, " min=0.01 max=6.28 step=0.01 "); TwAddVarRW(TweakBar, "TargetVector", TW_TYPE_DIR3F, &TargetVector, " "); TwAddVarRW(TweakBar, "TargetScale", TW_TYPE_FLOAT, &TargetScale, " min=0.01 max=10.00 step=0.01 "); TwAddVarRW(TweakBar, "EyeVector", TW_TYPE_DIR3F, &EyeVector, " "); TwAddVarRW(TweakBar, "EyeScale", TW_TYPE_FLOAT, &EyeScale, " min=0.01 max=10.00 step=0.01 "); TwAddVarRW(TweakBar, "YScale", TW_TYPE_FLOAT, &YScale, " min=0.01 max=10.00 step=0.01 "); TwAddVarRW(TweakBar, "YOffset", TW_TYPE_FLOAT, &YOffset, " min=0.01 max=10.00 step=0.01 "); TwAddVarRW(TweakBar, "TessLevel", TW_TYPE_FLOAT, &TessLevel, " min=1.0 max=10.00 step=0.01 "); TwAddButton(TweakBar, "Lookup AO", LookupAoCallback, 0, ""); TwAddVarRW(TweakBar, "Show AO", TW_TYPE_BOOL8, &ShowAO, ""); PezConfig cfg = PezGetConfig(); pezAddPath("../Cover/PostTess/", ".glsl"); Scene.DisplayProgram = LoadProgram("PostTess.VS", "PostTess.TessControl", "PostTess.TessEval", 0, "PostTess.Display"); Scene.FloorProgram = LoadProgram("PostTess.VS", "PostTess.TessControl", "PostTess.TessEval", 0, "PostTess.Floor"); Scene.OffscreenProgram = LoadProgram("PostTess.VS", "PostTess.TessControl", "PostTess.TessEval", 0, "PostTess.Offscreen"); Scene.QuadProgram = LoadProgram("PostTess.Quad.VS", 0, 0, 0, "PostTess.Quad.FS"); Scene.Theta = 2.36f; Scene.Surfaces = CreateSurfaces(cfg.Width, cfg.Height, 4, 3); GLenum err = glGetError(); pezCheck(err == GL_NO_ERROR, "OpenGL error.\n"); Scene.QuadVao = CreateQuad(); ReadVerts("../Cover/PreTess/City.dat"); glEnable(GL_DEPTH_TEST); glClearColor(0, 0, 0, 0); glGenTextures(1, &Scene.CompositeTexture); glBindTexture(GL_TEXTURE_2D, Scene.CompositeTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, cfg.Width, cfg.Height, GL_FALSE, GL_RGBA, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); err = glGetError(); pezCheck(err == GL_NO_ERROR, "OpenGL error.\n"); }
bool Direct3D9Video::Reset (bool fNewDevice_) { static bool fResetting = false; HRESULT hr = 0; if (!m_pd3d || fResetting) return false; if (m_pTexture) m_pTexture->Release(), m_pTexture = NULL; if (m_pScanlineTexture) m_pScanlineTexture->Release(), m_pScanlineTexture = NULL; if (m_pVertexBuffer) m_pVertexBuffer->Release(), m_pVertexBuffer = NULL; m_d3dpp.BackBufferWidth = m_rTarget.right - m_rTarget.left; m_d3dpp.BackBufferHeight = m_rTarget.bottom - m_rTarget.top; if (m_pd3dDevice && !fNewDevice_) { fResetting = true; if (FAILED(hr = m_pd3dDevice->Reset(&m_d3dpp))) TRACE("Reset() returned %#08lx\n", hr); fResetting = false; } else { if (m_pd3dDevice) m_pd3dDevice->Release(), m_pd3dDevice = NULL; hr = CreateDevice(); } if (m_pd3dDevice) { m_pd3dDevice->SetDialogBoxMode(TRUE); m_pd3dDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); m_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); m_pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); m_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); CreateSurfaces(); CreateVertices(); } Video::SetDirty(); return SUCCEEDED(hr); }
STDMETHODIMP CGfxFB::Open(DWORD dwWidth, DWORD dwHeight, DWORD dwBuffers, const DWORD *pdwFourCC, IMcPreInit* pPrepareData, RECT* pDst) { POINT pt; if(dwWidth==0 || dwHeight==0) return E_FAIL; m_dwWidth = dwWidth; m_dwHeight = dwHeight; if(pdwFourCC) m_pdwFourCCList = pdwFourCC; else m_pdwFourCCList = const_dwFourCC; DP("[GFXFB]Open w:%d h:%d \n",m_dwWidth, m_dwHeight); pt.x = m_rectDst.left; pt.y = m_rectDst.top; m_bScnClip = TRUE; return CreateSurfaces(dwBuffers); }
static int Setup( vlc_va_t *p_external, void **pp_hw_ctx, vlc_fourcc_t *pi_chroma, int i_width, int i_height ) { vlc_va_vaapi_t *p_va = vlc_va_vaapi_Get(p_external); if( p_va->i_surface_width == i_width && p_va->i_surface_height == i_height ) { *pp_hw_ctx = &p_va->hw_ctx; *pi_chroma = p_va->i_surface_chroma; return VLC_SUCCESS; } *pp_hw_ctx = NULL; *pi_chroma = 0; if( p_va->i_surface_width || p_va->i_surface_height ) DestroySurfaces( p_va ); if( i_width > 0 && i_height > 0 ) return CreateSurfaces( p_va, pp_hw_ctx, pi_chroma, i_width, i_height ); return VLC_EGENERIC; }
void ezioEmulator::Run(void) { CreateSurfaces(); SDL_Thread *thread_input = SDL_CreateThread(ezioReadPort, (void *)this); SDL_Event event; struct ezioEventInput *input; while (!terminate && SDL_WaitEvent(&event) > 0) { if (event.type == SDL_QUIT || (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_q)) break; else if (event.type == SDL_KEYUP) { switch (event.key.keysym.sym) { case SDLK_UP: device->OnButtonUp(EZIO_BUTTON_UP); break; case SDLK_DOWN: device->OnButtonUp(EZIO_BUTTON_DOWN); break; case SDLK_RETURN: device->OnButtonUp(EZIO_BUTTON_ENTER); break; case SDLK_ESCAPE: device->OnButtonUp(EZIO_BUTTON_ESC); break; } } else if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { case SDLK_UP: device->OnButtonDown(EZIO_BUTTON_UP); break; case SDLK_DOWN: device->OnButtonDown(EZIO_BUTTON_DOWN); break; case SDLK_RETURN: device->OnButtonDown(EZIO_BUTTON_ENTER); break; case SDLK_ESCAPE: device->OnButtonDown(EZIO_BUTTON_ESC); break; } } else if (event.type == SDL_USEREVENT) { switch (event.user.code) { case EZIO_EVENT_INPUT: input = (struct ezioEventInput *)event.user.data1; OnEventInput(input); if (input->length && input->data) delete [] input->data; delete input; break; case EZIO_EVENT_BLINK: OnEventBlink(); break; case EZIO_EVENT_ERROR: terminate = true; printf("%s: %s\n", (const char *)event.user.data1, (const char *)event.user.data2); free(event.user.data1); free(event.user.data2); break; default: throw ezioException(EZIOEX_EMUL_UNHANDLED_EVENT); } } } terminate = true; Sint32 thread_result; SDL_WaitThread(thread_input, &thread_result); }