openvr icon indicating copy to clipboard operation
openvr copied to clipboard

[vrcompositor]Tracked Camera: Failed to create static GPU resources.

Open fww0071215 opened this issue 11 months ago • 2 comments

Greetings, I am presently engaged in the development of a VR driver operating in extended mode. I have successfully managed to display the VR imagery onto the correct monitor; however, I have encountered several issues whilst undertaking the development related to the camera functionalities.

My driver, referencing the implementation of openvr-customhmd, has incorporated the IVRCameraComponent. I have instrumented each interface with logging and set breakpoints, yet it seems that SteamVR has not invoked the IVRCameraComponent interface that I have implemented. Within the vrcompositor.txt, I discovered the following log entries:

Tue Jan 14 2025 14:30:16.273 [Info] - Initializing camera Tue Jan 14 2025 14:30:16.273 [Info] - Creating static resources for tracked camera Tue Jan 14 2025 14:30:16.274 [Info] - Tracked Camera: Failed to create static GPU resources. Tue Jan 14 2025 14:30:16.274 [Info] - D3D11 Camera Initialization failure. Is there something incorrect in my implementation? Below is the relevant portion of my code:

void* Cuco_TrackedDeviceServerDriver::GetComponent(const char* pchComponentNameAndVersion)
{
	if (strcmp(pchComponentNameAndVersion, vr::IVRDisplayComponent_Version) == 0)
	{
		return (vr::IVRDisplayComponent*)this;
	}
	if (strcmp(pchComponentNameAndVersion, vr::IVRCameraComponent_Version) == 0)
	{
		return (vr::IVRCameraComponent*)this;
	}
	return nullptr;
}
ret = vr::VRProperties()->SetBoolProperty(container, vr::Prop_CameraSupportsCompatibilityModes_Bool, false);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_NumCameras_Int32, 1);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_CameraCompatibilityMode_Int32, vr::CAMERA_COMPAT_MODE_ISO_30FPS);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_CameraFirmwareVersion_Uint64, 20250114);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_CameraFrameLayout_Int32, vr::EVRTrackedCameraFrameLayout_Mono);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_CameraStreamFormat_Int32, vr::CVS_FORMAT_RGB24);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_DisplayMCImageWidth_Int32, 1920);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_DisplayMCImageHeight_Int32, 1080);
ret = vr::VRProperties()->SetInt32Property(container, vr::Prop_DisplayMCImageNumChannels_Int32, 3);
ret = vr::VRProperties()->SetStringProperty(container, vr::Prop_CameraFirmwareDescription_String, "camera--");
ret = vr::VRProperties()->SetFloatProperty(container, vr::Prop_CameraExposureTime_Float, 0.12);
ret = vr::VRProperties()->SetFloatProperty(container, vr::Prop_CameraGlobalGain_Float, 0.12);

auto cameraToHeadTransfor = vr::HmdMatrix34_t();
Quaternion::HmdMatrix_SetIdentity(&cameraToHeadTransfor);
ret = vr::VRProperties()->SetProperty(container, vr::Prop_CameraToHeadTransform_Matrix34, &cameraToHeadTransfor, sizeof(cameraToHeadTransfor), vr::k_unHmdMatrix34PropertyTag);
ret = vr::VRProperties()->SetProperty(container, vr::Prop_CameraToHeadTransforms_Matrix34_Array, &cameraToHeadTransfor, sizeof(cameraToHeadTransfor), vr::k_unHmdMatrix34PropertyTag);
int df = vr::VRDistortionFunctionType_FTheta;
ret = vr::VRProperties()->SetProperty(container, vr::Prop_CameraDistortionFunction_Int32_Array, &df, sizeof(df), vr::k_unInt32PropertyTag);
float dc = 1;
ret = vr::VRProperties()->SetProperty(container, vr::Prop_CameraDistortionCoefficients_Float_Array, &dc, sizeof(dc), vr::k_unFloatPropertyTag);
int wb[4] = { 1,1,1,1 };
ret = vr::VRProperties()->SetProperty(container, vr::Prop_CameraWhiteBalance_Vector4_Array, &wb[0], sizeof(wb), vr::k_unInt32PropertyTag);
ret = vr::VRProperties()->SetBoolProperty(container, vr::Prop_HasCamera_Bool, true);
ret = vr::VRProperties()->SetBoolProperty(container, vr::Prop_HasCameraComponent_Bool, true);

Please disregard my implementation of IVRCameraComponent for now; currently, I only wish to test the interface calls.

bool Cuco_TrackedDeviceServerDriver::GetCameraFrameBufferingRequirements(int* pDefaultFrameQueueSize, uint32_t* pFrameBufferDataSize)
{
	FCA_LOG(e_FCA_Log_Level_INFO, "GetCameraFrameDimensions");
	DriverLog(__FUNCTION__);
	*pDefaultFrameQueueSize = 1;
	*pFrameBufferDataSize = 16777216;
	return true;
}
bool Cuco_TrackedDeviceServerDriver::SetCameraFrameBuffering(int nFrameBufferCount, void** ppFrameBuffers, uint32_t nFrameBufferDataSize)
{
	FCA_LOG(e_FCA_Log_Level_INFO, "GetCameraFrameDimensions");
	DriverLog(__FUNCTION__);
	return true;
}
bool Cuco_TrackedDeviceServerDriver::SetCameraVideoStreamFormat(vr::ECameraVideoStreamFormat nVideoStreamFormat)
{
	FCA_LOG(e_FCA_Log_Level_INFO, "GetCameraFrameDimensions");
	DriverLog(__FUNCTION__);


	if (vr::CVS_FORMAT_RGB24 != nVideoStreamFormat)
		return false;
	return true;
}

fww0071215 avatar Jan 14 '25 06:01 fww0071215

@fww0071215, did you ever solve this problem? I am hitting the same error while trying to add support to my driver :( None of the methods from IVRCameraComponent are even being invoked, so there must be a missing property or something?

Thanks!

mbucchia avatar Jul 10 '25 07:07 mbucchia

@fww0071215, did you ever solve this problem? I am hitting the same error while trying to add support to my driver :( None of the methods from IVRCameraComponent are even being invoked, so there must be a missing property or something?

Thanks!

I haven't solved this problem yet.

fww0071215 avatar Sep 08 '25 07:09 fww0071215