示例#1
0
void renderchain_render_pass(void *data, Pass &pass, unsigned pass_index)
{
   renderchain_t *chain = (renderchain_t*)data;
   LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
   renderchain_set_shaders(chain, pass.fPrg, pass.vPrg);

   d3dr->SetTexture(0, pass.tex);
   D3DDevice_SetSamplerState_MinFilter(d3dr, 0, translate_filter(pass.info.pass->filter));
   D3DDevice_SetSamplerState_MagFilter(d3dr, 0, translate_filter(pass.info.pass->filter));

#ifdef _XBOX1
   d3dr->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);
#else
   d3dr->SetVertexDeclaration(pass.vertex_decl);
#endif
   for (unsigned i = 0; i < 4; i++)
   {
      D3DDevice_SetStreamSources(d3dr, i, pass.vertex_buf, 0, sizeof(Vertex));
   }

   renderchain_bind_orig(chain, pass);
   renderchain_bind_prev(chain, pass);
   renderchain_bind_pass(chain, pass, pass_index);
   renderchain_bind_luts(chain, pass);
   renderchain_bind_tracker(chain, pass, pass_index);

   D3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);

   // So we don't render with linear filter into render targets,
   // which apparently looked odd (too blurry).
   D3DDevice_SetSamplerState_MinFilter(d3dr, 0, D3DTEXF_POINT);
   D3DDevice_SetSamplerState_MagFilter(d3dr, 0, D3DTEXF_POINT);

   renderchain_unbind_all(chain);
}
示例#2
0
static void renderchain_render_pass(
      cg_renderchain_t *chain,
      Pass *pass,
      unsigned pass_index)
{
   unsigned i;

   if (!chain)
      return;
   
   renderchain_set_shaders(chain, &pass->fPrg, &pass->vPrg);

   d3d_set_texture(chain->dev, 0, pass->tex);
   d3d_set_sampler_minfilter(chain->dev, 0,
         translate_filter(pass->info.pass->filter));
   d3d_set_sampler_magfilter(chain->dev, 0,
         translate_filter(pass->info.pass->filter));

   d3d_set_vertex_declaration(chain->dev, pass->vertex_decl);
   for (i = 0; i < 4; i++)
      d3d_set_stream_source(chain->dev, i,
            pass->vertex_buf, 0, sizeof(Vertex));

   renderchain_bind_orig(chain, pass);
   renderchain_bind_prev(chain, pass);
   renderchain_bind_pass(chain, pass, pass_index);
   renderchain_bind_luts(chain, pass);
   renderchain_bind_tracker(chain, pass, pass_index);

   d3d_draw_primitive(chain->dev, D3DPT_TRIANGLESTRIP, 0, 2);

   /* So we don't render with linear filter into render targets,
    * which apparently looked odd (too blurry). */
   d3d_set_sampler_minfilter(chain->dev, 0, D3DTEXF_POINT);
   d3d_set_sampler_magfilter(chain->dev, 0, D3DTEXF_POINT);

   renderchain_unbind_all(chain);
}