Browse Source

metal: implement internal Shader::setVideoTextures method

Alex Szpakowski 4 years ago
parent
commit
b1692a4000
1 changed files with 14 additions and 1 deletions
  1. 14 1
      src/modules/graphics/metal/Shader.mm

+ 14 - 1
src/modules/graphics/metal/Shader.mm

@@ -851,7 +851,20 @@ void Shader::sendBuffers(const UniformInfo *info, love::graphics::Buffer **buffe
 
 
 void Shader::setVideoTextures(love::graphics::Texture *ytexture, love::graphics::Texture *cbtexture, love::graphics::Texture *crtexture)
 void Shader::setVideoTextures(love::graphics::Texture *ytexture, love::graphics::Texture *cbtexture, love::graphics::Texture *crtexture)
 {
 {
-	// TODO
+	const BuiltinUniform builtins[3] = {
+		BUILTIN_TEXTURE_VIDEO_Y,
+		BUILTIN_TEXTURE_VIDEO_CB,
+		BUILTIN_TEXTURE_VIDEO_CR,
+	};
+
+	love::graphics::Texture *textures[3] = {ytexture, cbtexture, crtexture};
+
+	for (int i = 0; i < 3; i++)
+	{
+		const UniformInfo *info = builtinUniformInfo[builtins[i]];
+		if (info != nullptr)
+			sendTextures(info, &textures[i], 1);
+	}
 }
 }
 
 
 bool Shader::hasUniform(const std::string &name) const
 bool Shader::hasUniform(const std::string &name) const