win32: add float_framebuffer and frame_count_mod to d3d9

This commit is contained in:
OV2 2013-03-29 19:32:13 +01:00
parent b73edeb2c3
commit c9f4db8dcc
3 changed files with 33 additions and 1 deletions

View File

@ -883,6 +883,8 @@ void D3DVideo::init_chain_multipass(const video_info_t &info)
std::vector<unsigned> abses_x;
std::vector<unsigned> abses_y;
std::vector<bool> filters;
std::vector<unsigned> frame_count_mods;
std::vector<bool> float_fbos;
// Shader paths.
for (int i = 0; i < shaders; i++)
@ -996,6 +998,26 @@ void D3DVideo::init_chain_multipass(const video_info_t &info)
filters.push_back(filter);
}
// Frame counter modulo.
for (int i = 0; i < shaders; i++)
{
char attr_frame_count_mod[64];
snprintf(attr_frame_count_mod, sizeof(attr_frame_count_mod), "frame_count_mod%d", i);
unsigned frame_count_mod = 0;
conf.get(attr_frame_count_mod, frame_count_mod);
frame_count_mods.push_back(frame_count_mod);
}
// Floating point framebuffers.
for (int i = 0; i < shaders; i++)
{
char attr_float_framebuffer[64];
snprintf(attr_float_framebuffer, sizeof(attr_float_framebuffer), "float_framebuffer%d", i);
bool float_framebuffer = false;
conf.get(attr_float_framebuffer, float_framebuffer);
float_fbos.push_back(float_framebuffer);
}
// Setup information for first pass.
LinkInfo link_info = {0};
link_info.shader_path = shader_paths[0];
@ -1018,6 +1040,9 @@ void D3DVideo::init_chain_multipass(const video_info_t &info)
link_info.filter_linear = filters[0];
link_info.tex_w = link_info.tex_h = info.input_scale * RARCH_SCALE_BASE;
link_info.frame_count_mod = frame_count_mods[0];
link_info.float_framebuffer = float_fbos[0];
chain = std::unique_ptr<RenderChain>(
new RenderChain(
video_info,
@ -1045,6 +1070,8 @@ void D3DVideo::init_chain_multipass(const video_info_t &info)
link_info.scale_type_y = scale_types_y[i];
link_info.filter_linear = filters[i];
link_info.shader_path = shader_paths[i];
link_info.frame_count_mod = frame_count_mods[i];
link_info.float_framebuffer = float_fbos[i];
current_width = out_width;
current_height = out_height;

View File

@ -122,7 +122,7 @@ void RenderChain::add_pass(const LinkInfo &info)
if (FAILED(dev->CreateTexture(info.tex_w, info.tex_h, 1,
D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8,
info.float_framebuffer ? D3DFMT_A32B32G32R32F : D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT,
&pass.tex, nullptr)))
{
@ -501,6 +501,8 @@ void RenderChain::set_cg_params(Pass &pass,
set_cg_param(pass.fPrg, "IN.output_size", output_size);
float frame_cnt = frame_count;
if (pass.info.frame_count_mod)
frame_cnt = frame_count % pass.info.frame_count_mod;
set_cg_param(pass.fPrg, "IN.frame_count", frame_cnt);
set_cg_param(pass.vPrg, "IN.frame_count", frame_cnt);
}

View File

@ -41,6 +41,9 @@ struct LinkInfo
bool filter_linear;
ScaleType scale_type_x, scale_type_y;
unsigned frame_count_mod;
bool float_framebuffer;
std::string shader_path;
};