예제 #1
0
void VertexShader::set()
{
    if (nullptr == shader)
    {
        throw ShaderCompileError("Tried to set vertex shader that was not compiled");
    }
    get_renderer()->get_context()->IASetInputLayout(vertex_layout);
    get_renderer()->get_context()->VSSetShader(shader, nullptr, 0);
}
예제 #2
0
void plat_video_toggle_renderer(int change, int is_menu_call)
{
	change_renderer(change);

	if (is_menu_call)
		return;

	vid_reset_mode();
	rendstatus_old = -1;

	if (PicoAHW & PAHW_32X)
		emu_status_msg(renderer_names32x[get_renderer()]);
	else
		emu_status_msg(renderer_names[get_renderer()]);
}
예제 #3
0
static int
pixman_renderer_create_surface(struct weston_surface *surface)
{
	struct pixman_surface_state *ps;
	struct pixman_renderer *pr = get_renderer(surface->compositor);

	ps = calloc(1, sizeof *ps);
	if (!ps)
		return -1;

	surface->renderer_state = ps;

	ps->surface = surface;

	ps->surface_destroy_listener.notify =
		surface_state_handle_surface_destroy;
	wl_signal_add(&surface->destroy_signal,
		      &ps->surface_destroy_listener);

	ps->renderer_destroy_listener.notify =
		surface_state_handle_renderer_destroy;
	wl_signal_add(&pr->destroy_signal,
		      &ps->renderer_destroy_listener);

	return 0;
}
예제 #4
0
void PixelShader::set()
{
    if (nullptr == shader)
    {
        throw ShaderCompileError("Tried to set pixel shader that was not compiled");
    }
    get_renderer()->get_context()->PSSetShader(shader, nullptr, 0);
}
예제 #5
0
void GeometryShader::set()
{
    if (nullptr == shader)
    {
        throw ShaderCompileError("Tried to set geometry shader that was not compiled");
    }
    get_renderer()->get_context()->GSSetShader(shader, nullptr, 0);
}
예제 #6
0
void pemu_finalize_frame(const char *fps, const char *notice)
{
	int emu_opt = currentConfig.EmuOpt;
	int ret;

	if (PicoAHW & PAHW_32X)
		; // nothing to do
	else if (get_renderer() == RT_8BIT_FAST)
	{
		// 8bit fast renderer
		if (Pico.m.dirtyPal) {
			Pico.m.dirtyPal = 0;
			ret = make_local_pal(1);
			// feed new palette to our device
			gp2x_video_setpalette(localPal, ret);
		}
		// a hack for VR
		if (PicoAHW & PAHW_SVP)
			memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);
		// do actual copy
		vidcpyM2(g_screen_ptr, PicoDraw2FB+328*8,
			!(Pico.video.reg[12] & 1), !(PicoOpt & POPT_DIS_32C_BORDER));
	}
	else if (get_renderer() == RT_8BIT_ACC)
	{
		// 8bit accurate renderer
		if (Pico.m.dirtyPal)
		{
			Pico.m.dirtyPal = 0;
			ret = make_local_pal(0);
			gp2x_video_setpalette(localPal, ret);
		}
	}

	if (notice)
		osd_text(4, osd_y, notice);
	if (emu_opt & EOPT_SHOW_FPS)
		osd_text(osd_fps_x, osd_y, fps);
	if ((PicoAHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
		draw_cd_leds();
	if (PicoAHW & PAHW_PICO)
		draw_pico_ptr();
}
예제 #7
0
static void
pixman_renderer_destroy(struct weston_compositor *ec)
{
	struct pixman_renderer *pr = get_renderer(ec);

	wl_signal_emit(&pr->destroy_signal, pr);
	weston_binding_destroy(pr->debug_binding);
	free(pr);

	ec->renderer = NULL;
}
예제 #8
0
void
edit_interface_rep::handle_clear (SI x1, SI y1, SI x2, SI y2) {
  renderer win= get_renderer (this);
  x1 *= sfactor; y1 *= sfactor; x2 *= sfactor; y2 *= sfactor;
  win->set_shrinking_factor (sfactor);
  tree bg= get_init_value (BG_COLOR);
  win->set_background_pattern (bg);
  win->clear_pattern (max (eb->x1, x1), max (eb->y1, y1),
		      min (eb->x2, x2), min (eb->y2, y2));
  draw_surround (win, rectangle (x1, y1, x2, y2));
  win->set_shrinking_factor (1);
}
예제 #9
0
void
edit_interface_rep::draw_post (renderer ren, rectangle r) {
  renderer win= get_renderer (this);
  win->set_shrinking_factor (sfactor);
  ren->set_shrinking_factor (sfactor);
  draw_context (ren, r);
  draw_env (ren);
  draw_selection (ren);
  draw_graphics (ren);
  draw_cursor (ren); // the text cursor must be drawn over the graphical object
  ren->set_shrinking_factor (1);
  win->set_shrinking_factor (1);
}
예제 #10
0
파일: menu.c 프로젝트: d0nn13/MASHUG
void   		space_menu()
{
  SDL_Event    	e;

  display_menu();
  SDL_RenderPresent(get_renderer());
  while (get_launcher() == &space_menu)
  {
    if (SDL_WaitEvent(&e))
    {
      if (e.type == SDL_QUIT)
      {
	space_destroy();
	set_launcher(NULL);
	break;
      }
      if (e.type == SDL_KEYDOWN)
	if (!process_input(&e.key.keysym.scancode, &item))
	  continue;
      display_menu();
      SDL_RenderPresent(get_renderer());
    }
  }
}
예제 #11
0
void
edit_interface_rep::draw_with_stored (rectangle r) {
  renderer win= get_renderer (this);
  //cout << "Redraw " << (r/(sfactor*PIXEL)) << "\n";

  /* Verify whether the backing store is still valid */
  if (!is_nil (stored_rects)) {
    SI w1, h1, w2, h2;
    win   -> get_extents (w1, h1);
    stored -> get_extents (w2, h2);
    if (stored->ox != win->ox || stored->oy != win->oy ||
	w1 != w2 || h1 != h2) {
      // cout << "x"; cout.flush ();
      stored_rects= rectangles ();
    }
  }

  /* Either draw with backing store or regenerate */
  rectangle sr= r / sfactor;
  if (is_nil (rectangles (r) - stored_rects) && !is_nil (stored_rects)) {
    // cout << "*"; cout.flush ();
    win->new_shadow (shadow);
    win->get_shadow (shadow, sr->x1, sr->y1, sr->x2, sr->y2);
    shadow->put_shadow (stored, sr->x1, sr->y1, sr->x2, sr->y2);
    draw_post (shadow, r);
    win->put_shadow (shadow, sr->x1, sr->y1, sr->x2, sr->y2);
  }
  else {
    // cout << "."; cout.flush ();
    draw_with_shadow (r);
    if (!win->interrupted ()) {
      if (inside_active_graphics ()) {
	shadow->new_shadow (stored);
	shadow->get_shadow (stored, sr->x1, sr->y1, sr->x2, sr->y2);
	//stored_rects= /*stored_rects |*/ rectangles (r);
	stored_rects= simplify (rectangles (r, stored_rects));
	//cout << "Stored: " << stored_rects << "\n";
	//cout << "M"; cout.flush ();
      }
      draw_post (shadow, r);
      win->put_shadow (shadow, sr->x1, sr->y1, sr->x2, sr->y2);
    }
    else draw_post (win, r);
  }
}
예제 #12
0
void
edit_interface_rep::draw_pre (renderer ren, rectangle r) {
  // draw surroundings
  tree bg= get_init_value (BG_COLOR);
  ren->set_background_pattern (bg);
  clear_pattern_rectangles (ren, rectangles (translate (r, ren->ox, ren->oy)));
  draw_surround (ren, r);

  // predraw cursor
  renderer win= get_renderer (this);
  draw_cursor (ren);
  rectangles l= copy_always;
  while (!is_nil (l)) {
    rectangle lr (l->item);
    win->put_shadow (ren, lr->x1, lr->y1, lr->x2, lr->y2);
    l= l->next;
  }
}
예제 #13
0
void
edit_interface_rep::draw_with_shadow (rectangle r) {
  renderer win= get_renderer (this);
  rectangle sr= r / sfactor;
  win->new_shadow (shadow);
  win->get_shadow (shadow, sr->x1, sr->y1, sr->x2, sr->y2);
  renderer ren= shadow;

  rectangles l;
  win->set_shrinking_factor (sfactor);
  ren->set_shrinking_factor (sfactor);
  draw_pre (ren, r);
  draw_text (ren, l);
  ren->set_shrinking_factor (1);
  win->set_shrinking_factor (1);

  if (ren->interrupted ()) {
    ren->set_shrinking_factor (sfactor);
    l= l & rectangles (translate (r, ren->ox, ren->oy));
    simplify (l);
    copy_always= translate (copy_always, ren->ox, ren->oy);
    while (!is_nil (copy_always)) {
      l= rectangles (copy_always->item, l);
      copy_always= copy_always->next;
    }
    ren->set_shrinking_factor (1);

    draw_post (ren, r);
    while (!is_nil(l)) {
      SI x1= (l->item->x1)/sfactor - ren->ox - PIXEL;
      SI y1= (l->item->y1)/sfactor - ren->oy - PIXEL;
      SI x2= (l->item->x2)/sfactor - ren->ox + PIXEL;
      SI y2= (l->item->y2)/sfactor - ren->oy + PIXEL;
      ren->outer_round (x1, y1, x2, y2);
      win->put_shadow (ren, x1, y1, x2, y2);
      l= l->next;
    }
  }
}
예제 #14
0
 //! Displays statistics button.
 void display_stats_button() { SDL_RenderCopy(const_cast<SDL_Renderer*>(get_renderer()), stats_texture, NULL, &stats_rect); }
예제 #15
0
 //! Updates game score from string.
 //! \param score string to show.
 void update_score(std::string score)
 {
     SDL_Surface* textSurface = TTF_RenderText_Blended(game_window_font, ("Score: " + score).c_str(), Definitions::WHITE_COLOR);
     game_score_texture = SDL_CreateTextureFromSurface(const_cast<SDL_Renderer*>(get_renderer()), textSurface);
     game_score_rect.w = textSurface->w;
     SDL_FreeSurface(textSurface);
 }
예제 #16
0
void VertexShader::unset()
{
    get_renderer()->get_context()->VSSetShader(nullptr, nullptr, 0);
}
예제 #17
0
static void vid_reset_mode(void)
{
	int gp2x_mode = 16;
	int renderer = get_renderer();

	PicoOpt &= ~POPT_ALT_RENDERER;
	emu_scan_begin = NULL;
	emu_scan_end = NULL;

	switch (renderer) {
	case RT_16BIT:
		PicoDrawSetOutFormat(PDF_RGB555, 0);
		PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
		break;
	case RT_8BIT_ACC:
		PicoDrawSetOutFormat(PDF_8BIT, 0);
		PicoDrawSetOutBuf(g_screen_ptr, g_screen_width);
		gp2x_mode = 8;
		break;
	case RT_8BIT_FAST:
		PicoOpt |= POPT_ALT_RENDERER;
		PicoDrawSetOutFormat(PDF_NONE, 0);
		vidcpyM2 = vidcpy_m2;
		gp2x_mode = 8;
		break;
	default:
		printf("bad renderer\n");
		break;
	}

	if (PicoAHW & PAHW_32X) {
		// Wiz 16bit is an exception, uses line rendering due to rotation mess
		if (renderer == RT_16BIT && (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)) {
			PicoDrawSetOutFormat(PDF_RGB555, 1);
		}
		else {
			PicoDrawSetOutFormat(PDF_NONE, 0);
		}
		PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
		gp2x_mode = 16;
	}

	if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
		if ((PicoAHW & PAHW_32X) || renderer == RT_16BIT) {
			emu_scan_begin = EmuScanBegin16_rot;
			emu_scan_end = EmuScanEnd16_rot;
		}
		else if (renderer == RT_8BIT_ACC) {
			emu_scan_begin = EmuScanBegin8_rot;
			emu_scan_end = EmuScanEnd8_rot;
		}
		else if (renderer == RT_8BIT_FAST)
			vidcpyM2 = vidcpy_m2_rot;
	}

	PicoDrawSetCallbacks(emu_scan_begin, emu_scan_end);

	if (is_16bit_mode())
		osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text16_rot : emu_osd_text16;
	else
		osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text8_rot : osd_text8;

	gp2x_video_wait_vsync();
	if (!is_16bit_mode()) {
		// setup pal for 8-bit modes
		localPal[0xc0] = 0x0000c000; // MCD LEDs
		localPal[0xd0] = 0x00c00000;
		localPal[0xe0] = 0x00000000; // reserved pixels for OSD
		localPal[0xf0] = 0x00ffffff;
		gp2x_video_setpalette(localPal, 0x100);
		gp2x_memset_all_buffers(0, 0xe0, 320*240);
	}
	else
		gp2x_memset_all_buffers(0, 0, 320*240*2);

	if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)
		gp2x_mode = -gp2x_mode;

	gp2x_video_changemode(gp2x_mode, Pico.m.pal);

	Pico.m.dirtyPal = 1;

	PicoOpt &= ~POPT_EN_SOFTSCALE;
	if (currentConfig.scaling == EOPT_SCALE_SW)
		PicoOpt |= POPT_EN_SOFTSCALE;

	// palette converters for 8bit modes
	make_local_pal = (PicoAHW & PAHW_SMS) ? make_local_pal_sms : make_local_pal_md;
}
예제 #18
0
HRESULT VertexShader::create(const void * shader_code, unsigned code_size)
{
    if( FAILED( get_renderer()->get_device()->CreateInputLayout(vertex_desc, vertex_desc_num, shader_code, code_size, &vertex_layout) ) )
        throw VertexDeclarationInitError();
    return get_renderer()->get_device()->CreateVertexShader(shader_code, code_size, nullptr, &shader);
}
예제 #19
0
 //! Displays game score.
 void display_score() { SDL_RenderCopy(const_cast<SDL_Renderer*>(get_renderer()), game_score_texture, NULL, &game_score_rect); }
예제 #20
0
HRESULT GeometryShader::create(const void * shader_code, unsigned code_size)
{
    return get_renderer()->get_device()->CreateGeometryShader(shader_code, code_size, nullptr, &shader);
}
예제 #21
0
void PixelShader::unset()
{
    get_renderer()->get_context()->PSSetShader(nullptr, nullptr, 0);
}
예제 #22
0
void GeometryShader::unset()
{
    get_renderer()->get_context()->GSSetShader(nullptr, nullptr, 0);
}
예제 #23
0
 //! Displayes game over message.
 //! \param yes Toggle for displaying or not.
 void display_game_over(bool yes) { if (yes) SDL_RenderCopy(const_cast<SDL_Renderer*>(get_renderer()), game_over_texture, NULL, &game_over_rect); }