2012-10-26 19:09:30 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2012-10-26 19:09:30 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "render_chain.hpp"
|
2014-01-15 16:24:24 +00:00
|
|
|
#include <string.h>
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-08-19 19:22:39 +00:00
|
|
|
static inline D3DTEXTUREFILTERTYPE translate_filter(unsigned type)
|
2014-03-07 18:13:20 +00:00
|
|
|
{
|
|
|
|
if (type == RARCH_FILTER_UNSPEC)
|
|
|
|
return g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
2014-09-08 18:08:49 +00:00
|
|
|
return type == RARCH_FILTER_LINEAR ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
2014-03-07 18:13:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline D3DTEXTUREFILTERTYPE translate_filter(bool smooth)
|
|
|
|
{
|
|
|
|
return smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
|
|
|
}
|
|
|
|
|
2014-03-04 17:19:47 +00:00
|
|
|
#ifdef HAVE_CG
|
2014-03-04 17:24:47 +00:00
|
|
|
#include "render_chain_cg.h"
|
2014-01-15 18:00:46 +00:00
|
|
|
#endif
|
2014-03-04 17:19:47 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_free(void *data)
|
2014-03-04 17:19:47 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
|
|
|
|
renderchain_clear(chain);
|
|
|
|
renderchain_destroy_stock_shader(chain);
|
|
|
|
if (chain->tracker)
|
|
|
|
state_tracker_free(chain->tracker);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
bool renderchain_init(void *data, const video_info_t *video_info,
|
2013-12-31 23:49:00 +00:00
|
|
|
LPDIRECT3DDEVICE dev_,
|
2012-10-26 19:09:30 +00:00
|
|
|
CGcontext cgCtx_,
|
2014-03-07 18:13:20 +00:00
|
|
|
const D3DVIEWPORT *final_viewport_,
|
|
|
|
const LinkInfo *info, PixelFormat fmt)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
|
|
|
|
if (!chain)
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2014-03-07 18:13:20 +00:00
|
|
|
|
|
|
|
chain->dev = dev_;
|
2014-05-29 15:35:24 +00:00
|
|
|
#ifdef HAVE_CG
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->cgCtx = cgCtx_;
|
2014-05-29 15:35:24 +00:00
|
|
|
#endif
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->video_info = video_info;
|
|
|
|
chain->tracker = NULL;
|
|
|
|
chain->final_viewport = (D3DVIEWPORT*)final_viewport_;
|
|
|
|
chain->frame_count = 0;
|
|
|
|
chain->pixel_size = fmt == RGB565 ? 2 : 4;
|
|
|
|
if (!renderchain_create_first_pass(chain, info, fmt))
|
|
|
|
return false;
|
|
|
|
renderchain_log_info(chain, info);
|
|
|
|
if (!renderchain_compile_shaders(chain, chain->fStock, chain->vStock, ""))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_clear(void *data)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
for (unsigned i = 0; i < TEXTURES; i++)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
if (chain->prev.tex[i])
|
|
|
|
chain->prev.tex[i]->Release();
|
|
|
|
if (chain->prev.vertex_buf[i])
|
|
|
|
chain->prev.vertex_buf[i]->Release();
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
if (chain->passes[0].vertex_decl)
|
|
|
|
chain->passes[0].vertex_decl->Release();
|
|
|
|
for (unsigned i = 1; i < chain->passes.size(); i++)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
if (chain->passes[i].tex)
|
|
|
|
chain->passes[i].tex->Release();
|
|
|
|
if (chain->passes[i].vertex_buf)
|
|
|
|
chain->passes[i].vertex_buf->Release();
|
|
|
|
if (chain->passes[i].vertex_decl)
|
|
|
|
chain->passes[i].vertex_decl->Release();
|
|
|
|
renderchain_destroy_shader(chain, i);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
for (unsigned i = 0; i < chain->luts.size(); i++)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
if (chain->luts[i].tex)
|
|
|
|
chain->luts[i].tex->Release();
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->passes.clear();
|
|
|
|
chain->luts.clear();
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
void renderchain_set_final_viewport(void *data,
|
|
|
|
const D3DVIEWPORT *final_viewport)
|
2013-04-21 12:04:16 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
chain->final_viewport = (D3DVIEWPORT*)final_viewport;
|
2013-04-21 12:04:16 +00:00
|
|
|
}
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
bool renderchain_set_pass_size(void *data, unsigned pass_index,
|
|
|
|
unsigned width, unsigned height)
|
2013-04-21 12:04:16 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
LPDIRECT3DDEVICE d3dr = chain->dev;
|
|
|
|
Pass &pass = chain->passes[pass_index];
|
2013-04-21 12:04:16 +00:00
|
|
|
if (width != pass.info.tex_w || height != pass.info.tex_h)
|
|
|
|
{
|
|
|
|
pass.tex->Release();
|
|
|
|
pass.info.tex_w = width;
|
|
|
|
pass.info.tex_h = height;
|
|
|
|
|
2014-03-05 04:25:27 +00:00
|
|
|
if (FAILED(d3dr->CreateTexture(width, height, 1,
|
2013-04-21 12:04:16 +00:00
|
|
|
D3DUSAGE_RENDERTARGET,
|
2014-09-08 18:08:49 +00:00
|
|
|
chain->passes.back().info.pass->fbo.fp_fbo ?
|
|
|
|
D3DFMT_A32B32G32R32F : D3DFMT_A8R8G8B8,
|
2013-04-21 12:04:16 +00:00
|
|
|
D3DPOOL_DEFAULT,
|
2013-12-31 20:24:17 +00:00
|
|
|
&pass.tex, NULL)))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2013-04-21 12:04:16 +00:00
|
|
|
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, pass.tex);
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_set_sampler_address_u(d3dr, 0, D3DTADDRESS_BORDER);
|
|
|
|
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, NULL);
|
2013-04-21 12:04:16 +00:00
|
|
|
}
|
2014-01-01 15:51:40 +00:00
|
|
|
|
|
|
|
return true;
|
2013-04-21 12:04:16 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
bool renderchain_add_pass(void *data, const LinkInfo *info)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
LPDIRECT3DDEVICE d3dr = chain->dev;
|
2012-10-26 19:09:30 +00:00
|
|
|
Pass pass;
|
2014-03-07 18:13:20 +00:00
|
|
|
pass.info = *info;
|
2012-10-26 19:09:30 +00:00
|
|
|
pass.last_width = 0;
|
|
|
|
pass.last_height = 0;
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
renderchain_compile_shaders(chain, pass.fPrg,
|
|
|
|
pass.vPrg, info->pass->source.path);
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
if (!renderchain_init_shader_fvf(chain, pass))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-09-12 14:21:47 +00:00
|
|
|
if (FAILED(D3DDevice_CreateVertexBuffers(d3dr, 4 * sizeof(Vertex),
|
2014-09-08 18:08:49 +00:00
|
|
|
d3dr->GetSoftwareVertexProcessing()
|
|
|
|
? D3DUSAGE_SOFTWAREPROCESSING : 0,
|
2014-01-15 18:00:46 +00:00
|
|
|
0,
|
2012-10-26 19:09:30 +00:00
|
|
|
D3DPOOL_DEFAULT,
|
2014-09-12 15:17:28 +00:00
|
|
|
&pass.vertex_buf,
|
2013-12-31 20:24:17 +00:00
|
|
|
NULL)))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
if (FAILED(d3dr->CreateTexture(info->tex_w, info->tex_h, 1,
|
2012-10-26 19:09:30 +00:00
|
|
|
D3DUSAGE_RENDERTARGET,
|
2014-09-08 18:08:49 +00:00
|
|
|
chain->passes.back().info.pass->fbo.fp_fbo
|
|
|
|
? D3DFMT_A32B32G32R32F : D3DFMT_A8R8G8B8,
|
2012-10-26 19:09:30 +00:00
|
|
|
D3DPOOL_DEFAULT,
|
2013-12-31 20:24:17 +00:00
|
|
|
&pass.tex, NULL)))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, pass.tex);
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_set_sampler_address_u(d3dr, 0, D3DTADDRESS_BORDER);
|
|
|
|
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, NULL);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->passes.push_back(pass);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_log_info(chain, info);
|
2014-01-01 15:51:40 +00:00
|
|
|
return true;
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
bool renderchain_add_lut(void *data, const std::string &id,
|
2012-10-26 19:09:30 +00:00
|
|
|
const std::string &path,
|
|
|
|
bool smooth)
|
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
2013-12-31 23:49:00 +00:00
|
|
|
LPDIRECT3DTEXTURE lut;
|
2014-03-07 18:13:20 +00:00
|
|
|
LPDIRECT3DDEVICE d3dr = chain->dev;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-01-15 18:00:46 +00:00
|
|
|
RARCH_LOG("[D3D]: Loading LUT texture: %s.\n", path.c_str());
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
if (FAILED(D3DXCreateTextureFromFileExA(
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr,
|
2012-10-26 19:09:30 +00:00
|
|
|
path.c_str(),
|
|
|
|
D3DX_DEFAULT_NONPOW2,
|
|
|
|
D3DX_DEFAULT_NONPOW2,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
D3DFMT_FROM_FILE,
|
|
|
|
D3DPOOL_MANAGED,
|
|
|
|
smooth ? D3DX_FILTER_LINEAR : D3DX_FILTER_POINT,
|
|
|
|
0,
|
|
|
|
0,
|
2013-12-31 20:24:17 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2012-10-26 19:09:30 +00:00
|
|
|
&lut)))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, lut);
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_set_sampler_address_u(d3dr, 0, D3DTADDRESS_BORDER);
|
|
|
|
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, NULL);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
lut_info info = { lut, id, smooth };
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->luts.push_back(info);
|
2014-01-01 15:51:40 +00:00
|
|
|
return true;
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_add_state_tracker(void *data, state_tracker_t *tracker)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
if (chain->tracker)
|
|
|
|
state_tracker_free(chain->tracker);
|
|
|
|
chain->tracker = tracker;
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_start_render(void *data)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
chain->passes[0].tex = chain->prev.tex[chain->prev.ptr];
|
|
|
|
chain->passes[0].vertex_buf = chain->prev.vertex_buf[chain->prev.ptr];
|
|
|
|
chain->passes[0].last_width = chain->prev.last_width[chain->prev.ptr];
|
|
|
|
chain->passes[0].last_height = chain->prev.last_height[chain->prev.ptr];
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_end_render(void *data)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
chain->prev.last_width[chain->prev.ptr] = chain->passes[0].last_width;
|
|
|
|
chain->prev.last_height[chain->prev.ptr] = chain->passes[0].last_height;
|
|
|
|
chain->prev.ptr = (chain->prev.ptr + 1) & TEXTURESMASK;
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
bool renderchain_render(void *chain_data, const void *data,
|
2012-10-26 19:09:30 +00:00
|
|
|
unsigned width, unsigned height, unsigned pitch, unsigned rotation)
|
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)chain_data;
|
2014-03-07 20:55:18 +00:00
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_start_render(chain);
|
|
|
|
|
|
|
|
unsigned current_width = width;
|
|
|
|
unsigned current_height = height;
|
|
|
|
unsigned out_width = 0;
|
|
|
|
unsigned out_height = 0;
|
2014-09-08 18:08:49 +00:00
|
|
|
renderchain_convert_geometry(chain, &chain->passes[0].info,
|
|
|
|
out_width, out_height,
|
2014-03-07 18:13:20 +00:00
|
|
|
current_width, current_height, chain->final_viewport);
|
2014-03-07 20:55:18 +00:00
|
|
|
#ifdef _XBOX1
|
|
|
|
d3dr->SetFlickerFilter(g_extern.console.screen.flicker_filter_index);
|
2014-08-31 01:38:21 +00:00
|
|
|
d3dr->SetSoftDisplayFilter(g_extern.console.softfilter_enable);
|
2014-03-07 20:55:18 +00:00
|
|
|
#endif
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_blit_to_texture(chain, data, width, height, pitch);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
// Grab back buffer.
|
2013-12-31 23:49:00 +00:00
|
|
|
LPDIRECT3DSURFACE back_buffer;
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->GetRenderTarget(0, &back_buffer);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
// In-between render target passes.
|
2014-03-07 18:13:20 +00:00
|
|
|
for (unsigned i = 0; i < chain->passes.size() - 1; i++)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
Pass &from_pass = chain->passes[i];
|
|
|
|
Pass &to_pass = chain->passes[i + 1];
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2013-12-31 23:49:00 +00:00
|
|
|
LPDIRECT3DSURFACE target;
|
2012-10-26 19:09:30 +00:00
|
|
|
to_pass.tex->GetSurfaceLevel(0, &target);
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetRenderTarget(0, target);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_convert_geometry(chain, &from_pass.info,
|
2012-10-26 19:09:30 +00:00
|
|
|
out_width, out_height,
|
2014-03-07 18:13:20 +00:00
|
|
|
current_width, current_height, chain->final_viewport);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2013-04-21 13:39:14 +00:00
|
|
|
// Clear out whole FBO.
|
2013-12-31 23:49:00 +00:00
|
|
|
D3DVIEWPORT viewport = {0};
|
2013-04-21 13:39:14 +00:00
|
|
|
viewport.Width = to_pass.info.tex_w;
|
|
|
|
viewport.Height = to_pass.info.tex_h;
|
2012-10-26 19:09:30 +00:00
|
|
|
viewport.MinZ = 0.0f;
|
|
|
|
viewport.MaxZ = 1.0f;
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetViewport(&viewport);
|
|
|
|
d3dr->Clear(0, 0, D3DCLEAR_TARGET, 0, 1, 0);
|
2013-04-21 13:39:14 +00:00
|
|
|
|
|
|
|
viewport.Width = out_width;
|
|
|
|
viewport.Height = out_height;
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_set_viewport(chain, &viewport);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_set_vertices(chain, from_pass,
|
2012-10-26 19:09:30 +00:00
|
|
|
current_width, current_height,
|
|
|
|
out_width, out_height,
|
|
|
|
out_width, out_height, 0);
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_render_pass(chain, from_pass, i + 1);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
current_width = out_width;
|
|
|
|
current_height = out_height;
|
|
|
|
target->Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Final pass
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetRenderTarget(0, back_buffer);
|
2014-03-07 18:13:20 +00:00
|
|
|
Pass &last_pass = chain->passes.back();
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_convert_geometry(chain, &last_pass.info,
|
2012-10-26 19:09:30 +00:00
|
|
|
out_width, out_height,
|
2014-03-07 18:13:20 +00:00
|
|
|
current_width, current_height, chain->final_viewport);
|
|
|
|
renderchain_set_viewport(chain, chain->final_viewport);
|
|
|
|
renderchain_set_vertices(chain, last_pass,
|
2012-10-26 19:09:30 +00:00
|
|
|
current_width, current_height,
|
|
|
|
out_width, out_height,
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->final_viewport->Width, chain->final_viewport->Height,
|
2012-10-26 19:09:30 +00:00
|
|
|
rotation);
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_render_pass(chain, last_pass, chain->passes.size());
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->frame_count++;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
back_buffer->Release();
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_end_render(chain);
|
|
|
|
renderchain_set_shaders(chain, chain->fStock, chain->vStock);
|
2014-09-08 18:08:49 +00:00
|
|
|
renderchain_set_mvp(chain, chain->vStock, chain->final_viewport->Width,
|
|
|
|
chain->final_viewport->Height, 0);
|
2012-10-26 19:09:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
bool renderchain_create_first_pass(void *data, const LinkInfo *info,
|
|
|
|
PixelFormat fmt)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
2012-10-26 19:09:30 +00:00
|
|
|
D3DXMATRIX ident;
|
|
|
|
D3DXMatrixIdentity(&ident);
|
2014-03-07 18:13:20 +00:00
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTransform(D3DTS_WORLD, &ident);
|
|
|
|
d3dr->SetTransform(D3DTS_VIEW, &ident);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
Pass pass;
|
2014-03-07 18:13:20 +00:00
|
|
|
pass.info = *info;
|
2012-10-26 19:09:30 +00:00
|
|
|
pass.last_width = 0;
|
|
|
|
pass.last_height = 0;
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->prev.ptr = 0;
|
|
|
|
for (unsigned i = 0; i < TEXTURES; i++)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->prev.last_width[i] = 0;
|
|
|
|
chain->prev.last_height[i] = 0;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-05 04:25:27 +00:00
|
|
|
if (FAILED(d3dr->CreateVertexBuffer(
|
2012-10-26 19:09:30 +00:00
|
|
|
4 * sizeof(Vertex),
|
2014-09-08 18:08:49 +00:00
|
|
|
d3dr->GetSoftwareVertexProcessing()
|
|
|
|
? D3DUSAGE_SOFTWAREPROCESSING : 0,
|
2014-01-15 18:00:46 +00:00
|
|
|
0,
|
2012-10-26 19:09:30 +00:00
|
|
|
D3DPOOL_DEFAULT,
|
2014-03-07 18:13:20 +00:00
|
|
|
&chain->prev.vertex_buf[i],
|
2013-12-31 20:24:17 +00:00
|
|
|
NULL)))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
if (FAILED(d3dr->CreateTexture(info->tex_w, info->tex_h, 1, 0,
|
2012-10-26 19:09:30 +00:00
|
|
|
fmt == RGB565 ? D3DFMT_R5G6B5 : D3DFMT_X8R8G8B8,
|
|
|
|
D3DPOOL_MANAGED,
|
2014-03-07 18:13:20 +00:00
|
|
|
&chain->prev.tex[i], NULL)))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
d3dr->SetTexture(0, chain->prev.tex[i]);
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_minfilter(d3dr, 0,
|
2014-09-08 18:08:49 +00:00
|
|
|
translate_filter(info->pass->filter));
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_magfilter(d3dr, 0,
|
2014-09-08 18:08:49 +00:00
|
|
|
translate_filter(info->pass->filter));
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_set_sampler_address_u(d3dr, 0, D3DTADDRESS_BORDER);
|
|
|
|
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, NULL);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
renderchain_compile_shaders(chain, pass.fPrg,
|
|
|
|
pass.vPrg, info->pass->source.path);
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
if (!renderchain_init_shader_fvf(chain, pass))
|
2014-01-01 15:51:40 +00:00
|
|
|
return false;
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->passes.push_back(pass);
|
2014-01-01 15:51:40 +00:00
|
|
|
return true;
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_set_vertices(void *data, Pass &pass,
|
2012-10-26 19:09:30 +00:00
|
|
|
unsigned width, unsigned height,
|
|
|
|
unsigned out_width, unsigned out_height,
|
|
|
|
unsigned vp_width, unsigned vp_height,
|
|
|
|
unsigned rotation)
|
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
2012-10-26 19:09:30 +00:00
|
|
|
const LinkInfo &info = pass.info;
|
|
|
|
|
|
|
|
if (pass.last_width != width || pass.last_height != height)
|
|
|
|
{
|
|
|
|
pass.last_width = width;
|
|
|
|
pass.last_height = height;
|
|
|
|
|
|
|
|
float _u = static_cast<float>(width) / info.tex_w;
|
|
|
|
float _v = static_cast<float>(height) / info.tex_h;
|
|
|
|
Vertex vert[4];
|
|
|
|
for (unsigned i = 0; i < 4; i++)
|
2013-03-29 10:46:56 +00:00
|
|
|
{
|
2012-10-26 19:09:30 +00:00
|
|
|
vert[i].z = 0.5f;
|
2013-03-29 10:46:56 +00:00
|
|
|
vert[i].r = vert[i].g = vert[i].b = vert[i].a = 1.0f;
|
|
|
|
}
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
vert[0].x = 0.0f;
|
|
|
|
vert[1].x = out_width;
|
|
|
|
vert[2].x = 0.0f;
|
|
|
|
vert[3].x = out_width;
|
|
|
|
vert[0].y = out_height;
|
|
|
|
vert[1].y = out_height;
|
|
|
|
vert[2].y = 0.0f;
|
|
|
|
vert[3].y = 0.0f;
|
|
|
|
|
|
|
|
vert[0].u = 0.0f;
|
|
|
|
vert[1].u = _u;
|
|
|
|
vert[2].u = 0.0f;
|
|
|
|
vert[3].u = _u;
|
|
|
|
vert[0].v = 0.0f;
|
|
|
|
vert[1].v = 0.0f;
|
|
|
|
vert[2].v = _v;
|
|
|
|
vert[3].v = _v;
|
|
|
|
|
|
|
|
vert[0].lut_u = 0.0f;
|
|
|
|
vert[1].lut_u = 1.0f;
|
|
|
|
vert[2].lut_u = 0.0f;
|
|
|
|
vert[3].lut_u = 1.0f;
|
|
|
|
vert[0].lut_v = 0.0f;
|
|
|
|
vert[1].lut_v = 0.0f;
|
|
|
|
vert[2].lut_v = 1.0f;
|
|
|
|
vert[3].lut_v = 1.0f;
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
/* Align texels and vertices. */
|
2012-10-26 19:09:30 +00:00
|
|
|
for (unsigned i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
vert[i].x -= 0.5f;
|
|
|
|
vert[i].y += 0.5f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *verts;
|
|
|
|
pass.vertex_buf->Lock(0, sizeof(vert), &verts, 0);
|
2014-01-15 16:24:24 +00:00
|
|
|
memcpy(verts, vert, sizeof(vert));
|
2012-10-26 19:09:30 +00:00
|
|
|
pass.vertex_buf->Unlock();
|
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_set_mvp(chain, pass.vPrg, vp_width, vp_height, rotation);
|
|
|
|
renderchain_set_shader_params(chain, pass,
|
2012-10-26 19:09:30 +00:00
|
|
|
width, height,
|
|
|
|
info.tex_w, info.tex_h,
|
|
|
|
vp_width, vp_height);
|
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_set_viewport(void *data, D3DVIEWPORT *vp)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
|
|
|
|
d3dr->SetViewport(vp);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_set_mvp(void *data, CGprogram &vPrg,
|
2013-03-29 19:46:23 +00:00
|
|
|
unsigned vp_width, unsigned vp_height,
|
|
|
|
unsigned rotation)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
2014-01-15 18:00:46 +00:00
|
|
|
D3DXMATRIX proj, ortho, rot, tmp;
|
2013-03-29 19:46:23 +00:00
|
|
|
D3DXMatrixOrthoOffCenterLH(&ortho, 0, vp_width, 0, vp_height, 0, 1);
|
|
|
|
|
|
|
|
if (rotation)
|
|
|
|
D3DXMatrixRotationZ(&rot, rotation * (M_PI / 2.0));
|
|
|
|
else
|
|
|
|
D3DXMatrixIdentity(&rot);
|
|
|
|
|
|
|
|
D3DXMatrixMultiply(&proj, &ortho, &rot);
|
|
|
|
D3DXMatrixTranspose(&tmp, &proj);
|
2014-01-15 18:00:46 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_set_shader_mvp(chain, vPrg, tmp);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_convert_geometry(void *data, const LinkInfo *info,
|
2012-10-26 19:09:30 +00:00
|
|
|
unsigned &out_width, unsigned &out_height,
|
|
|
|
unsigned width, unsigned height,
|
2014-03-07 18:13:20 +00:00
|
|
|
D3DVIEWPORT *final_viewport)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
switch (info->pass->fbo.type_x)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_VIEWPORT:
|
2014-03-07 18:13:20 +00:00
|
|
|
out_width = info->pass->fbo.scale_x * final_viewport->Width;
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_ABSOLUTE:
|
2014-03-07 18:13:20 +00:00
|
|
|
out_width = info->pass->fbo.abs_x;
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_INPUT:
|
2014-03-07 18:13:20 +00:00
|
|
|
out_width = info->pass->fbo.scale_x * width;
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
switch (info->pass->fbo.type_y)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_VIEWPORT:
|
2014-03-07 18:13:20 +00:00
|
|
|
out_height = info->pass->fbo.scale_y * final_viewport->Height;
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_ABSOLUTE:
|
2014-03-07 18:13:20 +00:00
|
|
|
out_height = info->pass->fbo.abs_y;
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_INPUT:
|
2014-03-07 18:13:20 +00:00
|
|
|
out_height = info->pass->fbo.scale_y * height;
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_blit_to_texture(void *data, const void *frame,
|
2012-10-26 19:09:30 +00:00
|
|
|
unsigned width, unsigned height,
|
|
|
|
unsigned pitch)
|
|
|
|
{
|
2014-06-08 23:07:43 +00:00
|
|
|
D3DSURFACE_DESC desc;
|
2014-06-08 01:02:02 +00:00
|
|
|
D3DLOCKED_RECT d3dlr;
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
Pass &first = chain->passes[0];
|
2014-09-11 17:28:14 +00:00
|
|
|
|
|
|
|
(void)desc;
|
|
|
|
|
2012-10-26 19:09:30 +00:00
|
|
|
if (first.last_width != width || first.last_height != height)
|
2014-06-08 01:02:02 +00:00
|
|
|
{
|
2014-09-08 18:08:49 +00:00
|
|
|
D3DTexture_LockRectClear(first, first.tex, 0, d3dlr,
|
|
|
|
NULL, D3DLOCK_NOSYSLOCK);
|
2014-06-08 01:02:02 +00:00
|
|
|
}
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-06-08 23:07:43 +00:00
|
|
|
D3DTexture_Blit(chain, desc, d3dlr, frame, width, height, pitch);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_render_pass(void *data, Pass &pass, unsigned pass_index)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
|
|
|
|
renderchain_set_shaders(chain, pass.fPrg, pass.vPrg);
|
2014-06-08 02:35:58 +00:00
|
|
|
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetTexture(0, pass.tex);
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_minfilter(d3dr, 0,
|
2014-09-08 18:08:49 +00:00
|
|
|
translate_filter(pass.info.pass->filter));
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_magfilter(d3dr, 0,
|
2014-09-08 18:08:49 +00:00
|
|
|
translate_filter(pass.info.pass->filter));
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 20:55:18 +00:00
|
|
|
#ifdef _XBOX1
|
|
|
|
d3dr->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);
|
|
|
|
#else
|
2014-03-05 04:25:27 +00:00
|
|
|
d3dr->SetVertexDeclaration(pass.vertex_decl);
|
2014-03-07 20:55:18 +00:00
|
|
|
#endif
|
2012-10-26 19:09:30 +00:00
|
|
|
for (unsigned i = 0; i < 4; i++)
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_set_stream_source(d3dr, i,
|
2014-09-08 18:08:49 +00:00
|
|
|
pass.vertex_buf, 0, sizeof(Vertex));
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
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);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_draw_primitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
// So we don't render with linear filter into render targets,
|
|
|
|
// which apparently looked odd (too blurry).
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_minfilter(d3dr, 0, D3DTEXF_POINT);
|
|
|
|
d3d_set_sampler_magfilter(d3dr, 0, D3DTEXF_POINT);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_unbind_all(chain);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_log_info(void *data, const LinkInfo *info)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-04 17:19:47 +00:00
|
|
|
RARCH_LOG("[D3D]: Render pass info:\n");
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("\tTexture width: %u\n", info->tex_w);
|
|
|
|
RARCH_LOG("\tTexture height: %u\n", info->tex_h);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
|
|
|
RARCH_LOG("\tScale type (X): ");
|
2014-03-07 18:13:20 +00:00
|
|
|
switch (info->pass->fbo.type_x)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_INPUT:
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("Relative @ %fx\n", info->pass->fbo.scale_x);
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_VIEWPORT:
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("Viewport @ %fx\n", info->pass->fbo.scale_x);
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_ABSOLUTE:
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("Absolute @ %u px\n", info->pass->fbo.abs_x);
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
RARCH_LOG("\tScale type (Y): ");
|
2014-03-07 18:13:20 +00:00
|
|
|
switch (info->pass->fbo.type_y)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_INPUT:
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("Relative @ %fx\n", info->pass->fbo.scale_y);
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_VIEWPORT:
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("Viewport @ %fx\n", info->pass->fbo.scale_y);
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-06 19:26:27 +00:00
|
|
|
case RARCH_SCALE_ABSOLUTE:
|
2014-03-07 18:13:20 +00:00
|
|
|
RARCH_LOG("Absolute @ %u px\n", info->pass->fbo.abs_y);
|
2012-10-26 19:09:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-08 18:08:49 +00:00
|
|
|
RARCH_LOG("\tBilinear filter: %s\n",
|
|
|
|
info->pass->filter == RARCH_FILTER_LINEAR ? "true" : "false");
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
void renderchain_unbind_all(void *data)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-03-07 18:13:20 +00:00
|
|
|
renderchain_t *chain = (renderchain_t*)data;
|
2014-03-07 20:55:18 +00:00
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev;
|
2014-09-08 18:08:49 +00:00
|
|
|
|
|
|
|
/* Have to be a bit anal about it.
|
|
|
|
* Render targets hate it when they have filters apparently.
|
|
|
|
*/
|
2014-03-07 18:13:20 +00:00
|
|
|
for (unsigned i = 0; i < chain->bound_tex.size(); i++)
|
2012-10-26 19:09:30 +00:00
|
|
|
{
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_minfilter(d3dr,
|
2014-09-08 18:08:49 +00:00
|
|
|
chain->bound_tex[i], D3DTEXF_POINT);
|
2014-09-12 15:22:46 +00:00
|
|
|
d3d_set_sampler_magfilter(d3dr,
|
2014-09-08 18:08:49 +00:00
|
|
|
chain->bound_tex[i], D3DTEXF_POINT);
|
2014-03-07 18:13:20 +00:00
|
|
|
d3dr->SetTexture(chain->bound_tex[i], NULL);
|
2012-10-26 19:09:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
for (unsigned i = 0; i < chain->bound_vert.size(); i++)
|
2014-09-12 05:49:25 +00:00
|
|
|
d3d_set_stream_source(d3dr, chain->bound_vert[i], 0, 0, 0);
|
2012-10-26 19:09:30 +00:00
|
|
|
|
2014-03-07 18:13:20 +00:00
|
|
|
chain->bound_tex.clear();
|
|
|
|
chain->bound_vert.clear();
|
2014-03-07 20:55:18 +00:00
|
|
|
}
|