From 25d0107d2435a5da5064b1cbb00de00e8f797fb9 Mon Sep 17 00:00:00 2001 From: Jin Jung Date: Fri, 30 Jan 2026 04:47:13 -0800 Subject: [PATCH] SWDEV-575867: Fix error code for mapped graphics resources (#2662) --- projects/clr/hipamd/src/hip_gl.cpp | 10 +++++----- .../unit/gl_interop/hipGraphicsUnregisterResource.cc | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/clr/hipamd/src/hip_gl.cpp b/projects/clr/hipamd/src/hip_gl.cpp index 3648a1bd27..b6681e02aa 100644 --- a/projects/clr/hipamd/src/hip_gl.cpp +++ b/projects/clr/hipamd/src/hip_gl.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc. +/* Copyright (c) 2010 - 2026 Advanced Micro Devices, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -234,7 +234,7 @@ hipError_t hipGraphicsSubResourceGetMappedArray(hipArray_t* array, hipGraphicsRe LogError("invalid arrayIndex, arrayIndex higher than zero not implemented"); HIP_RETURN(hipErrorInvalidValue); } - + size_t height = image->getHeight(); size_t width = image->getWidth(); size_t depth = image->getDepth(); @@ -724,7 +724,7 @@ hipError_t hipGraphicsGLRegisterBuffer(hipGraphicsResource** resource, GLuint bu } HIP_RETURN(hipSuccess); } - + hipError_t hipGraphicsMapResources(int count, hipGraphicsResource_t* resources, hipStream_t stream) { HIP_INIT_API(hipGraphicsMapResources, count, resources, stream); @@ -945,8 +945,8 @@ hipError_t hipGraphicsUnregisterResource(hipGraphicsResource_t resource) { } if (device->mappedGraphics().isValid(resource)) { - LogError("resource still mapped"); - HIP_RETURN(hipErrorArrayIsMapped); + LogError("resource already mapped"); + HIP_RETURN(hipErrorAlreadyMapped); } if (!device->registeredGraphics().isValid(resource)) { diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc index 714bde40fc..df6d3c5e6a 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc @@ -1,5 +1,5 @@ /* -Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2022 - 2026 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -57,6 +57,6 @@ TEST_CASE("Unit_hipGraphicsUnregisterResource_Negative_Parameters") { hipGraphicsResource* mapped_resource; HIP_CHECK(hipGraphicsGLRegisterBuffer(&mapped_resource, vbo, hipGraphicsRegisterFlagsNone)); HIP_CHECK(hipGraphicsMapResources(1, &mapped_resource, 0)); - HIP_CHECK_ERROR(hipGraphicsUnregisterResource(mapped_resource), hipErrorArrayIsMapped); + HIP_CHECK_ERROR(hipGraphicsUnregisterResource(mapped_resource), hipErrorAlreadyMapped); } }