#include <stdbool.h>
#include "util/hash_table.h"
#include "util/set.h"
+#include "util/u_memory.h"
#include "context.h"
#include "glformats.h"
#include "texobj.h"
surf->output = isOutput;
for (i = 0; i < numTextureNames; ++i) {
struct gl_texture_object *tex;
- tex = _mesa_lookup_texture(ctx, textureNames[i]);
+
+ tex = _mesa_lookup_texture_err(ctx, textureNames[i],
+ "VDPAURegisterSurfaceNV");
if (tex == NULL) {
free(surf);
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "VDPAURegisterSurfaceNV(texture ID not found)");
return (GLintptr)NULL;
}
return (GLintptr)NULL;
}
- if (tex->Target == 0)
+ if (tex->Target == 0) {
tex->Target = target;
- else if (tex->Target != target) {
+ tex->TargetIndex = _mesa_tex_target_to_index(ctx, target);
+ } else if (tex->Target != target) {
_mesa_unlock_texture(ctx, tex);
free(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,