Commit 0015c6e9 authored by Romain Vimont's avatar Romain Vimont
Browse files

opengl: fetch locations from sampler

Fetch locations related to sampler from sampler->pf_fetch_locations.
parent 33f58950
...@@ -218,13 +218,30 @@ sampler_base_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program) ...@@ -218,13 +218,30 @@ sampler_base_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
sampler->uloc.TransformMatrix =
vt->GetUniformLocation(program, "TransformMatrix");
if (sampler->uloc.TransformMatrix == -1)
return VLC_EGENERIC;
sampler->uloc.OrientationMatrix =
vt->GetUniformLocation(program, "OrientationMatrix");
if (sampler->uloc.OrientationMatrix == -1)
return VLC_EGENERIC;
for (unsigned int i = 0; i < interop->tex_count; ++i) for (unsigned int i = 0; i < interop->tex_count; ++i)
{ {
char name[sizeof("TextureX")]; char name[sizeof("TexCoordsMapX")];
snprintf(name, sizeof(name), "Texture%1u", i); snprintf(name, sizeof(name), "Texture%1u", i);
sampler->uloc.Texture[i] = vt->GetUniformLocation(program, name); sampler->uloc.Texture[i] = vt->GetUniformLocation(program, name);
if (sampler->uloc.Texture[i] == -1) if (sampler->uloc.Texture[i] == -1)
return VLC_EGENERIC; return VLC_EGENERIC;
snprintf(name, sizeof(name), "TexCoordsMap%1u", i);
sampler->uloc.TexCoordsMap[i] = vt->GetUniformLocation(program, name);
if (sampler->uloc.TexCoordsMap[i] == -1)
return VLC_EGENERIC;
if (interop->tex_target == GL_TEXTURE_RECTANGLE) if (interop->tex_target == GL_TEXTURE_RECTANGLE)
{ {
snprintf(name, sizeof(name), "TexSize%1u", i); snprintf(name, sizeof(name), "TexSize%1u", i);
......
...@@ -357,24 +357,10 @@ opengl_link_program(struct vlc_gl_renderer *renderer) ...@@ -357,24 +357,10 @@ opengl_link_program(struct vlc_gl_renderer *renderer)
GET_ALOC(PicCoordsIn, "PicCoordsIn"); GET_ALOC(PicCoordsIn, "PicCoordsIn");
GET_ALOC(VertexPosition, "VertexPosition"); GET_ALOC(VertexPosition, "VertexPosition");
#define GET_SAMPLER_ULOC(x, str) GET_LOC(Uniform, sampler->uloc.x, str)
GET_SAMPLER_ULOC(TransformMatrix, "TransformMatrix");
GET_SAMPLER_ULOC(OrientationMatrix, "OrientationMatrix");
GET_SAMPLER_ULOC(TexCoordsMap[0], "TexCoordsMap0");
/* MultiTexCoord 1 and 2 can be optimized out if not used */
if (interop->tex_count > 1)
GET_SAMPLER_ULOC(TexCoordsMap[1], "TexCoordsMap1");
else
sampler->uloc.TexCoordsMap[1] = -1;
if (interop->tex_count > 2)
GET_SAMPLER_ULOC(TexCoordsMap[2], "TexCoordsMap2");
else
sampler->uloc.TexCoordsMap[2] = -1;
#undef GET_LOC #undef GET_LOC
#undef GET_ULOC #undef GET_ULOC
#undef GET_ALOC #undef GET_ALOC
#undef GET_SAMPLER_ULOC
int ret = sampler->pf_fetch_locations(sampler, program_id); int ret = sampler->pf_fetch_locations(sampler, program_id);
assert(ret == VLC_SUCCESS); assert(ret == VLC_SUCCESS);
if (ret != VLC_SUCCESS) if (ret != VLC_SUCCESS)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment