Change luts back to std::vector list
This commit is contained in:
parent
7bd822e032
commit
99a8690b50
|
@ -79,8 +79,7 @@ typedef struct cg_renderchain
|
||||||
} prev;
|
} prev;
|
||||||
std::vector<Pass> passes;
|
std::vector<Pass> passes;
|
||||||
CGprogram vStock, fStock;
|
CGprogram vStock, fStock;
|
||||||
lut_info *luts[GFX_MAX_TEXTURES];
|
std::vector<lut_info> luts;
|
||||||
unsigned luts_count;
|
|
||||||
D3DVIEWPORT *final_viewport;
|
D3DVIEWPORT *final_viewport;
|
||||||
unsigned frame_count;
|
unsigned frame_count;
|
||||||
struct
|
struct
|
||||||
|
@ -616,11 +615,11 @@ static void cg_d3d9_renderchain_add_lut(void *data,
|
||||||
if (!chain)
|
if (!chain)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d3d_set_texture(chain->dev, index, chain->luts[i]->tex);
|
d3d_set_texture(chain->dev, index, chain->luts[i].tex);
|
||||||
d3d_set_sampler_magfilter(chain->dev, index,
|
d3d_set_sampler_magfilter(chain->dev, index,
|
||||||
translate_filter(chain->luts[i]->smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST));
|
translate_filter(chain->luts[i].smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST));
|
||||||
d3d_set_sampler_minfilter(chain->dev, index,
|
d3d_set_sampler_minfilter(chain->dev, index,
|
||||||
translate_filter(chain->luts[i]->smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST));
|
translate_filter(chain->luts[i].smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST));
|
||||||
d3d_set_sampler_address_u(chain->dev, index, D3DTADDRESS_BORDER);
|
d3d_set_sampler_address_u(chain->dev, index, D3DTADDRESS_BORDER);
|
||||||
d3d_set_sampler_address_v(chain->dev, index, D3DTADDRESS_BORDER);
|
d3d_set_sampler_address_v(chain->dev, index, D3DTADDRESS_BORDER);
|
||||||
chain->bound_tex.list[chain->bound_tex.current++] = index;
|
chain->bound_tex.list[chain->bound_tex.current++] = index;
|
||||||
|
@ -631,10 +630,10 @@ static void renderchain_bind_luts(cg_renderchain_t *chain,
|
||||||
{
|
{
|
||||||
unsigned i, index;
|
unsigned i, index;
|
||||||
|
|
||||||
for (i = 0; i < chain->luts_count; i++)
|
for (i = 0; i < chain->luts.size(); i++)
|
||||||
{
|
{
|
||||||
CGparameter vparam;
|
CGparameter vparam;
|
||||||
CGparameter fparam = cgGetNamedParameter(pass->fPrg, chain->luts[i]->id);
|
CGparameter fparam = cgGetNamedParameter(pass->fPrg, chain->luts[i].id);
|
||||||
int bound_index = -1;
|
int bound_index = -1;
|
||||||
|
|
||||||
if (fparam)
|
if (fparam)
|
||||||
|
@ -645,7 +644,7 @@ static void renderchain_bind_luts(cg_renderchain_t *chain,
|
||||||
cg_d3d9_renderchain_add_lut(chain, index, i);
|
cg_d3d9_renderchain_add_lut(chain, index, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
vparam = cgGetNamedParameter(pass->vPrg, chain->luts[i]->id);
|
vparam = cgGetNamedParameter(pass->vPrg, chain->luts[i].id);
|
||||||
|
|
||||||
if (vparam)
|
if (vparam)
|
||||||
{
|
{
|
||||||
|
@ -750,12 +749,10 @@ static void cg_d3d9_renderchain_clear(cg_renderchain_t *chain)
|
||||||
|
|
||||||
cg_d3d9_renderchain_clear_passes(chain);
|
cg_d3d9_renderchain_clear_passes(chain);
|
||||||
|
|
||||||
for (i = 0; i < chain->luts_count; i++)
|
for (i = 0; i < chain->luts.size(); i++)
|
||||||
{
|
{
|
||||||
if (chain->luts[i]->tex)
|
if (chain->luts[i].tex)
|
||||||
d3d_texture_free(chain->luts[i]->tex);
|
d3d_texture_free(chain->luts[i].tex);
|
||||||
chain->luts[i]->tex = NULL;
|
|
||||||
chain->luts_count--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -763,6 +760,7 @@ static void cg_d3d9_renderchain_clear(cg_renderchain_t *chain)
|
||||||
state_tracker_free(chain->tracker);
|
state_tracker_free(chain->tracker);
|
||||||
chain->tracker = NULL;
|
chain->tracker = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
chain->luts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cg_d3d9_renderchain_deinit_shader(cg_renderchain_t *chain)
|
static void cg_d3d9_renderchain_deinit_shader(cg_renderchain_t *chain)
|
||||||
|
@ -1142,6 +1140,7 @@ static bool cg_d3d9_renderchain_add_pass(void *data, const void *info_data)
|
||||||
static bool cg_d3d9_renderchain_add_lut(void *data,
|
static bool cg_d3d9_renderchain_add_lut(void *data,
|
||||||
const char *id, const char *path, bool smooth)
|
const char *id, const char *path, bool smooth)
|
||||||
{
|
{
|
||||||
|
lut_info info;
|
||||||
cg_renderchain_t *chain = (cg_renderchain_t*)data;
|
cg_renderchain_t *chain = (cg_renderchain_t*)data;
|
||||||
LPDIRECT3DDEVICE d3dr = chain->dev;
|
LPDIRECT3DDEVICE d3dr = chain->dev;
|
||||||
LPDIRECT3DTEXTURE lut = d3d_texture_new(d3dr,
|
LPDIRECT3DTEXTURE lut = d3d_texture_new(d3dr,
|
||||||
|
@ -1161,6 +1160,9 @@ static bool cg_d3d9_renderchain_add_lut(void *data,
|
||||||
|
|
||||||
RARCH_LOG("[D3D]: LUT texture loaded: %s.\n", path);
|
RARCH_LOG("[D3D]: LUT texture loaded: %s.\n", path);
|
||||||
|
|
||||||
|
info.tex = lut;
|
||||||
|
info.smooth = smooth;
|
||||||
|
strcpy(info.id, id);
|
||||||
if (!lut)
|
if (!lut)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1169,16 +1171,7 @@ static bool cg_d3d9_renderchain_add_lut(void *data,
|
||||||
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
|
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
|
||||||
d3d_set_texture(d3dr, 0, NULL);
|
d3d_set_texture(d3dr, 0, NULL);
|
||||||
|
|
||||||
chain->luts[chain->luts_count] = (lut_info*)malloc(sizeof(lut_info));
|
chain->luts.push_back(info);
|
||||||
|
|
||||||
if (!chain->luts[chain->luts_count])
|
|
||||||
return false;
|
|
||||||
|
|
||||||
chain->luts[chain->luts_count]->tex = lut;
|
|
||||||
chain->luts[chain->luts_count]->smooth = smooth;
|
|
||||||
strlcpy(chain->luts[chain->luts_count]->id, id, sizeof(chain->luts[chain->luts_count]->id));
|
|
||||||
|
|
||||||
chain->luts_count++;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue