DECLARE_TEST( uuid, string ) { uuid_t uuid, uuidref; char* str; uuidref = uuid_generate_random(); EXPECT_FALSE( uuid_is_null( uuidref ) ); str = string_from_uuid( uuidref ); EXPECT_NE( str, 0 ); uuid = string_to_uuid( str ); EXPECT_FALSE( uuid_is_null( uuid ) ); EXPECT_TRUE( uuid_equal( uuid, uuidref ) ); string_deallocate( str ); uuid = string_to_uuid( "" ); EXPECT_EQ_MSGFORMAT( uuid_is_null( uuid ), true, "empty string did not convert to null uuid: %s", string_from_uuid_static( uuid ) ); uuid = string_to_uuid( "0" ); EXPECT_EQ_MSGFORMAT( uuid_is_null( uuid ), true, "\"0\" string did not convert to null uuid: %s", string_from_uuid_static( uuid ) ); uuid = string_to_uuid( string_from_uuid_static( uuid_null() ) ); EXPECT_EQ_MSGFORMAT( uuid_is_null( uuid ), true, "null uuid reconvert through string did not convert to null uuid: %s", string_from_uuid_static( uuid ) ); return 0; }
object_t render_shader_load(render_backend_t* backend, const uuid_t uuid) { object_t shaderobj = render_backend_shader_acquire(backend, uuid); if (shaderobj && render_backend_shader_resolve(backend, shaderobj)) return shaderobj; #if RESOURCE_ENABLE_LOCAL_CACHE uint64_t platform = render_backend_resource_platform(backend); render_shader_t* shader = nullptr; stream_t* stream; resource_header_t header; bool success = false; bool recompile = false; bool recompiled = false; error_context_declare_local( char uuidbuf[40]; const string_t uuidstr = string_from_uuid(uuidbuf, sizeof(uuidbuf), uuid); );
inline std::string generate_random_uuid_str(CassUuidGen* uuid_gen) { return string_from_uuid(generate_random_uuid(uuid_gen)); }
goto retry; } } error_context_pop(); #endif return shaderobj; } bool render_shader_reload(render_shader_t* shader, const uuid_t uuid) { error_context_declare_local( char uuidbuf[40]; const string_t uuidstr = string_from_uuid(uuidbuf, sizeof(uuidbuf), uuid); ); error_context_push(STRING_CONST("reloading shader"), STRING_ARGS(uuidstr)); render_backend_t* backend = shader->backend; render_backend_enable_thread(backend); bool success = false; render_shader_t tmpshader; tmpshader.shadertype = 0; uint64_t platform = render_backend_resource_platform(backend); stream_t* stream = resource_stream_open_static(uuid, platform); if (stream) { resource_header_t header = resource_stream_read_header(stream);