Set LUT uniforms for vertex shader as well.
This commit is contained in:
parent
a0f7a184fd
commit
2b0697205d
|
@ -831,10 +831,12 @@ void RenderChain::bind_luts(Pass &pass)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < luts.size(); i++)
|
for (unsigned i = 0; i < luts.size(); i++)
|
||||||
{
|
{
|
||||||
CGparameter param = cgGetNamedParameter(pass.fPrg, luts[i].id.c_str());
|
CGparameter fparam = cgGetNamedParameter(pass.fPrg, luts[i].id.c_str());
|
||||||
if (param)
|
int bound_index = -1;
|
||||||
|
if (fparam)
|
||||||
{
|
{
|
||||||
unsigned index = cgGetParameterResourceIndex(param);
|
unsigned index = cgGetParameterResourceIndex(fparam);
|
||||||
|
bound_index = index;
|
||||||
dev->SetTexture(index, luts[i].tex);
|
dev->SetTexture(index, luts[i].tex);
|
||||||
dev->SetSamplerState(index, D3DSAMP_MAGFILTER,
|
dev->SetSamplerState(index, D3DSAMP_MAGFILTER,
|
||||||
luts[i].smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
luts[i].smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||||
|
@ -844,6 +846,23 @@ void RenderChain::bind_luts(Pass &pass)
|
||||||
dev->SetSamplerState(index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
dev->SetSamplerState(index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||||
bound_tex.push_back(index);
|
bound_tex.push_back(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGparameter vparam = cgGetNamedParameter(pass.vPrg, luts[i].id.c_str());
|
||||||
|
if (vparam)
|
||||||
|
{
|
||||||
|
unsigned index = cgGetParameterResourceIndex(vparam);
|
||||||
|
if (index != (unsigned)bound_index)
|
||||||
|
{
|
||||||
|
dev->SetTexture(index, luts[i].tex);
|
||||||
|
dev->SetSamplerState(index, D3DSAMP_MAGFILTER,
|
||||||
|
luts[i].smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||||
|
dev->SetSamplerState(index, D3DSAMP_MINFILTER,
|
||||||
|
luts[i].smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||||
|
dev->SetSamplerState(index, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||||
|
dev->SetSamplerState(index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||||
|
bound_tex.push_back(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,11 +264,18 @@ static void gl_cg_set_params(unsigned width, unsigned height,
|
||||||
// Set lookup textures.
|
// Set lookup textures.
|
||||||
for (unsigned i = 0; i < cg_shader->luts; i++)
|
for (unsigned i = 0; i < cg_shader->luts; i++)
|
||||||
{
|
{
|
||||||
CGparameter param = cgGetNamedParameter(prg[active_index].fprg, cg_shader->lut[i].id);
|
CGparameter fparam = cgGetNamedParameter(prg[active_index].fprg, cg_shader->lut[i].id);
|
||||||
if (param)
|
if (fparam)
|
||||||
{
|
{
|
||||||
cgGLSetTextureParameter(param, lut_textures[i]);
|
cgGLSetTextureParameter(fparam, lut_textures[i]);
|
||||||
cgGLEnableTextureParameter(param);
|
cgGLEnableTextureParameter(fparam);
|
||||||
|
}
|
||||||
|
|
||||||
|
CGparameter vparam = cgGetNamedParameter(prg[active_index].vprg, cg_shader->lut[i].id);
|
||||||
|
if (vparam)
|
||||||
|
{
|
||||||
|
cgGLSetTextureParameter(vparam, lut_textures[i]);
|
||||||
|
cgGLEnableTextureParameter(vparam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue